@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* ==========================================================================
   DESIGN SYSTEM & VARIABLES
   ========================================================================== */
:root {
    --bg-main: #06090c;
    --bg-surface: rgba(13, 20, 27, 0.45);
    --bg-surface-hover: rgba(20, 30, 40, 0.6);
    --border-glass: rgba(255, 255, 255, 0.07);
    --border-glass-active: rgba(16, 185, 129, 0.3);
    
    /* Brand Colors - Davinci & Pension Perfecta */
    --color-primary: #10b981; /* Emerald Green */
    --color-primary-glow: rgba(16, 185, 129, 0.3);
    --color-secondary: #06b6d4; /* Vibrant Cyan */
    --color-secondary-glow: rgba(6, 182, 212, 0.3);
    
    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* State Colors */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #3b82f6;

    /* Animations & Shadows */
    --shadow-premium: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --glass-blur: blur(16px) saturate(180%);
}

/* ==========================================================================
   BASE STYLES
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
}

/* Animated Glowing Background Orbs */
.bg-orbs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    animation: floating 25s infinite alternate ease-in-out;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--color-primary) 0%, transparent 70%);
    top: -10%;
    right: -5%;
    animation-delay: 0s;
}

.orb-2 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--color-secondary) 0%, transparent 70%);
    bottom: -15%;
    left: -10%;
    animation-delay: -5s;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #3b82f6 0%, transparent 70%);
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.08;
    animation-duration: 35s;
}

@keyframes floating {
    0% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(50px, 30px) scale(1.1);
    }
    100% {
        transform: translate(-30px, -50px) scale(0.95);
    }
}

/* ==========================================================================
   GLASSMORPHISM COMPONENTS
   ========================================================================== */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    box-shadow: var(--shadow-premium);
    transition: var(--transition-smooth);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.glass-card-interactive:hover {
    transform: translateY(-5px);
    border-color: var(--border-glass-active);
    box-shadow: 0 12px 40px 0 rgba(16, 185, 129, 0.15);
}

/* Inputs and Forms */
.glass-input-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.glass-input-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.glass-input {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 14px 16px;
    color: #ffffff;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition-smooth);
    width: 100%;
    outline: none;
}

.glass-input:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--color-primary);
    box-shadow: 0 0 15px var(--color-primary-glow);
}

/* Buttons */
.btn-premium {
    background: linear-gradient(135deg, var(--color-primary) 0%, #059669 100%);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    padding: 14px 28px;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    box-shadow: 0 4px 20px var(--color-primary-glow);
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5);
    filter: brightness(1.1);
}

.btn-premium:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    padding: 14px 28px;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-secondary);
}

/* ==========================================================================
   AUTHENTICATION VIEW (LOGIN)
   ========================================================================== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    z-index: 10;
}

.login-card {
    width: 100%;
    max-width: 480px;
    padding: 40px;
    position: relative;
    overflow: hidden;
}

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

.logo-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.logo-icon-svg {
    width: 50px;
    height: 50px;
    filter: drop-shadow(0 0 10px var(--color-primary-glow));
}

.logo-text {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #ffffff 30%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ==========================================================================
   LAYOUT: SIDEBAR & MAIN PANEL
   ========================================================================== */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Sidebar Styling */
.app-sidebar {
    width: 280px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    padding: 24px;
    display: flex;
    flex-direction: column;
    border-radius: 0 20px 20px 0;
    border-left: none;
}

.sidebar-header {
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo-text {
    font-size: 1.4rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, #ffffff 40%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.menu-item-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.menu-item-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
}

.menu-item-link.active {
    color: #ffffff;
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.15);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.05);
}

.menu-item-link svg {
    width: 20px;
    height: 20px;
    transition: var(--transition-smooth);
}

.menu-item-link:hover svg,
.menu-item-link.active svg {
    color: var(--color-primary);
    filter: drop-shadow(0 0 5px var(--color-primary-glow));
}

