/* ─────────────────────────────────────────────────────────
   SST Management System — Global Styles
   ───────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary:       #1e3a5f;
    --primary-light: #2a5298;
    --accent:        #00b4d8;
    --accent-soft:   #90e0ef;
    --sidebar-w:     260px;
    --nav-h:         60px;
    --bg-page:       #f0f4f8;
    --bg-card:       #ffffff;
    --text-main:     #1a2332;
    --text-muted:    #6b7a99;
    --border:        #dde3ee;
    --success:       #10b981;
    --danger:        #ef4444;
    --warning:       #f59e0b;
    --shadow-sm:     0 1px 4px rgba(0,0,0,.08);
    --shadow-md:     0 4px 16px rgba(0,0,0,.12);
    --radius:        10px;
    --transition:    .2s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    background: var(--bg-page);
    color: var(--text-main);
    height: 100%;
}

/* ── SCROLLBAR ───────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c0cbe0; border-radius: 8px; }

/* ── LOGIN ───────────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, #0f2444 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: rgba(255,255,255,.97);
    border-radius: 18px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 24px 64px rgba(0,0,0,.35);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--primary-light));
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo-icon {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    box-shadow: 0 8px 24px rgba(0,180,216,.3);
}

.login-logo .logo-icon i { color: #fff; font-size: 30px; }
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--primary); }
.login-logo p  { font-size: 13px; color: var(--text-muted); }

.form-label { font-weight: 500; color: var(--text-main); margin-bottom: 6px; }

.form-control {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 14px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,180,216,.15);
    outline: none;
}

.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 11px;
    font-weight: 600;
    font-size: 14px;
    width: 100%;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.btn-primary-custom:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(30,58,95,.3);
    opacity: .95;
}

/* ── APP LAYOUT ──────────────────────────────────────── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--primary) 0%, #0f2444 100%);
    min-height: 100vh;
    position: fixed;
    top: 0; left: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform var(--transition);
}

.sidebar-brand {
    height: var(--nav-h);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    text-decoration: none;
}

.sidebar-brand .brand-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent), #0077b6);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand .brand-icon i { color: #fff; font-size: 16px; }
.sidebar-brand .brand-text { color: #fff; font-weight: 700; font-size: 16px; line-height: 1.2; }
.sidebar-brand .brand-text span { display: block; font-size: 10px; font-weight: 400; opacity: .7; text-transform: uppercase; letter-spacing: .5px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 16px 0; }

.nav-section-label {
    text-transform: uppercase;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    color: rgba(255,255,255,.4);
    padding: 8px 20px 4px;
    margin-top: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    border-radius: 0;
    transition: background var(--transition), color var(--transition), padding-left var(--transition);
    position: relative;
    font-size: 13.5px;
}

.sidebar-link i { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }

.sidebar-link:hover,
.sidebar-link.active {
    background: rgba(255,255,255,.1);
    color: #fff;
    padding-left: 26px;
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.1);
    font-size: 11px;
    color: rgba(255,255,255,.35);
    text-align: center;
}

/* ── TOPNAV ──────────────────────────────────────────── */
.topnav {
    position: fixed;
    top: 0;
    left: var(--sidebar-w);
    right: 0;
    height: var(--nav-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 999;
    box-shadow: var(--shadow-sm);
}

.topnav-left { display: flex; align-items: center; gap: 12px; }

.topnav-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
}

.topnav-right { display: flex; align-items: center; gap: 12px; }

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 6px 14px 6px 8px;
    cursor: pointer;
    transition: background var(--transition);
    text-decoration: none;
    color: var(--text-main);
}

.user-badge:hover { background: #e2eaf5; }

.user-avatar {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.user-name { font-size: 13px; font-weight: 500; }

/* ── MAIN CONTENT ────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    margin-top: var(--nav-h);
    min-height: calc(100vh - var(--nav-h));
    padding: 28px;
    flex: 1;
}

/* ── CARDS ───────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-header-custom {
    padding: 18px 20px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.card-header-custom h5 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── STAT CARDS ──────────────────────────────────────── */
.stat-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 22px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 22px;
}

.stat-icon.blue   { background: rgba(42,82,152,.12); color: var(--primary-light); }
.stat-icon.teal   { background: rgba(0,180,216,.12); color: var(--accent); }
.stat-icon.green  { background: rgba(16,185,129,.12); color: var(--success); }
.stat-icon.orange { background: rgba(245,158,11,.12); color: var(--warning); }

.stat-info h3    { font-size: 26px; font-weight: 700; color: var(--text-main); }
.stat-info small { color: var(--text-muted); font-size: 12px; font-weight: 500; }

/* ── BUTTONS ─────────────────────────────────────────── */
.btn {
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 16px;
    transition: all var(--transition);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary   { background: var(--primary-light); color: #fff; }
.btn-primary:hover { background: var(--primary); color: #fff; }

.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }

.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }

.btn-warning   { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; color: #fff; }

.btn-outline   { background: transparent; border: 1.5px solid var(--border); color: var(--text-main); }
.btn-outline:hover { background: var(--bg-page); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; justify-content: center; }

/* ── TABLES ──────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    border-radius: 0 0 var(--radius) var(--radius);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.data-table thead th {
    background: var(--bg-page);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}

.data-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover td { background: #f7f9fc; }

/* ── BADGES ──────────────────────────────────────────── */
.badge-status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-active   { background: rgba(16,185,129,.12); color: var(--success); }
.badge-inactive { background: rgba(239,68,68,.12); color: var(--danger); }

/* ── MODALS ──────────────────────────────────────────── */
.modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0,0,0,.25);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    border-radius: 16px 16px 0 0;
    padding: 18px 24px;
    border-bottom: none;
}

.modal-header .btn-close { filter: invert(1); opacity: .8; }
.modal-title { font-weight: 600; font-size: 16px; }
.modal-body  { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); }

