/* 
   SAP Analytics Cloud (SAC) Inspired Design System
   Professional, Clean, and Premium Aesthetic
*/

:root {
    /* SAC Theme Colors */
    --sac-bg-main: linear-gradient(180deg, #354A5F 0%, #6688A6 40%, #95B1CA 100%);
    --sac-bg-card: #ffffff;
    --sac-sidebar-bg: #2d3e50;
    --sac-sidebar-text: #ffffff;
    --sac-sidebar-hover: #3d4e60;
    --sac-sidebar-active: #0a6ed1;
    
    --sac-primary: #0a6ed1; /* SAP Blue */
    --sac-secondary: #58666e;
    --sac-accent: #008fd3;
    
    --sac-text-primary: #32363a;
    --sac-text-secondary: #6a6d70;
    --sac-text-light: #919496;
    
    --sac-border: #d9d9d9;
    --sac-status-success: #2b7d2b;
    --sac-status-warning: #e9730c;
    --sac-status-danger: #bb0000;
    --sac-status-info: #0a6ed1;

    /* Spacing & Shadows */
    --sac-spacing-xs: 4px;
    --sac-spacing-sm: 8px;
    --sac-spacing-md: 16px;
    --sac-spacing-lg: 24px;
    --sac-spacing-xl: 32px;
    
    --sac-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --sac-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --sac-radius: 8px;
    --sac-radius-lg: 12px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--sac-bg-main) !important;
    background-attachment: fixed;
    color: var(--sac-text-primary);
    line-height: 1.5;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* Sidebar Styling */
.sac-sidebar {
    width: 260px;
    background-color: var(--sac-sidebar-bg);
    color: var(--sac-sidebar-text);
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow-x: hidden;
    white-space: nowrap;
    border-right: 1px solid rgba(0,0,0,0.1);
}

.sac-sidebar.collapsed {
    width: 0;
    border-right: none;
}

.sac-sidebar-header {
    padding: var(--sac-spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--sac-spacing-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sac-logo {
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: 1px;
    transition: opacity 0.3s;
}

.sac-sidebar.collapsed .sac-logo {
    opacity: 0;
    pointer-events: none;
}

.sac-sidebar.collapsed .sac-nav-item span,
.sac-sidebar.collapsed .sac-sidebar-info {
    display: none;
}

.sac-nav {
    flex: 1;
    padding: var(--sac-spacing-md) 0;
    overflow-y: auto;
}

.sac-nav-item {
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 4px solid transparent;
}

.sac-nav-item:hover {
    background-color: var(--sac-sidebar-hover);
    color: #fff;
}

.sac-nav-item.active {
    background-color: rgba(10, 110, 209, 0.2);
    color: #fff;
    border-left-color: var(--sac-sidebar-active);
}

.sac-nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    min-width: 20px;
}

.sac-nav-divider {
    margin: 15px 20px;
    height: 1px;
    background: rgba(255,255,255,0.1);
}

.sac-sidebar.collapsed .sac-nav-divider {
    margin: 15px 10px;
}

/* 3-Level Hierarchy & Interactive Nav */
.sac-nav-group {
    margin-bottom: 2px;
}

.sac-nav-group-header {
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s;
    font-size: 0.9rem;
}

.sac-nav-group-header:hover {
    background-color: var(--sac-sidebar-hover);
    color: #fff;
}

.sac-nav-item i, .sac-nav-group-header i:first-child {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    min-width: 20px;
    margin-right: 12px;
}

.sac-group-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0, 1, 0.5, 1);
    background-color: rgba(0,0,0,0.1);
}

.sac-nav-group.expanded > .sac-group-body {
    max-height: 1000px;
}

.sac-chevron {
    font-size: 0.7rem;
    transition: transform 0.3s;
    opacity: 0.5;
}

.sac-nav-group.expanded > .sac-nav-group-header .sac-chevron {
    transform: rotate(180deg);
}

/* Indentation per level */
.level-2 { padding-left: 44px; }
.level-3 { padding-left: 64px; }

.sac-nav-item {
    padding: 10px 24px;
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
    position: relative;
}

.sac-nav-item:hover {
    background-color: var(--sac-sidebar-hover);
    color: #fff;
}

.sac-nav-item.active {
    background-color: rgba(10, 110, 209, 0.15);
    color: #fff;
    border-left: 3px solid var(--sac-sidebar-active);
}

/* Favorites Star */
.star-icon {
    margin-left: auto;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
    cursor: pointer;
}

