/* ==========================================================================
   MAJOIS - ESTILOS PARA PANELES DE ADMINISTRACIÓN Y SUPERVISIÓN DE PEDIDOS
   ========================================================================== */

.admin-orders-container {
    max-width: 1280px;
    margin: 25px auto 60px;
    padding: 0 20px;
}

/* Encabezado y Métricas */
.admin-orders-header {
    background: linear-gradient(135deg, #004b75 0%, #005b8e 100%);
    color: #ffffff;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: 0 10px 25px rgba(0, 91, 142, 0.15);
    position: relative;
    overflow: hidden;
}

.admin-orders-header::after {
    content: '';
    position: absolute;
    right: -40px;
    bottom: -40px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 213, 0, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.admin-badge-role {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(4px);
    color: #ffd500;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.admin-badge-role svg {
    width: 13px;
    height: 13px;
}

.admin-orders-title {
    font-size: 26px;
    font-weight: 800;
    margin: 0 0 8px 0;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.admin-orders-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    margin: 0 0 24px 0;
    max-width: 750px;
    line-height: 1.5;
}

/* KPI Summary Cards */
.admin-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.admin-kpi-card {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    padding: 16px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.admin-kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.admin-kpi-icon.pending {
    background: rgba(216, 29, 96, 0.25);
    color: #ff80ab;
}

.admin-kpi-icon.money {
    background: rgba(255, 213, 0, 0.25);
    color: #ffd500;
}

.admin-kpi-icon.vendor {
    background: rgba(40, 167, 69, 0.25);
    color: #a3e9b2;
}

.admin-kpi-icon svg {
    width: 22px;
    height: 22px;
}

.admin-kpi-data {
    display: flex;
    flex-direction: column;
}

.admin-kpi-val {
    font-size: 22px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
}

.admin-kpi-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Barra de Filtros y Búsqueda */
.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.admin-search-box {
    position: relative;
    flex: 1;
    min-width: 260px;
    max-width: 450px;
}

.admin-search-box input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border: 1px solid #dcdcdc;
    border-radius: 10px;
    font-size: 14px;
    background: #ffffff;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.admin-search-box input:focus {
    border-color: #005b8e;
    box-shadow: 0 0 0 3px rgba(0, 91, 142, 0.12);
}

.admin-search-box svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #888888;
    pointer-events: none;
}

.admin-toolbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-admin-refresh {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid #d0d7de;
    color: #333333;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-admin-refresh:hover {
    background: #f6f8fa;
    border-color: #005b8e;
    color: #005b8e;
}

.btn-admin-refresh svg {
    width: 15px;
    height: 15px;
}

/* Tabla de Pedidos */
.admin-table-card {
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    border: 1px solid #eef2f5;
    overflow: hidden;
}

.admin-table-wrapper {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.admin-table thead th {
    background-color: #f7f9fa;
    color: #555555;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 16px 18px;
    border-bottom: 2px solid #eef2f5;
    white-space: nowrap;
}

.admin-table tbody tr {
    border-bottom: 1px solid #f0f3f6;
    transition: background-color 0.15s ease;
}

.admin-table tbody tr:hover {
    background-color: #f8fbff;
}

.admin-table td {
    padding: 16px 18px;
    vertical-align: middle;
}

/* Comprobante Badge */
.cpte-badge {
    display: inline-block;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    font-weight: 700;
    background: #eef5fa;
    color: #005b8e;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #d3e5f2;
}

.datetime-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.datetime-date {
    font-weight: 600;
    color: #222222;
}

.datetime-time {
    font-size: 12px;
    color: #777777;
}

/* Cliente & Destinatario */
.client-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 280px;
}

.client-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.client-name {
    font-weight: 700;
    color: #1a1a1a;
    font-size: 14px;
}

.client-tag {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.client-tag.registered {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.client-tag.guest {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffe0b2;
}

.client-address {
    font-size: 12px;
    color: #555555;
    display: flex;
    align-items: flex-start;
    gap: 4px;
    line-height: 1.3;
}

.client-address svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    color: #d81d60;
    margin-top: 1px;
}

.client-note {
    font-size: 11px;
    color: #666666;
    background: #fafafa;
    border-left: 2px solid #ffd500;
    padding: 3px 6px;
    border-radius: 0 4px 4px 0;
    margin-top: 2px;
    font-style: italic;
}

/* Botón WhatsApp */
.btn-wa-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: #25d366;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    padding: 7px 12px;
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(37, 211, 102, 0.25);
    white-space: nowrap;
}

.btn-wa-action:hover {
    background-color: #20ba5a;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.35);
    color: #ffffff;
}

.btn-wa-action svg {
    width: 15px;
    height: 15px;
    fill: currentColor;
}

/* Total del Pedido */
.order-total-amount {
    font-size: 16px;
    font-weight: 800;
    color: #005b8e;
    white-space: nowrap;
}

/* Badge de Estado */
.status-badge-pending {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #fff0f5;
    color: #d81d60;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid #ffd1e1;
    white-space: nowrap;
}

.status-badge-pending::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #d81d60;
    animation: pulseStatus 1.8s infinite;
}