/* ── FOLDER TREE ─────────────────────────────────────── */
.folder-tree {
    list-style: none;
    padding: 0;
    margin: 0;
}

.folder-tree li { position: relative; }

.folder-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 7px;
    cursor: pointer;
    transition: background var(--transition);
    user-select: none;
    font-size: 13px;
}

.folder-item:hover { background: #eef3fb; }
.folder-item.active { background: rgba(42,82,152,.1); color: var(--primary); font-weight: 500; }

.folder-item .toggle-icon { width: 14px; font-size: 10px; color: var(--text-muted); flex-shrink: 0; }
.folder-item .folder-icon { font-size: 14px; flex-shrink: 0; }
.folder-item .folder-icon.open  { color: #f59e0b; }
.folder-item .folder-icon.closed { color: #94a3b8; }
.folder-item .folder-name { flex: 1; }
.folder-item .add-subfolder { opacity: 0; transition: opacity var(--transition); }
.folder-item:hover .add-subfolder { opacity: 1; }

.folder-children {
    padding-left: 18px;
    border-left: 1px dashed var(--border);
    margin-left: 12px;
}

/* ── DOCUMENT LIST ───────────────────────────────────── */
.doc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    background: var(--bg-card);
    transition: box-shadow var(--transition), transform var(--transition);
}

.doc-item:hover {
    box-shadow: var(--shadow-sm);
    transform: translateX(2px);
}

.doc-icon {
    width: 40px; height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.doc-icon.pdf  { background: rgba(239,68,68,.1); color: var(--danger); }
.doc-icon.word { background: rgba(42,82,152,.1); color: var(--primary); }
.doc-icon.excel{ background: rgba(16,185,129,.1); color: var(--success); }
.doc-icon.img  { background: rgba(0,180,216,.1); color: var(--accent); }
.doc-icon.generic { background: var(--bg-page); color: var(--text-muted); }

.doc-info { flex: 1; min-width: 0; }
.doc-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-meta { font-size: 11px; color: var(--text-muted); }

/* ── BREADCRUMB ──────────────────────────────────────── */
.breadcrumb-sst {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.breadcrumb-sst a { color: var(--primary-light); text-decoration: none; }
.breadcrumb-sst a:hover { text-decoration: underline; }
.breadcrumb-sst .sep { color: var(--border); }

/* ── EMPTY STATE ─────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i { font-size: 48px; opacity: .3; margin-bottom: 16px; display: block; }
.empty-state p { font-size: 14px; }

/* ── SEARCH BOX ──────────────────────────────────────── */
.search-box {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 13px;
}

.search-box input {
    padding-left: 34px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    font-size: 13px;
    height: 36px;
    background: var(--bg-page);
    transition: border-color var(--transition);
    width: 220px;
}

.search-box input:focus {
    border-color: var(--accent);
    outline: none;
    background: #fff;
}

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .topnav, .main-content, .app-footer { left: 0; margin-left: 0; }
}

/* ── UTILITIES ───────────────────────────────────────── */
.text-muted { color: var(--text-muted) !important; }
.fw-600 { font-weight: 600; }
.gap-8  { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }

/* ── FOOTER ──────────────────────────────────────────── */
.app-footer {
    margin-left: var(--sidebar-w);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 12px 28px;
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.footer-sep { color: var(--border); }

.footer-link {
    color: var(--primary-light);
    text-decoration: none;
    transition: color var(--transition);
}

.footer-link:hover { color: var(--accent); text-decoration: underline; }

/* Footer en login (centered) */
.login-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 12px;
    color: rgba(255,255,255,.45);
}

.login-footer a {
    color: rgba(255,255,255,.7);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition);
}

.login-footer a:hover { color: #fff; }

/* ── INPUT WITH ICON ─────────────────────────────────── */
.input-group-icon {
    position: relative;
}

.input-group-icon > i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
    z-index: 2;
    pointer-events: none;
}

.input-group-icon .icon-input {
    padding-left: 36px;
}

/* ── ALERT INFO CUSTOM ───────────────────────────────── */
.alert-info-custom {
    background: rgba(42,82,152,.07);
    border: 1px solid rgba(42,82,152,.2);
    border-left: 4px solid var(--primary-light);
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-main);
}

/* ── PASSWORD REQUIREMENTS ───────────────────────────── */
.pass-reqs {
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
}

.pass-reqs-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.pass-reqs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 16px;
}

.req-item {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color var(--transition);
}

.req-item.ok {
    color: var(--success);
}

.req-item .fa-circle-dot { font-size: 8px; }
.req-item.ok .fa-circle-dot::before { content: "\f058"; font-size: 12px; }

/* ── ADMIN USER AVATARS ──────────────────────────────── */
.admin-avatar {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.admin-avatar-lg {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 24px;
    font-weight: 700;
}

/* ── BADGE "TÚ" ──────────────────────────────────────── */
.badge-you {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent), var(--primary-light));
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: .3px;
    text-transform: uppercase;
}

/* ── FILA USUARIO ACTUAL ─────────────────────────────── */
.row-current-user td {
    background: rgba(0,180,216,.04) !important;
}

@media (max-width: 600px) {
    .pass-reqs-grid { grid-template-columns: 1fr; }
    .app-footer { margin-left: 0; flex-direction: column; text-align: center; gap: 4px; }
}