.sidebar-footer {
    border-top: 1px solid var(--border-glass);
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #ffffff;
    border: 2px solid var(--border-glass);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.8rem;
    color: var(--color-primary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 10px;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.btn-logout:hover {
    color: var(--color-danger);
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.15);
}

/* Main Content Panel */
.app-content {
    margin-left: 280px;
    flex-grow: 1;
    min-height: 100vh;
    padding: 40px;
    position: relative;
    z-index: 10;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
}

.header-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-title span {
    color: var(--color-primary);
    text-shadow: 0 0 20px var(--color-primary-glow);
}

.header-date {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 8px 16px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   DASHBOARD CARDS (KPIs)
   ========================================================================== */
.kpis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.kpi-card {
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--color-primary);
}

.kpi-card.cyan::before {
    background: var(--color-secondary);
}

.kpi-card.yellow::before {
    background: var(--color-warning);
}

.kpi-card.blue::before {
    background: var(--color-info);
}

.kpi-data {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kpi-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #ffffff;
}

.kpi-change {
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kpi-change.up {
    color: var(--color-success);
}

.kpi-icon-wrapper {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    transition: var(--transition-smooth);
}

.kpi-card:hover .kpi-icon-wrapper {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    transform: scale(1.05);
}

.kpi-card.cyan:hover .kpi-icon-wrapper {
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.2);
    color: var(--color-secondary);
}

/* ==========================================================================
   CHARTS GRID
   ========================================================================== */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 40px;
}

@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-panel {
    padding: 24px;
    min-height: 380px;
    display: flex;
    flex-direction: column;
}

.chart-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chart-title span {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.chart-container {
    position: relative;
    flex-grow: 1;
    width: 100%;
}

/* ==========================================================================
   DATALAKE RECORDS TABLE
   ========================================================================== */
.table-panel {
    padding: 24px;
    margin-bottom: 20px;
}

.table-header-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.table-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.premium-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.premium-table th {
    padding: 16px;
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.premium-table td {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: var(--transition-smooth);
}

.premium-table tr {
    transition: var(--transition-smooth);
}

.premium-table tr:hover td {
    background: rgba(255, 255, 255, 0.015);
    color: #ffffff;
}

/* Status Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-won {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #a7f3d0;
}

.badge-pipeline {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #fef3c7;
}

.badge-lost {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* Source badge styles */
.source-tag {
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    padding: 4px 10px;
    border-radius: 6px;
}

/* Custom Scrollbar for premium feel */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(16, 185, 129, 0.3);
}

/* ==========================================================================
   RESPONSIVE LAYOUTS
   ========================================================================== */
@media (max-width: 768px) {
    .app-sidebar {
        width: 70px;
        padding: 16px 8px;
    }
    
    .sidebar-logo-text, .user-info, .sidebar-header, .btn-logout span {
        display: none;
    }
    
    .app-content {
        margin-left: 70px;
        padding: 20px;
    }
    
    .menu-item-link span {
        display: none;
    }
    
    .menu-item-link {
        justify-content: center;
        padding: 12px;
    }
    
    .kpis-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   WAVE ANIMATION STYLES (DATALAKE CONCEPT)
   ========================================================================== */
.waves-bg {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 18vh;
    min-height: 120px;
    max-height: 220px;
    z-index: 1;
    overflow: hidden;
    pointer-events: none;
}

.waves-svg {
    position: relative;
    width: 100%;
    height: 100%;
    margin-bottom: -7px;
}

/* Parallax sliding effect */
.wave-parallax > use {
    animation: move-forever 20s cubic-bezier(.55,.5,.45,.5) infinite;
}
.wave-parallax > use:nth-child(1) {
    animation-delay: -2s;
    animation-duration: 7s;
}
.wave-parallax > use:nth-child(2) {
    animation-delay: -3s;
    animation-duration: 10s;
}
.wave-parallax > use:nth-child(3) {
    animation-delay: -4s;
    animation-duration: 13s;
}
.wave-parallax > use:nth-child(4) {
    animation-delay: -5s;
    animation-duration: 18s;
}

@keyframes move-forever {
    0% {
        transform: translate3d(-90px, 0, 0);
    }
    100% {
        transform: translate3d(85px, 0, 0);
    }
}
