/* =========================================================
   Sistema de Homologaciones ATT Bolivia
   ========================================================= */

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

:root {
    --navy:      #003366;
    --navy-dark: #00244d;
    --blue:      #0055aa;
    --blue-lt:   #e8f0fb;
    --orange:    #e05c00;
    --green:     #1a7f4b;
    --red:       #c0392b;
    --gray-50:   #f8f9fa;
    --gray-100:  #f0f2f5;
    --gray-200:  #e9ecef;
    --gray-400:  #ced4da;
    --gray-600:  #6c757d;
    --gray-800:  #343a40;
    --text:      #212529;
    --radius:    8px;
    --shadow:    0 2px 8px rgba(0,0,0,.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,.12);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-100);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- HEADER ---- */
.site-header {
    background: var(--navy);
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    height: 70px;
}

.header-logo {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 900;
    color: #fff;
    flex-shrink: 0;
}

.header-titles { flex: 1; }
.header-titles h1 { font-size: 17px; font-weight: 700; line-height: 1.2; }
.header-titles p  { font-size: 12px; color: rgba(255,255,255,.65); margin-top: 2px; }

.header-nav a {
    color: rgba(255,255,255,.85);
    font-size: 14px;
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: background .15s;
}
.header-nav a:hover { background: rgba(255,255,255,.12); text-decoration: none; }

/* ---- MAIN CONTENT ---- */
main { flex: 1; max-width: 1100px; width: 100%; margin: 0 auto; padding: 40px 24px; }

/* ---- FOOTER ---- */
.site-footer {
    background: var(--navy-dark);
    color: rgba(255,255,255,.6);
    text-align: center;
    padding: 20px;
    font-size: 13px;
    margin-top: auto;
}

/* ---- CARDS ---- */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 10px;
}
.card-header h2 { font-size: 18px; font-weight: 600; color: var(--navy); }
.card-body  { padding: 24px; }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: opacity .15s, transform .1s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn:active { transform: scale(.97); }

.btn-primary  { background: var(--blue);   color: #fff; }
.btn-navy     { background: var(--navy);   color: #fff; }
.btn-success  { background: var(--green);  color: #fff; }
.btn-danger   { background: var(--red);    color: #fff; }
.btn-outline  { background: transparent; border: 2px solid var(--navy); color: var(--navy); }
.btn-sm       { padding: 6px 14px; font-size: 13px; }
.btn-block    { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- FORM ---- */
.form-group   { margin-bottom: 20px; }
.form-label   { display: block; font-size: 14px; font-weight: 600; color: var(--gray-800); margin-bottom: 6px; }
.form-control {
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;
    border: 1.5px solid var(--gray-400);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0,85,170,.15);
}
.form-hint { font-size: 12px; color: var(--gray-600); margin-top: 5px; }

/* ---- ALERTS ---- */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert-error   { background: #fdecea; color: #721c24; border-left: 4px solid var(--red); }
.alert-success { background: #d4edda; color: #155724; border-left: 4px solid var(--green); }
.alert-info    { background: var(--blue-lt); color: #0c3664; border-left: 4px solid var(--blue); }

/* ---- BADGE ---- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: var(--blue-lt);
    color: var(--blue);
}

/* ---- DOCUMENT GRID (public listing) ---- */
.docs-hero {
    background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
    border-radius: var(--radius);
    padding: 40px 48px;
    color: #fff;
    margin-bottom: 32px;
}
.docs-hero h2 { font-size: 26px; margin-bottom: 10px; }
.docs-hero p  { color: rgba(255,255,255,.8); font-size: 15px; margin-bottom: 24px; }

.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.doc-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    border-top: 4px solid var(--navy);
    transition: box-shadow .2s;
}
.doc-card:hover { box-shadow: var(--shadow-md); }
.doc-card .doc-icon { font-size: 36px; margin-bottom: 12px; }
.doc-card h3 { font-size: 16px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.doc-card p  { font-size: 13px; color: var(--gray-600); line-height: 1.5; margin-bottom: 12px; }
.doc-meta    { font-size: 12px; color: var(--gray-600); display: flex; gap: 12px; flex-wrap: wrap; }

.filters-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    align-items: center;
}
.filter-select { padding: 8px 12px; border: 1.5px solid var(--gray-400); border-radius: var(--radius); font-size: 14px; background: #fff; }

/* ---- DOWNLOAD STEPS ---- */
.steps-container { max-width: 540px; margin: 0 auto; }
.step-indicator {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 32px;
}
.step-dot {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-600);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    transition: background .3s, color .3s;
}
.step-dot.active   { background: var(--blue);  color: #fff; }
.step-dot.done     { background: var(--green); color: #fff; }
.step-dot-line     { flex: 1; height: 2px; background: var(--gray-200); align-self: center; max-width: 60px; }
.step-dot-line.done { background: var(--green); }

.code-input-group {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 16px 0;
}
.code-digit {
    width: 52px; height: 62px;
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    border: 2px solid var(--gray-400);
    border-radius: var(--radius);
    color: var(--navy);
    background: #fff;
}
.code-digit:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,85,170,.15); outline: none; }

/* ---- DOWNLOAD LIST (post-verify) ---- */
.dl-list       { display: flex; flex-direction: column; gap: 12px; }
.dl-item {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow .15s;
}
.dl-item:hover { box-shadow: var(--shadow); }
.dl-item-icon  { font-size: 32px; flex-shrink: 0; }
.dl-item-info  { flex: 1; }
.dl-item-info h4 { font-size: 15px; font-weight: 600; color: var(--navy); }
.dl-item-info p  { font-size: 13px; color: var(--gray-600); margin-top: 3px; }

/* ---- ADMIN LAYOUT ---- */
.admin-layout { display: flex; gap: 24px; }
.admin-sidebar {
    width: 220px;
    flex-shrink: 0;
}
.admin-sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: var(--radius);
    color: var(--gray-800);
    font-size: 14px;
    font-weight: 500;
    transition: background .15s;
    margin-bottom: 4px;
    text-decoration: none;
}
.admin-sidebar .nav-item:hover  { background: var(--gray-100); text-decoration: none; }
.admin-sidebar .nav-item.active { background: var(--blue-lt); color: var(--blue); font-weight: 700; }
.admin-content { flex: 1; min-width: 0; }

/* ---- TABLE ---- */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { background: var(--navy); color: #fff; padding: 12px 16px; text-align: left; font-weight: 600; white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--gray-200); }
tbody tr:hover { background: var(--gray-50); }
tbody td { padding: 12px 16px; vertical-align: middle; }

/* ---- LOGIN PAGE ---- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    padding: 24px;
}
.login-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}
.login-header {
    background: var(--navy);
    padding: 32px 40px;
    text-align: center;
    color: #fff;
}
.login-header h1 { font-size: 20px; margin-bottom: 4px; }
.login-header p  { font-size: 13px; color: rgba(255,255,255,.65); }
.login-body { padding: 32px 40px; }

/* ---- STATS ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card  { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.stat-card .stat-num   { font-size: 32px; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-card .stat-label { font-size: 13px; color: var(--gray-600); margin-top: 4px; }

/* ---- SPINNER ---- */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
    width: 20px; height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
}
.spinner-dark { border-color: rgba(0,0,0,.15); border-top-color: var(--navy); }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .header-inner  { height: auto; padding: 12px 16px; }
    .header-titles h1 { font-size: 14px; }
    main { padding: 20px 16px; }
    .docs-hero { padding: 28px 20px; }
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; }
    .login-header, .login-body { padding: 24px 20px; }
    .code-digit { width: 42px; height: 52px; font-size: 22px; }
}
