/* ============================================================
   assets/css/admin.css — Estilos del panel de administración
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ---- Variables ---- */
:root {
    --bg:          #F1F5F9;
    --surface:     #FFFFFF;
    --sidebar-bg:  #0F172A;
    --sidebar-txt: rgba(255,255,255,.75);
    --sidebar-act: #2563EB;
    --primary:     #2563EB;
    --primary-h:   #1D4ED8;
    --danger:      #EF4444;
    --success:     #22C55E;
    --warning:     #F59E0B;
    --txt:         #1E293B;
    --txt-muted:   #64748B;
    --border:      #E2E8F0;
    --radius:      10px;
    --radius-sm:   6px;
    --shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:   0 4px 16px rgba(0,0,0,.1);
    --sidebar-w:   230px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; font-size: 14px; color: var(--txt); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---- Layout ---- */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 50;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-empresa {
    padding: 10px 18px;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar-empresa small { color: rgba(255,255,255,.4); font-size: 11px; display: block; }
.sidebar-empresa strong { color: rgba(255,255,255,.85); font-size: 13px; }

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    color: var(--sidebar-txt);
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 0;
    transition: background .15s, color .15s;
}
.nav-item:hover  { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--sidebar-act); color: #fff; }
.nav-item.nav-slideshow { color: rgba(255,255,255,.5); font-size: 12.5px; }
.nav-item.nav-slideshow:hover { color: #fff; }
.nav-icon { font-size: 15px; min-width: 20px; text-align: center; }
.nav-separator { height: 1px; background: rgba(255,255,255,.07); margin: 8px 16px; }

.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: rgba(255,255,255,.55);
    font-size: 12.5px;
}
.logout-btn { font-size: 18px; cursor: pointer; color: rgba(255,255,255,.4); transition: color .2s; }
.logout-btn:hover { color: var(--danger); }

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

.page-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 28px;
}
.page-header h1 { font-size: 18px; font-weight: 700; color: var(--txt); }

.page-body { padding: 24px 28px; }

/* ---- Login ---- */
.login-body {
    background: linear-gradient(135deg, #0F172A 0%, #1E3A8A 100%);
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
}
.login-wrap { width: 100%; max-width: 400px; padding: 20px; }
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px 36px;
    box-shadow: 0 25px 60px rgba(0,0,0,.3);
}
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; font-weight: 700; font-size: 17px; }
.login-card h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.login-sub { color: var(--txt-muted); margin-bottom: 24px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--txt); }
.form-group label small { font-weight: 400; color: var(--txt-muted); }
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }

