/* ============================================================
   Masia Servicios — Estilos personalizados
   Bootstrap 5.3 como base
   ============================================================ */

/* Variables */
:root {
    --sidebar-width: 260px;
    --sidebar-bg: #1a2035;
    --sidebar-hover: #252d47;
    --sidebar-active: #2c5282;
    --sidebar-text: #a0aec0;
    --sidebar-text-active: #ffffff;
    --topbar-height: 60px;
    --primary: #2c5282;
    --primary-light: #3182ce;
    --danger: #e53e3e;
    --warning: #d69e2e;
    --success: #38a169;
    --info: #3182ce;
}

/* ── Body ── */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f0f4f8;
    min-height: 100vh;
}

/* ── Sidebar ── */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

#sidebar .sidebar-brand {
    padding: 20px 20px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

#sidebar .sidebar-brand .brand-title {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

#sidebar .sidebar-brand .brand-subtitle {
    color: var(--sidebar-text);
    font-size: 0.72rem;
    margin-top: 2px;
}

#sidebar .nav-section-title {
    color: #718096;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 18px 20px 6px;
}

#sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 9px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
    border-radius: 0;
    transition: all 0.2s;
    white-space: nowrap;
}

#sidebar .nav-link i {
    font-size: 1rem;
    width: 20px;
    flex-shrink: 0;
}

#sidebar .nav-link:hover {
    color: var(--sidebar-text-active);
    background: var(--sidebar-hover);
}

#sidebar .nav-link.active {
    color: var(--sidebar-text-active);
    background: var(--sidebar-active);
    border-left: 3px solid #63b3ed;
}

/* ── Main content ── */
#main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

/* ── Topbar ── */
#topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

#topbar .btn-sidebar-toggle {
    background: none;
    border: none;
    color: #4a5568;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    display: none; /* visible solo en móvil */
}

#topbar .page-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
    flex: 1;
}

#topbar .topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ── Content area ── */
.content-area {
    padding: 24px;
    flex: 1;
}

/* ── Cards de estadísticas ── */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow 0.2s;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2d3748;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: #718096;
    margin-top: 3px;
}

/* ── Tablas ── */
.table-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.table-card .table-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-card .table-card-header h6 {
    font-weight: 600;
    color: #2d3748;
    margin: 0;
}

.table-card .table {
    margin: 0;
}

.table-card .table thead th {
    background: #f7fafc;
    color: #4a5568;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 16px;
}

.table-card .table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    color: #4a5568;
    font-size: 0.875rem;
    border-bottom: 1px solid #f0f4f8;
}

.table-card .table tbody tr:last-child td {
    border-bottom: none;
}

/* ── Badges de estado ── */
.badge-preventivo { background: #ebf8ff; color: #2b6cb0; }
.badge-correctivo { background: #fff5f5; color: #c53030; }
.badge-vencido    { background: #fff5f5; color: #c53030; }
.badge-proximo    { background: #fffbeb; color: #b7791f; }
.badge-pendiente  { background: #f0fff4; color: #276749; }
.badge-atendido   { background: #f7fafc; color: #4a5568; }

/* ── Login page ── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a2035 0%, #2c5282 100%);
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo .logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #2c5282, #3182ce);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 12px;
}

.login-logo h4 {
    color: #2d3748;
    font-weight: 700;
    margin: 0;
}

.login-logo p {
    color: #718096;
    font-size: 0.85rem;
    margin: 4px 0 0;
}

/* ── Notificación de alertas ── */
.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ── Selector de país ── */
.pais-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 0.82rem;
    color: #4a5568;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
    }

    #sidebar.show {
        transform: translateX(0);
    }

    #main-content {
        margin-left: 0;
    }

    #topbar .btn-sidebar-toggle {
        display: block;
    }

    .content-area {
        padding: 16px;
    }
}

/* ── Utilidades ── */
.text-truncate-150 {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cursor-pointer { cursor: pointer; }
