
/* =====================================================
   ESTILOS DEL PANEL DE ADMINISTRACIÓN
   Complementa los estilos generales de css/styles.css
   ===================================================== */

/* ---------- ENCABEZADO ---------- */

header {
    background: linear-gradient(135deg, var(--dark-blue) 0%, var(--primary) 100%);
    color: white;
    padding: 15px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

header .logo-mini {
    height: 42px;
    border-radius: 8px;
    background: white;
    padding: 4px;
}

.btn-volver {
    color: white;
    text-decoration: none;
    font-size: 0.95em;
    font-weight: 600;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.btn-volver:hover {
    opacity: 1;
}

.topbar {
    background: linear-gradient(135deg, #1a2b49 0%, #009ee3 100%);
    color: #fff;
    padding: 15px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
}

.topbar .brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar .logo-mini {
    height: 48px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    background: #fff;
    padding: 5px 9px;
    border-radius: 8px;
}

.topbar strong {
    display: block;
    font-size: 20px;
    color: #fff;
}

.topbar span {
    display: block;
    color: #e2edf7;
    font-size: 13px;
    margin-top: 4px;
}

/* ---------- BOTONES DEL ENCABEZADO ---------- */

.topbar-left {
    flex: 1;
    display: flex;
    align-items: center;
}

.topbar-center {
    flex: 1;
    text-align: center;
}

.topbar-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.topbar-right nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.topbar-right nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    transition: all 0.2s ease;
}

/* Botón ABM */
.topbar-right nav .btn-abm {
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.75);
}

.topbar-right nav .btn-abm:hover {
    background: rgba(255, 255, 255, 0.30);
}

/* Botón cerrar sesión */
.topbar-right nav .btn-logout {
    color: var(--dark-blue);
    background: #fff;
    border: 1px solid #fff;
}

.topbar-right nav .btn-logout:hover {
    background: #eaf3f9;
}


/* ---------- CONTENIDO PRINCIPAL ---------- */

main.container {
    width: calc(100% - 36px);
    max-width: 1600px;
    margin: 28px auto;
    padding: 0;
}

.intro {
    margin-bottom: 20px;
}

.intro h1 {
    margin: 0 0 8px;
    color: #1a2b49;
    font-size: 27px;
}

.intro p {
    color: #596579;
    margin: 0;
    line-height: 1.5;
}


/* ---------- FILTROS ---------- */

.filters,
.panel {
    background: #fff;
    border: 1px solid #e0e5ed;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 3px 12px rgba(26, 43, 73, 0.06);
}

.filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 16px;
}

.filters label,
.inline-form label,
.login-card label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-weight: 600;
    color: #344054;
    font-size: 13px;
}

.filters input,
.filters select,
.inline-form input,
.inline-form select,
.login-card input {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid #cbd3df;
    border-radius: 7px;
    background: #fff;
    font: inherit;
    color: #202938;
}

.filters input:focus,
.filters select:focus {
    outline: none;
    border-color: #009ee3;
    box-shadow: 0 0 0 3px rgba(0, 158, 227, 0.12);
}

.search-field {
    grid-column: span 2;
}


/* ---------- BOTONES ---------- */

.filter-actions {
    display: flex;
    align-items: end;
    gap: 9px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 7px;
    background: #009ee3;
    color: #fff;
    text-decoration: none;
    padding: 10px 16px;
    font-weight: 700;
    cursor: pointer;
    min-height: 40px;
    font-size: 13px;
}

.btn:hover {
    background: #007cb3;
}

.btn.secondary {
    background: #edf2f7;
    color: #25364d;
}

.btn.secondary:hover {
    background: #dce5ef;
}


/* ---------- CANTIDAD DE RESULTADOS ---------- */

.result-count {
    margin: 18px 0 12px;
    color: #526074;
    font-size: 14px;
}

.result-count strong {
    color: #1a2b49;
    font-size: 16px;
}


/* ---------- TABLA DE PEDIDOS ---------- */

.table-wrap {
    overflow: auto;
    background: #fff;
    border: 1px solid #dfe5ed;
    border-radius: 10px;
    box-shadow: 0 3px 12px rgba(26, 43, 73, 0.05);
}

.orders {
    border-collapse: collapse;
    width: 100%;
    min-width: 1400px;
    font-size: 12px;
}

.orders th,
.orders td {
    border-bottom: 1px solid #e6eaf0;
    border-right: 1px solid #edf0f4;
    padding: 11px 9px;
    text-align: left;
    vertical-align: middle;
}

.orders th {
    background: #eaf3f9;
    color: #1a2b49;
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 1;
    max-width: 180px;
    white-space: nowrap;
}

.orders td {
    white-space: nowrap;
    color: #344054;
}

.orders tbody tr:nth-child(even) {
    background: #f8fafc;
}

.orders tbody tr:hover {
    background: #eef8fd;
}

.orders td:first-child {
    font-weight: 600;
    color: #1a2b49;
}

.orders td.qty {
    text-align: center;
    font-weight: 700;
    color: #17623b;
}

