/* ==============================================================================
   ST ISAYORD - ESTILOS DEL PANEL DE ADMINISTRACION Y CMS CORPORATIVO
   Archivo: compras/admin/css/admin.css
   ============================================================================== */

:root {
    --primary: #fec118;
    --primary-hover: #e5ab10;
    --dark-bg: #0f172a;
    --dark-surface: #1e293b;
    --light-bg: #f8fafc;
    --border-color: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
}

body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-main);
    background-color: var(--light-bg);
    overflow-x: hidden;
}

/* Pantalla de Login */
body.login-view {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    padding: 15px;
}

.login-card-wrap {
    background: #ffffff;
    width: 100%;
    max-width: 420px;
    padding: 35px 25px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-top: 5px solid var(--primary);
}

.login-header {
    text-align: center;
    margin-bottom: 25px;
}

.login-logo {
    width: 50px;
    height: auto;
    margin-bottom: 12px;
}

.login-header h2 {
    font-family: 'Montserrat', sans-serif;
    font-size: 22px;
    font-weight: 800;
    margin: 0;
    color: var(--dark-bg);
}

.login-header p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 4px 0 0;
}

/* Topbar del Dashboard */
.admin-topbar {
    background: var(--dark-bg);
    color: #ffffff;
    padding: 12px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border-bottom: 3px solid var(--primary);
}

.admin-brand-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 18px;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
}