@keyframes pulseStatus {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(216, 29, 96, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(216, 29, 96, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(216, 29, 96, 0); }
}

/* Botón Detalle */
.btn-view-items {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f0f4f8;
    color: #005b8e;
    border: 1px solid #d8e2ec;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-view-items:hover {
    background: #005b8e;
    color: #ffffff;
    border-color: #005b8e;
}

.btn-view-items svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease;
}

.btn-view-items.active svg {
    transform: rotate(180deg);
}

/* Fila de Acordeón con los Items */
.order-items-row {
    display: none;
    background-color: #fafcfe;
    border-bottom: 2px solid #e1e9f0;
}

.order-items-row.show {
    display: table-row;
}

.order-items-content {
    padding: 20px 24px;
}

.items-subtable {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e5edf4;
    overflow: hidden;
    font-size: 13px;
}

.items-subtable th {
    background: #edf3f8;
    color: #334e68;
    font-weight: 700;
    padding: 10px 14px;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.items-subtable td {
    padding: 10px 14px;
    border-bottom: 1px solid #f0f4f8;
}

.items-subtable tr:last-child td {
    border-bottom: none;
}

/* Footer de Totales para Tablas de Pedidos */
.admin-table tfoot td {
    background-color: #f8fafc;
    border-top: 2px solid #005b8e;
    border-bottom: none;
    padding: 14px 18px;
    font-size: 13px;
    vertical-align: middle;
}

.items-subtable tfoot td {
    background-color: #f8fafc;
    border-top: 2px solid #005b8e;
    border-bottom: none;
    padding: 10px 14px;
    font-size: 13px;
    vertical-align: middle;
}

.item-sku {
    font-family: monospace;
    font-weight: 700;
    color: #627d98;
}

.item-desc {
    font-weight: 600;
    color: #102a43;
}

.item-rubro {
    font-size: 11px;
    color: #829ab1;
    display: block;
    margin-top: 2px;
}

.item-qty {
    font-weight: 700;
    color: #005b8e;
    text-align: center;
}

/* Empty State */
.admin-empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: #f0f7fb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #005b8e;
}

.empty-state-icon svg {
    width: 36px;
    height: 36px;
}

.empty-state-title {
    font-size: 20px;
    font-weight: 700;
    color: #333333;
    margin: 0 0 8px 0;
}

.empty-state-desc {
    font-size: 14px;
    color: #777777;
    max-width: 460px;
    margin: 0 auto 20px;
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 900px) {
    .admin-orders-title {
        font-size: 22px;
    }
    .admin-orders-subtitle {
        font-size: 13px;
    }
    .admin-table thead {
        display: none;
    }
    .admin-table, .admin-table tbody, .admin-table tr, .admin-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    .admin-table tbody tr {
        margin-bottom: 16px;
        border: 1px solid #e3e8ee;
        border-radius: 12px;
        padding: 12px;
        background: #ffffff;
    }
    .admin-table td {
        padding: 8px 6px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px dashed #f0f3f6;
    }
    .admin-table td:last-child {
        border-bottom: none;
    }
    .admin-table td::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: 11px;
        text-transform: uppercase;
        color: #777777;
        margin-right: 12px;
    }
    .client-info {
        max-width: 100%;
        text-align: right;
    }
    .client-address {
        justify-content: flex-end;
    }
    .order-items-row {
        display: none !important;
    }
    .order-items-row.show {
        display: block !important;
        padding: 0;
    }
}