.status {
    display: inline-block;
    background: #eef2f7;
    color: #344054;
    padding: 5px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.empty {
    text-align: center !important;
    padding: 28px !important;
    color: #697586;
}


/* ---------- PANELES Y MENSAJES ---------- */

.panel h2 {
    font-size: 18px;
    margin: 0 0 12px;
    color: #1a2b49;
}

.panel p {
    color: #596579;
}

.inline-form {
    display: flex;
    align-items: end;
    gap: 12px;
    flex-wrap: wrap;
}

.inline-form label {
    flex: 1;
    min-width: 200px;
}

.alert,
.notice {
    padding: 12px 14px;
    border-radius: 7px;
    margin: 12px 0 16px;
}

.success {
    background: #e8f7ee;
    color: #17623b;
}

.error {
    background: #fdecec;
    color: #9b1c1c;
}

.notice {
    background: #fff8e6;
    color: #72510b;
    border: 1px solid #f2dfaa;
    line-height: 1.5;
}


/* ---------- PANTALLA DE LOGIN ---------- */

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-card {
    width: min(420px, 100%);
    background: #fff;
    border: 1px solid #e0e5ed;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 8px 30px rgba(23, 43, 77, 0.08);
}

.login-card h1 {
    margin: 0 0 8px;
    color: #1a2b49;
}

.login-card p {
    color: #657185;
    margin-bottom: 22px;
}

.login-card form {
    display: grid;
    gap: 14px;
}

.login-card .btn {
    width: 100%;
    margin-top: 6px;
}


/* ---------- ADAPTACIÓN A CELULARES ---------- */

@media (max-width: 850px) {
    .filters {
        grid-template-columns: repeat(2, minmax(130px, 1fr));
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .search-field {
        grid-column: span 2;
    }
    
    .topbar-left,
    .topbar-center,
    .topbar-right {
        width: 100%;
        flex: none;
    }
    
    .topbar-center {
        text-align: left;
    }
    
    .topbar-right {
        justify-content: flex-start;
    }
}

@media (max-width: 520px) {
    .filters {
        grid-template-columns: 1fr;
    }

    .search-field {
        grid-column: span 1;
    }

    main.container {
        width: calc(100% - 20px);
        margin: 18px auto;
    }

    .filters,
    .panel {
        padding: 14px;
    }

    .inline-form {
        display: grid;
    }

    .inline-form label {
        min-width: 0;
    }

    .topbar {
        padding: 14px;
    }

    .topbar .brand {
        align-items: flex-start;
    }

    .topbar .logo-mini {
        height: 40px;
        max-width: 125px;
    }

    .topbar strong {
        font-size: 17px;
    }

    .topbar nav {
        gap: 12px;
    }

    .filter-actions .btn {
        flex: 1;
    }
    
    .topbar-right nav {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .topbar-right nav a {
        padding: 8px 12px;
        font-size: 12px;
    }
}


/* ---------- IMPRESIÓN ---------- */

@media print {
    body {
        background: #fff;
    }

    .topbar nav,
    .filters,
    .intro p {
        display: none !important;
    }

    main.container {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .table-wrap {
        overflow: visible;
        border: 0;
        box-shadow: none;
    }

    .orders {
        font-size: 8px;
        min-width: 0;
    }

    .orders th,
    .orders td {
        padding: 4px;
    }

    .orders th {
        position: static;
    }
}

/* ---------- CAPTCHA DEL LOGIN ---------- */

.captcha-container {
    display: grid;
    gap: 9px;
    margin-top: 4px;
}

.captcha-container > label {
    font-weight: 600;
    color: #344054;
    font-size: 13px;
}

.captcha-image-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.captcha-image-row img {
    display: block;
    width: 170px;
    height: 52px;
    border: 1px solid #cbd3df;
    border-radius: 7px;
    background: #ebeff2;
}

/* Botón refrescar CAPTCHA */
.captcha-refresh {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a2b49, #009ee3);
    color: #ffffff;
    font-family: Arial, sans-serif;
    font-size: 27px;
    font-weight: 600;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 3px 7px rgba(26, 43, 73, 0.20);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.captcha-refresh:hover {
    transform: rotate(45deg);
    box-shadow: 0 4px 10px rgba(26, 43, 73, 0.30);
}

.captcha-container input {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid #cbd3df;
    border-radius: 7px;
    font: inherit;
    box-sizing: border-box;
}

/* Botón actualizar CAPTCHA - Font Awesome */
button.captcha-refresh {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid #cbd3df !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    color: #009ee3 !important;
    font-size: 32px !important;
    cursor: pointer;
    transition: all 0.2s ease;
}

button.captcha-refresh i {
    font-size: 32px !important;
    line-height: 1 !important;
    display: inline-block !important;
    transition: transform 0.3s ease;
}

button.captcha-refresh:hover {
    background: #eaf6fc !important;
    border-color: #009ee3 !important;
    color: #007cb3 !important;
}

button.captcha-refresh:hover i {
    transform: rotate(180deg);
}