input[type=text],input[type=email],input[type=password],
input[type=number],input[type=date],select,textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--txt);
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}
input:focus,select:focus,textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.input-sm { padding: 6px 10px; font-size: 13px; width: auto; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 13.5px; font-weight: 600;
    border: 1.5px solid transparent;
    cursor: pointer; text-decoration: none;
    transition: all .18s; white-space: nowrap;
    font-family: inherit;
}
.btn-primary   { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-h); border-color: var(--primary-h); }
.btn-outline   { background: transparent; color: var(--txt); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-danger    { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-block     { width: 100%; }
.btn-sm        { padding: 6px 14px; font-size: 12.5px; }
.btn-xs        { padding: 4px 10px; font-size: 12px; }
.btn-filter    { background: var(--surface); color: var(--txt-muted); border-color: var(--border); border-radius: 20px; padding: 5px 14px; font-size: 13px; }
.btn-filter.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn:disabled  { opacity: .5; cursor: not-allowed; }

/* ---- Alerts ---- */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 16px; }
.alert-error { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.alert-success { background: #F0FDF4; color: #15803D; border: 1px solid #BBF7D0; }

/* ---- Dashboard stats ---- */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}
.stat-icon { font-size: 28px; width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.icon-blue   { background: #EFF6FF; }
.icon-green  { background: #F0FDF4; }
.icon-yellow { background: #FFFBEB; }
.icon-purple { background: #F5F3FF; }
.stat-num { display: block; font-size: 26px; font-weight: 800; line-height: 1; }
.stat-lbl { display: block; font-size: 12px; color: var(--txt-muted); margin-top: 3px; }

/* ---- Slideshow link ---- */
.slideshow-link-box {
    background: linear-gradient(135deg, #1E3A8A, #2563EB);
    color: #fff;
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}
.slb-info strong { display: block; font-size: 13px; margin-bottom: 4px; opacity: .85; }
.slb-info code { font-size: 14px; background: rgba(255,255,255,.15); padding: 3px 8px; border-radius: 4px; }
.slideshow-link-box .btn-outline { color: #fff; border-color: rgba(255,255,255,.5); }
.slideshow-link-box .btn-outline:hover { background: rgba(255,255,255,.15); }

/* ---- Toolbar ---- */
.toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; }

/* ---- Config bar ---- */
.config-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 18px;
    margin-bottom: 18px;
}
.config-form {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    font-size: 13.5px; font-weight: 500;
}

/* ---- Image grid ---- */
.img-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.img-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 2px solid var(--border);
    transition: transform .2s, box-shadow .2s;
}
.img-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.img-card.vigente  { border-color: #BBF7D0; }
.img-card.vencida  { opacity: .75; }

.img-thumb {
    position: relative;
    aspect-ratio: 16/9;
    background: #f8fafc;
    overflow: hidden;
}
.img-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.img-card:hover .img-thumb img { transform: scale(1.04); }

.img-badge {
    position: absolute; top: 8px; left: 8px;
    background: rgba(0,0,0,.55);
    color: #fff; font-size: 11px; font-weight: 600;
    padding: 2px 8px; border-radius: 20px;
}
.img-card.vigente .img-badge { background: #15803D; }

.img-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center; gap: 8px;
    opacity: 0; transition: opacity .2s;
}
.img-card:hover .img-overlay { opacity: 1; }

.btn-icon {
    background: rgba(255,255,255,.9); border: none;
    width: 36px; height: 36px; border-radius: 8px;
    font-size: 15px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .2s;
}
.btn-icon:hover { background: #fff; }

.img-meta { padding: 10px 12px; }
.img-title { font-weight: 600; font-size: 13px; margin-bottom: 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.img-empresa, .img-fechas, .img-orden { font-size: 11.5px; color: var(--txt-muted); margin-top: 2px; }

/* ---- Section header ---- */
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.section-header h2 { font-size: 16px; font-weight: 700; }

/* ---- Empty state ---- */
.empty-state {
    grid-column: 1 / -1;
    text-align: center; padding: 60px 20px;
    color: var(--txt-muted);
}
.empty-state p { margin-bottom: 16px; font-size: 15px; }

/* ---- Pagination ---- */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; }
.page-btn {
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    background: var(--surface); border: 1px solid var(--border);
    font-size: 13px; font-weight: 600; color: var(--txt);
    transition: all .15s;
}
.page-btn:hover, .page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---- Modal ---- */
.modal {
    position: fixed; inset: 0;
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(3px);
}
.modal-box {
    position: relative;
    background: var(--surface);
    border-radius: 14px;
    width: 100%; max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    z-index: 1;
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--txt-muted); line-height: 1; }
.modal-box form { padding: 20px 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding-top: 16px; border-top: 1px solid var(--border); margin-top: 8px; }

/* ---- Drop zone ---- */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}
.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--primary); background: #EFF6FF;
}
.drop-icon { font-size: 36px; display: block; margin-bottom: 8px; }
.drop-zone p { color: var(--txt-muted); font-size: 13.5px; }

/* ---- Preview ---- */
.preview-container { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.preview-item { width: 80px; }
.preview-item img { width: 80px; height: 56px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.preview-item p { font-size: 10px; color: var(--txt-muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Progress bar ---- */
.progress-bar-wrap { margin-top: 12px; }
.progress-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); width: 0%; transition: width .3s; }
#progressTxt { font-size: 12px; color: var(--txt-muted); display: block; margin-top: 4px; }

/* ---- Toast ---- */
.toast {
    position: fixed; bottom: 24px; right: 24px;
    background: #1E293B; color: #fff;
    padding: 12px 20px; border-radius: 10px;
    font-size: 14px; font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
    transform: translateY(20px); opacity: 0;
    transition: all .3s;
    z-index: 9999;
}
.toast-show { transform: translateY(0); opacity: 1; }
.toast-success { border-left: 4px solid var(--success); }
.toast-error   { border-left: 4px solid var(--danger); }

/* ---- Tabla ---- */
.table-wrap { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tabla thead { background: var(--bg); }
.tabla th { padding: 11px 14px; text-align: left; font-weight: 600; color: var(--txt-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); }
.tabla td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tabla tbody tr:last-child td { border-bottom: none; }
.tabla tbody tr:hover { background: #FAFBFC; }
code { background: var(--bg); padding: 2px 7px; border-radius: 4px; font-size: 12.5px; }

/* ---- Badges ---- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.badge-green { background: #F0FDF4; color: #15803D; }
.badge-gray  { background: #F1F5F9; color: #64748B; }
.badge-red   { background: #FEF2F2; color: #B91C1C; }