.sac-nav-item:hover .star-icon {
    opacity: 0.5;
}

.star-icon.active {
    opacity: 1 !important;
    color: #ffd700;
}

.star-icon:hover {
    transform: scale(1.2);
    opacity: 1 !important;
}

.sac-sidebar.collapsed .sac-nav-group-header span,
.sac-sidebar.collapsed .sac-nav-item span,
.sac-sidebar.collapsed .sac-chevron,
.sac-sidebar.collapsed .star-icon {
    display: none;
}

/* Main Content Area */
.sac-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: transparent; /* Permite ver el fondo del body */
}

.sac-header {
    background-color: #354a5f; /* Color de la imagen: Azul/Gris oscuro */
    color: white;
    height: 52px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.sac-header-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff !important;
}

.sac-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sac-toggle-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.sac-toggle-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.sac-header i {
    color: white !important;
}

.sac-header-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--sac-text-primary);
}

.sac-content {
    flex: 1;
    padding: var(--sac-spacing-lg);
    overflow-y: auto;
    background: transparent !important; /* Para que luzca el degradado del body */
}

/* SAC Style Dashboard Cards */
.sac-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--sac-spacing-lg);
    margin-bottom: var(--sac-spacing-xl);
}

/* New White Card Design (Image 1) */
.sac-tile {
    background: #ffffff;
    border-radius: var(--sac-radius);
    padding: var(--sac-spacing-lg);
    box-shadow: var(--sac-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 180px;
    position: relative;
    overflow: hidden;
}

.sac-tile:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: var(--sac-primary);
}

.sac-tile-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sac-tile-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--sac-text-primary);
    text-transform: none;
}

.sac-tile-subtitle {
    font-size: 0.85rem;
    color: var(--sac-text-secondary);
    opacity: 0.8;
}

.sac-tile-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.sac-tile-icon {
    font-size: 2rem;
    color: var(--sac-primary);
    opacity: 0.9;
    background: rgba(10, 110, 209, 0.05);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.sac-tile-status {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--sac-text-light);
    display: flex;
    align-items: center;
    gap: 6px;
}

.sac-tile-status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #2b7d2b;
    border-radius: 50%;
}

/* Assistant FAB */
.assistant-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: var(--sac-sidebar-bg);
    color: #ffd700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--sac-shadow-lg);
    z-index: 2000;
    transition: all 0.3s;
}

.assistant-fab:hover {
    transform: scale(1.1) rotate(15deg);
    background-color: var(--sac-sidebar-hover);
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(45, 62, 80, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(45, 62, 80, 0); }
    100% { box-shadow: 0 0 0 0 rgba(45, 62, 80, 0); }
}

.assistant-fab {
    animation: pulse 2s infinite;
}

.sac-status-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
}

