/* =====================================================
   SISASI - Admin Panel CSS
   Inspired by ASI Avalúos brand: #00aeef, #38c8a8
   Font: Poppins, Rajdhani
   ===================================================== */

:root {
    --primary:     #00aeef;
    --primary-dark:#0090c9;
    --secondary:   #38c8a8;
    --dark:        #1a2035;
    --dark-light:  #252d48;
    --sidebar-w:   260px;
    --topbar-h:    64px;
    --text-muted:  #8b9ab1;
    --bg-body:     #f0f4f8;
    --white:       #ffffff;
    --border:      #e3eaf4;
    --success:     #28a745;
    --danger:      #dc3545;
    --warning:     #ffc107;
    --info:        #17a2b8;
    --transition:  0.25s ease;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-body);
    color: #444;
    margin: 0;
    min-height: 100vh;
    font-size: 14px;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: linear-gradient(180deg, var(--dark) 0%, var(--dark-light) 100%);
    display: flex;
    flex-direction: column;
    transition: width var(--transition);
    z-index: 1000;
    overflow: hidden;
}

.sidebar.collapsed { width: 68px; }

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    min-height: var(--topbar-h);
}

.sidebar-logo {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    color: #fff; font-size: 16px;
}

.sidebar-brand-text { overflow: hidden; white-space: nowrap; }

.brand-title {
    display: block;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 20px;
    color: var(--white);
    letter-spacing: 1px;
    line-height: 1;
}

.brand-sub {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.nav-section-label {
    padding: 8px 20px 4px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition);
}

.sidebar.collapsed .nav-section-label { opacity: 0; height: 0; padding: 0; }

.nav-link-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: #a8b8d8;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all var(--transition);
    white-space: nowrap;
}

.nav-link-item i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
}

.nav-link-item:hover {
    color: var(--white);
    background: rgba(255,255,255,0.06);
    border-left-color: var(--primary);
}

.nav-link-item.active {
    color: var(--white);
    background: rgba(0,174,239,0.15);
    border-left-color: var(--primary);
}

.sidebar.collapsed .nav-link-item span { display: none; }

/* Footer */
.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info { display: flex; align-items: center; gap: 10px; flex: 1; overflow: hidden; }

.user-avatar { color: var(--primary); font-size: 26px; flex-shrink: 0; }

.user-details { overflow: hidden; white-space: nowrap; }

.user-name {
    display: block;
    color: var(--white);
    font-size: 12.5px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role { display: block; font-size: 10px; margin-top: 1px; }

.badge-role-admin   { color: #ffd700; }
.badge-role-editor  { color: var(--secondary); }
.badge-role-viewer  { color: var(--text-muted); }

.btn-logout {
    color: var(--text-muted);
    font-size: 16px;
    flex-shrink: 0;
    text-decoration: none;
    padding: 6px;
    border-radius: 6px;
    transition: all var(--transition);
}

.btn-logout:hover { color: #ff6b6b; background: rgba(255,107,107,0.12); }

.sidebar.collapsed .user-details,
.sidebar.collapsed .btn-logout { display: none; }

/* ===================== MAIN CONTENT ===================== */
.main-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition);
}

.main-content.expanded { margin-left: 68px; }

/* Topbar */
.topbar {
    height: var(--topbar-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 18px;
    padding: 6px 8px;
    border-radius: 6px;
    transition: all var(--transition);
}

.sidebar-toggle:hover { background: var(--bg-body); color: var(--primary); }

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    flex: 1;
}

.topbar-breadcrumb a { color: var(--primary); text-decoration: none; font-weight: 500; }
.topbar-breadcrumb a:hover { text-decoration: underline; }
.topbar-breadcrumb .separator { color: var(--text-muted); font-size: 10px; }
.topbar-breadcrumb .current { color: #444; font-weight: 600; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-muted);
    font-size: 13px;
}

.topbar-date i { margin-right: 5px; color: var(--primary); }

/* Page Content */
.page-content { padding: 28px 28px 40px; flex: 1; }

/* ===================== CARDS ===================== */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    overflow: hidden;
}

.card-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header h4, .card-header h5 {
    margin: 0;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: var(--dark);
    padding: 0;
}

.card-body { padding: 24px; background: var(--white); }

/* Stat Cards */
.stat-card {
    border-radius: 14px;
    padding: 22px 24px;
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transition: transform var(--transition);
}

.stat-card:hover { transform: translateY(-3px); }