.admin-brand-title span {
    color: var(--primary);
    font-weight: 600;
    font-size: 13px;
    margin-left: 8px;
    background: rgba(254, 193, 24, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Sub-navegación por Secciones (Pills Tabs) */
.admin-section-nav {
    background: #1e293b;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 0;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.admin-nav-tabs {
    border: none;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding: 2px 0 6px 0;
    margin: 0;
}

.admin-nav-tabs::-webkit-scrollbar {
    height: 4px;
}

.admin-nav-tabs::-webkit-scrollbar-thumb {
    background: rgba(254, 193, 24, 0.4);
    border-radius: 4px;
}

.admin-nav-tabs .nav-link {
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    padding: 8px 14px;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
    background: transparent;
}

.admin-nav-tabs .nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.admin-nav-tabs .nav-link.active {
    background: var(--primary) !important;
    color: #0f172a !important;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(254, 193, 24, 0.35);
}

/* Tarjeta contenedora de Sección */
.section-admin-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    overflow: hidden;
}

.section-admin-header {
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.section-admin-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 17px;
    color: var(--dark-bg);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-admin-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.section-admin-body {
    padding: 24px 20px;
}

/* Tarjetas individuales de elementos dinámicos (Slide, Servicio, Testimonio, Miembro) */
.dynamic-item-card {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    padding: 18px;
    margin-bottom: 18px;
    position: relative;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dynamic-item-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.dynamic-item-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    background: #f1f5f9;
    color: var(--text-muted);
}

/* Previsualizadores de Imagen */
.img-preview-box {
    width: 100%;
    height: 160px;
    background: #0f172a;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.img-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.img-preview-box.square-sm {
    width: 90px;
    height: 90px;
    border-radius: 50%;
}

.img-preview-box.logo-box {
    height: 110px;
    background: #f8fafc;
    padding: 12px;
}

.img-preview-box.logo-box img {
    object-fit: contain;
}

/* Previsualizador de Video en Admin */
.video-preview-box {
    width: 100%;
    height: 180px;
    background: #0f172a;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-preview-box video,
.video-preview-box iframe {
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: cover;
}

.video-preview-placeholder {
    color: #94a3b8;
    text-align: center;
    font-size: 13px;
    padding: 10px;
}

.btn-upload-trigger {
    cursor: pointer;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    width: 100%;
    text-align: center;
}

/* Tarjetas de Métricas */
.metric-card {
    background: #ffffff;
    border-radius: 10px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.metric-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.metric-info {
    flex: 1;
    min-width: 0;
}

.metric-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.metric-value {
    font-family: 'Montserrat', sans-serif;
    font-size: 24px;
    font-weight: 800;
    margin: 0;
    color: var(--dark-bg);
}

/* Tabla de Productos */
.admin-products-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.admin-products-table thead th {
    background: #f1f5f9;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 700;
    border-bottom: 2px solid var(--border-color);
    padding: 14px 16px;
    white-space: nowrap;
}

.admin-products-table tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

.product-thumb-cell img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.table-product-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--dark-bg);
    margin-bottom: 3px;
    line-height: 1.35;
}

.table-product-sku {
    font-size: 12px;
    font-family: monospace;
    color: var(--text-muted);
}

.price-quick-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.price-quick-input {
    width: 120px;
    font-weight: 700;
    font-size: 14px;
    padding: 4px 8px;
    height: 34px;
}

/* Interruptor de Estado */
.custom-switch .custom-control-label::before {
    cursor: pointer;
}

.status-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    display: inline-block;
}

.status-active {
    background: #dcfce7;
    color: #15803d;
}

.status-inactive {
    background: #fee2e2;
    color: #b91c1c;
}

/* Toast flotante de éxito/error */
.admin-toast {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: var(--dark-bg);
    color: #ffffff;
    padding: 14px 22px;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    z-index: 3000;
    font-size: 14px;
    font-weight: 600;
    border-left: 5px solid var(--primary);
    display: none;
    max-width: 440px;
}

/* ==============================================================================
   ADAPTACION RESPONSIVA COMPLETA PARA MOVILES (< 768px)
   ============================================================================== */
@media (max-width: 767.98px) {
    .admin-topbar .container-fluid {
        flex-direction: column;
        align-items: stretch !important;
        gap: 12px;
        padding-left: 5px;
        padding-right: 5px;
    }

    .admin-topbar .brand-wrap {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .admin-top-actions {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        gap: 6px;
        justify-content: space-between;
    }

    .admin-top-actions .btn {
        flex: 1 1 calc(50% - 6px);
        font-size: 12px;
        padding: 6px 8px;
        text-align: center;
        margin: 0 !important;
    }

    .admin-top-actions .btn-logout {
        flex: 1 1 100%;
        margin-top: 4px !important;
    }

    /* Tabs scroll horizontal en móvil */
    .admin-section-nav {
        padding: 4px 8px;
    }

    .admin-nav-tabs .nav-link {
        font-size: 12px;
        padding: 6px 10px;
    }

    /* Métricas en cuadrícula móvil compacta */
    .metric-card {
        padding: 12px 14px;
        gap: 12px;
        margin-bottom: 10px;
    }

    .metric-icon {
        width: 42px;
        height: 42px;
        font-size: 18px;
    }

    .metric-label {
        font-size: 11px;
    }

    .metric-value {
        font-size: 20px;
    }

    /* Barra de búsqueda */
    .admin-filter-bar > div {
        width: 100% !important;
        max-width: 100% !important;
    }

    .admin-filter-bar .input-group,
    .admin-filter-bar select,
    .admin-filter-bar button {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 8px;
    }

    #btn-new-product {
        width: 100% !important;
        padding: 12px !important;
        font-size: 15px;
    }

    /* Transformación de la tabla en Tarjetas Móviles Touch */
    .table-responsive {
        border: none !important;
        overflow: visible !important;
    }

    .admin-products-table {
        border: none;
    }

    .admin-products-table thead {
        display: none !important;
    }

    .admin-products-table,
    .admin-products-table tbody,
    .admin-products-table tr,
    .admin-products-table td {
        display: block;
        width: 100%;
    }

    .admin-products-table tbody tr {
        background: #ffffff;
        border-radius: 10px;
        border: 1px solid var(--border-color);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        margin-bottom: 16px;
        padding: 14px;
        position: relative;
    }

    .admin-products-table td {
        padding: 6px 0 !important;
        border: none !important;
    }

    .admin-products-table td:nth-child(1) {
        float: left;
        width: 64px !important;
        margin-right: 12px;
    }

    .product-thumb-cell img {
        width: 64px;
        height: 64px;
        border-radius: 8px;
    }

    .admin-products-table td:nth-child(2) {
        margin-left: 76px;
        min-height: 64px;
    }

    .table-product-title {
        font-size: 14px;
        margin-bottom: 4px;
    }

    .admin-products-table td:nth-child(3),
    .admin-products-table td:nth-child(4) {
        display: inline-block;
        width: auto;
        margin-right: 6px;
        padding-top: 4px !important;
    }

    .admin-products-table td:nth-child(5) {
        clear: both;
        padding-top: 12px !important;
        margin-top: 8px;
        border-top: 1px dashed var(--border-color) !important;
    }

    .price-quick-wrap {
        width: 100%;
        justify-content: space-between;
    }

    .price-quick-input {
        flex: 1;
        height: 38px;
        font-size: 15px;
    }

    .price-quick-wrap .btn-quick-price {
        height: 38px;
        padding: 0 14px;
    }

    .admin-products-table td:nth-child(6) {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0 !important;
        border-top: 1px solid #f1f5f9 !important;
        border-bottom: 1px solid #f1f5f9 !important;
        margin: 8px 0;
    }

    .admin-products-table td:nth-child(6)::before {
        content: "Estado en Web:";
        font-weight: 600;
        font-size: 13px;
        color: var(--text-muted);
    }

    .admin-products-table td:nth-child(7) {
        display: flex;
        gap: 8px;
        padding-top: 6px !important;
    }

    .admin-products-table td:nth-child(7) .btn {
        flex: 1;
        padding: 9px 12px;
        font-size: 13px;
        font-weight: 600;
    }

    /* Modales en móvil */
    .modal-dialog {
        margin: 8px auto !important;
        max-width: calc(100% - 16px) !important;
    }

    .modal-content {
        border-radius: 12px;
    }

    .modal-body {
        padding: 16px !important;
    }

    .modal-body input,
    .modal-body select,
    .modal-body textarea {
        font-size: 15px !important;
    }

    .modal-footer {
        flex-direction: column-reverse;
        gap: 8px;
        padding: 12px 16px !important;
    }

    .modal-footer .btn {
        width: 100%;
        margin: 0 !important;
        padding: 11px;
    }

    .admin-toast {
        left: 15px;
        right: 15px;
        bottom: 15px;
        text-align: center;
        max-width: none;
    }
}