.status-positive { background: #e8f5e9; color: var(--sac-status-success); }
.status-negative { background: #ffebee; color: var(--sac-status-danger); }

/* Table Styles */
.sac-table-card {
    background: #fff;
    border-radius: var(--sac-radius);
    box-shadow: var(--sac-shadow);
    overflow: hidden;
}

.sac-table-header {
    padding: var(--sac-spacing-md) var(--sac-spacing-lg);
    border-bottom: 1px solid var(--sac-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sac-table {
    width: 100%;
    border-collapse: collapse;
}

.sac-table th {
    text-align: left;
    padding: 12px 24px;
    background-color: #f8f9fa;
    color: var(--sac-text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    border-bottom: 2px solid var(--sac-border);
}

.sac-table td {
    padding: 14px 24px;
    border-bottom: 1px solid var(--sac-border);
    font-size: 0.875rem;
}

.sac-table tr:hover {
    background-color: #f1f7fd;
}

/* Buttons */
.sac-btn {
    padding: 8px 16px;
    border-radius: var(--sac-radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--sac-border);
    background: #fff;
    transition: all 0.2s;
}

.sac-btn-primary {
    background-color: var(--sac-primary);
    color: #fff;
    border-color: var(--sac-primary);
}

.sac-btn-primary:hover {
    background-color: #0854a0;
}

/* Animations */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: slideIn 0.4s ease forwards;
}

/* Sidebar Footer & Logout */
.sac-sidebar-footer {
    padding: var(--sac-spacing-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
    transition: all 0.3s;
    background: rgba(0,0,0,0.05);
}

.sac-sidebar.collapsed .sac-sidebar-footer {
    opacity: 0;
    pointer-events: none;
}

.sac-btn-logout {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sac-btn-logout:hover {
    background: rgba(214, 69, 69, 0.2);
    color: #ff6b6b;
}

/* SAP Fiori 3.0 / Horizon Standard Components */

.sac-btn-logout-header {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    padding: 6px 18px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 15px;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

.sac-btn-logout-header:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.9);
}

/* Buttons */
.btn-sap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: var(--sac-radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    height: 36px;
    font-family: 'Inter', sans-serif;
    text-decoration: none;
}

.btn-sap-primary {
    background-color: var(--sac-primary);
    color: white;
}
.btn-sap-primary:hover {
    background-color: #0854a0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(10, 110, 209, 0.2);
}

.btn-sap-secondary {
    background-color: white;
    color: var(--sac-primary);
    border-color: var(--sac-primary);
}
.btn-sap-secondary:hover {
    background-color: #f0f7ff;
    border-color: #0854a0;
}

.btn-sap-ghost {
    background-color: transparent;
    color: var(--sac-text-secondary);
    border-color: transparent;
}
.btn-sap-ghost:hover {
    background-color: rgba(0,0,0,0.04);
    color: var(--sac-text-primary);
}

.btn-sap-negative {
    background-color: white;
    color: var(--sac-status-danger);
    border-color: var(--sac-status-danger);
}
.btn-sap-negative:hover {
    background-color: #fff1f0;
    border-color: #991b1b;
}

/* Cards & Sections */
.sac-card {
    background: #ffffff;
    border-radius: var(--sac-radius);
    border: 1px solid var(--sac-border);
    box-shadow: var(--sac-shadow);
    overflow: hidden;
}

.sac-section-header {
    padding: 15px 20px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sac-section-title {
    font-weight: 800;
    font-size: 0.9rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Outfit', sans-serif;
}

/* Filtering & Tabs (SAC Catalog Style) */
.sac-filter-bar {
    background: white;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 25px;
    border-bottom: 1px solid var(--sac-border);
    height: 48px;
    margin-bottom: 20px;
}

.sac-filter-item {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--sac-text-secondary);
    cursor: pointer;
    padding: 12px 0;
    position: relative;
    transition: color 0.2s;
}

.sac-filter-item:hover { color: var(--sac-primary); }
.sac-filter-item.active {
    color: var(--sac-primary);
    font-weight: 700;
}
.sac-filter-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--sac-primary);
}

/* Assistant Refinement */
.assistant-fab {
    background-color: #354a5f !important;
    color: #ffd700 !important;
    border: 2px solid rgba(255,255,255,0.1);
}

/* --- MOBILE RESPONSIVENESS & REFINEMENTS --- */

/* Desktop behavior refinements */
.sac-sidebar {
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), left 0.3s ease !important;
}

@media (max-width: 768px) {
    body, html {
        overflow-x: hidden;
        overflow-y: auto !important;
        height: auto !important;
        min-height: 100%;
    }

    .sac-main {
        margin-left: 0 !important;
        width: 100% !important;
        overflow-y: visible !important;
        height: auto !important;
    }

    .sac-sidebar {
        position: fixed !important;
        left: -260px !important;
        top: 0; bottom: 0;
        width: 260px !important;
        z-index: 2100 !important;
        box-shadow: 10px 0 30px rgba(0,0,0,0.3);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    .sac-sidebar.mobile-active {
        left: 0 !important;
    }

    /* Backdrop for mobile sidebar */
    .sac-sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        backdrop-filter: blur(4px);
        z-index: 2050;
    }

    .sac-sidebar-overlay.active {
        display: block;
    }

    .sac-main {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .sac-header {
        padding: 0 10px;
    }

    /* Grid adjustments */
    .sac-grid, .catalog-grid {
        grid-template-columns: 1fr !important; 
        gap: 15px !important;
        padding: 10px !important;
    }

    .sac-tile, .card-modern {
        height: auto !important;
        min-height: 140px;
    }

    /* Filter bars adjustments */
    .sac-filter-bar, .catalog-filter-bar {
        overflow-x: auto;
        white-space: nowrap;
        gap: 15px;
        padding-bottom: 5px;
        height: auto;
        min-height: 48px;
        display: flex !important;
    }

    .sac-filter-item, .filter-item {
        padding: 10px 5px;
        flex-shrink: 0;
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .sac-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Scrollbar customization for SAP look */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}