.stat-card-primary  { background: linear-gradient(135deg, var(--primary), #0099d6); }
.stat-card-success  { background: linear-gradient(135deg, var(--secondary), #38c8a8); }
.stat-card-warning  { background: linear-gradient(135deg, #f39c12, #e68b3c); }
.stat-card-info     { background: linear-gradient(135deg, #ad445b, #ad445b); }

.stat-icon { font-size: 36px; opacity: 0.85; }

.stat-info { flex: 1; }
.stat-value {
    font-family: 'Rajdhani', sans-serif;
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
}
.stat-label { font-size: 13px; opacity: 0.9; margin-top: 4px; }

/* ===================== TABLES ===================== */
.table-responsive { border-radius: 0 0 12px 12px; }

.table th {
    font-family: 'Rajdhani', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #555;
    border-top: none;
    background: #f8fafc;
    white-space: nowrap;
}

.table td { vertical-align: middle; font-size: 13.5px; }

.table tbody tr:hover { background: #f5fbff; }

/* ===================== BUTTONS ===================== */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
}

.btn-primary:hover, .btn-primary:focus {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-success {
    background: var(--secondary);
    border-color: var(--secondary);
    font-weight: 600;
}

.btn-success:hover { background: #2aaa8c; border-color: #2aaa8c; }

.btn-sm { font-size: 12px; padding: 4px 10px; }

.btn-action { padding: 4px 9px; font-size: 13px; border-radius: 6px; }

/* ===================== FORMS ===================== */
.form-label { font-weight: 600; font-size: 13px; color: #555; margin-bottom: 5px; }

.form-control, .form-select {
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 13.5px;
    padding: 8px 12px;
    color: #444;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,174,239,0.15);
    outline: none;
}

.form-section-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 8px;
    margin-bottom: 18px;
    margin-top: 24px;
}

.form-section-title:first-child { margin-top: 0; }

/* ===================== BADGES ===================== */
.badge-estatus {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.estatus-pendiente   { background: #fff3cd; color: #856404; }
.estatus-en_proceso  { background: #cce5ff; color: #004085; }
.estatus-completado  { background: #d4edda; color: #155724; }
.estatus-cancelado   { background: #f8d7da; color: #721c24; }

/* ===================== PDF BADGE ===================== */
.pdf-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #dc3545;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    transition: color var(--transition);
}

.pdf-link:hover { color: #a71d2a; }
.pdf-link i { font-size: 16px; }

.pdf-none { color: #ccc; font-size: 13px; font-style: italic; }

/* ===================== PAGE HEADER ===================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 12px;
    flex-wrap: wrap;
}

.page-header h2 {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 26px;
    color: var(--dark);
    margin: 0;
    padding: 0;
}

.page-header p {
    color: var(--text-muted);
    font-size: 13px;
    margin: 4px 0 0;
}

/* ===================== CONFIRM DELETE ===================== */
.confirm-delete-box {
    background: #fff5f5;
    border: 1px solid #f5c6cb;
    border-radius: 12px;
    padding: 28px 32px;
    text-align: center;
}

.confirm-delete-box .icon-warning {
    font-size: 56px;
    color: #dc3545;
    margin-bottom: 16px;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
    .sidebar { width: 68px; }
    .sidebar .nav-link-item span,
    .sidebar .nav-section-label,
    .sidebar .sidebar-brand-text,
    .sidebar .user-details,
    .sidebar .btn-logout { display: none; }

    .main-content { margin-left: 68px; }
    .page-content { padding: 16px; }
    .stat-value { font-size: 28px; }
}

/* ===================== LOGIN PAGE ===================== */
.login-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-light) 50%, #1a3a5c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--primary), var(--primary));
    padding: 36px 36px 28px;
    text-align: center;
}

.login-logo {
    width: 70px; height: 70px;
    background: rgba(255,255,255,0.2);
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--white);
    margin-bottom: 14px;
}

.login-header h1 {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 28px;
    color: var(--white);
    margin: 0;
    padding: 0;
}

.login-header p {
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    margin: 6px 0 0;
}

.login-body { padding: 32px 36px 36px; }

.login-body .form-control {
    padding: 11px 14px;
    font-size: 14px;
}

.login-body .btn-primary {
    padding: 12px;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-radius: 10px;
    width: 100%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
}

.login-body .btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #006fa0);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0,174,239,0.4);
}

.login-footer {
    text-align: center;
    padding: 16px;
    background: #f8fafc;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* File input */
.form-control[type="file"] { padding: 7px 12px; cursor: pointer; }

/* Utilities */
.text-primary-custom { color: var(--primary) !important; }
.fw-600 { font-weight: 600; }
.fs-13 { font-size: 13px; }
