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

:root {
    /* Design Tokens (Identity Variables) */
    --primary-color: #6366f1; /* Indigo modern accent */
    --primary-hover: #4f46e5;
    --bg-dark: #090d16;       /* Clean deep dark background */
    --bg-card: rgba(30, 41, 59, 0.7); /* Translucent Slate card for glassmorphism */
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --error-color: #f43f5e;
    --success-color: #10b981;
    --font-family: 'Inter', -apple-system, sans-serif;
    
    /* Layout Variables */
    --radius-lg: 16px;
    --radius-md: 10px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(99, 102, 241, 0.06) 0%, transparent 45%);
}

.container {
    width: 100%;
    max-width: 440px;
    padding: 20px;
}

/* Glassmorphism Auth Card */
.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    transition: var(--transition-smooth);
}

.auth-card:hover {
    box-shadow: 0 25px 50px rgba(99, 102, 241, 0.15);
}

.card-header {
    margin-bottom: 30px;
    text-align: center;
}

.card-header h2 {
    font-size: 26px;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.card-header p {
    font-size: 14px;
    color: var(--text-muted);
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

input, select {
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text-main);
    width: 100%;
    outline: none;
    transition: var(--transition-smooth);
}

input:focus, select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    background-color: rgba(15, 23, 42, 0.8);
}

/* Custom Select styling */
select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Button & Actions */
.btn {
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.card-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

.card-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-smooth);
}

.card-footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Notification Toast */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    background: rgba(30, 41, 59, 0.95);
    border-left: 4px solid var(--primary-color);
    border-radius: 8px;
    padding: 16px 20px;
    color: var(--text-main);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    min-width: 280px;
    max-width: 380px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease-out forwards;
    backdrop-filter: blur(10px);
}

.toast.error {
    border-left-color: var(--error-color);
}

.toast.success {
    border-left-color: var(--success-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* SPA View State Handling */
.view {
    display: none;
}

.view.active {
    display: block;
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dashboard Specifc Styles */
.profile-card {
    text-align: center;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #a5b4fc 100%);
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #fff;
    font-weight: 700;
}

.profile-detail {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
    text-align: left;
}

.profile-detail-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.profile-detail-value {
    font-size: 15px;
    font-weight: 500;
}

.badge {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    margin-top: 15px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: none;
}

/* Language Selector Styles */
.lang-selector {
    position: fixed;
    top: 25px;
    right: 35px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    user-select: none;
    z-index: 1000;
}

.lang-link {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition-smooth);
    cursor: pointer;
    margin: 0 4px;
}

.lang-link.active, .lang-link:hover {
    color: var(--primary-color);
}

/* --- App Shell & Sidebar Layout --- */
body.app-shell-active {
    display: flex;
    justify-content: flex-start;
    align-items: stretch;
    padding: 0;
    overflow: hidden;
}

body.app-shell-active .container {
    display: none;
}

.app-shell {
    display: none;
    width: 100vw;
    height: 100vh;
}

.app-shell.active {
    display: flex;
    flex-direction: row;
    animation: fadeIn 0.4s ease-out forwards;
}

/* Glassmorphism Sidebar */
.sidebar {
    width: 260px;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    flex-shrink: 0;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed {
    width: 72px;
    padding: 24px 8px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 32px;
    padding: 0 8px;
    transition: var(--transition-smooth);
}

.sidebar.collapsed .sidebar-header {
    flex-direction: column;
    gap: 16px;
    padding: 0;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.app-logo {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-brand-text h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.tenant-badge {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
}

.sidebar.collapsed .brand-wrapper .sidebar-brand-text {
    display: none;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.sidebar-toggle:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
}

.sidebar-toggle svg {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

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

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

.menu-item svg.menu-icon {
    margin-right: 12px;
    flex-shrink: 0;
    transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed .menu-item {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .menu-item svg.menu-icon {
    margin-right: 0;
}

.sidebar.collapsed .menu-item .menu-text {
    display: none;
}

/* Premium Custom CSS Tooltips for Collapsed State */
.sidebar.collapsed .menu-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 64px;
    top: 50%;
    transform: translateY(-50%) scale(0.9);
    background: #0f172a;
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s cubic-bezier(0.4, 0, 0.2, 1), transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    z-index: 9999;
}

.sidebar.collapsed .menu-item:hover::after {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

.menu-item:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.menu-item.active {
    color: #fff;
    background: var(--primary-color);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.logout-link {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    color: var(--error-color);
    transition: var(--transition-smooth);
}

.sidebar.collapsed .logout-link {
    border-top-color: transparent;
}

.logout-link:hover {
    background: rgba(244, 63, 94, 0.1);
    color: var(--error-color);
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    padding: 40px;
    overflow-y: auto;
    background: radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.3) 0%, var(--bg-dark) 100%);
}

.content-header {
    margin-bottom: 30px;
}

.content-header h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 6px;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.content-header p {
    font-size: 14px;
    color: var(--text-muted);
}

/* Tab contents */
.tab-content {
    display: none;
    max-width: 800px;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-out forwards;
}

/* Profile Card specific details */
.profile-card-details {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 30px;
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.profile-avatar.mini {
    width: 40px;
    height: 40px;
    font-size: 16px;
    margin: 0;
}

/* Settings and color pickers */
.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 30px;
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.flex-1 {
    flex: 1;
}

.color-picker-wrapper {
    display: flex;
    gap: 10px;
}

input[type="color"] {
    width: 50px;
    height: 46px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    background: transparent;
}

/* Responsive adjustment */
@media (max-width: 768px) {
    body.app-shell-active {
        flex-direction: column;
    }
    .app-shell.active {
        flex-direction: column;
    }
    .sidebar {
        width: 100% !important;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 12px 20px !important;
    }
    .sidebar-toggle {
        display: none !important;
    }
    .sidebar-header {
        margin-bottom: 0;
        flex-direction: row !important;
        gap: 12px !important;
        padding: 0 !important;
    }
    .brand-wrapper .sidebar-brand-text {
        display: flex !important;
    }
    .sidebar-menu {
        flex-direction: row;
        gap: 10px;
        align-items: center;
    }
    .menu-item {
        padding: 8px 12px !important;
        font-size: 13px;
        justify-content: flex-start !important;
    }
    .menu-item svg.menu-icon {
        margin-right: 6px !important;
    }
    .menu-item .menu-text {
        display: block !important;
    }
    .menu-item::after {
        display: none !important;
    }
    .logout-link {
        margin-top: 0 !important;
        border-top: none !important;
        padding-top: 8px !important;
    }
}
    .main-content {
        padding: 20px;
    }
    .form-row {
        flex-direction: column;
        gap: 10px;
    }
}
/* Logo upload styles */
.logo-upload-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
}

.logo-preview-box {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.6);
    flex-shrink: 0;
}

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

.logo-upload-btn-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-upload-btn-container .btn {
    margin-top: 0;
    width: auto;
    padding: 10px 16px;
}

.file-info-text {
    font-size: 12px;
    color: var(--text-muted);
}

/* --- Sales Forecast Styles --- */
.upload-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    background: rgba(15, 23, 42, 0.2);
}

.upload-dropzone:hover, .upload-dropzone.dragover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.04);
}

.upload-icon {
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.upload-dropzone:hover .upload-icon {
    color: var(--primary-color);
    transform: translateY(-6px);
}

.dashboard-grid {
    animation: fadeIn 0.4s ease-out forwards;
}

.stats-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    width: 100%;
}

.stat-card {
    flex: 1;
    min-width: 180px;
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: var(--transition-smooth);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.2);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 19px;
    font-weight: 700;
    color: var(--text-main);
}

.year-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition-smooth);
    margin-right: 8px;
}

.year-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.year-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

/* Modal overlay & content */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(9, 13, 22, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out forwards;
}

.modal-content {
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 90%;
    max-width: 440px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.5);
    animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes scaleUp {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* --- Forecast Results & Toggle Group Styles --- */
.toggle-group {
    display: flex;
    gap: 4px;
    border: 1px solid var(--border-color);
    background: rgba(30, 41, 59, 0.4);
    border-radius: var(--radius-md);
    padding: 2px;
}

.toggle-btn {
    background: transparent;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.toggle-btn:hover {
    color: var(--text-main);
}

.toggle-btn.active {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.2);
}

/* Premium Table for results (FS-PV-05) */
.premium-table {
    width: 100%;
    border-collapse: collapse;
}

.premium-table th {
    padding: 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    background: rgba(15, 23, 42, 0.6);
    border-bottom: 1px solid var(--border-color);
}

.premium-table td {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-smooth);
}

.premium-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.premium-table tr:last-child td {
    border-bottom: none;
}

/* Inner Tabbed Interface (FS-PV-08) */
.inner-tabs-container {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
    padding-bottom: 1px;
}

.inner-tab-btn {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
    outline: none;
}

.inner-tab-btn:hover:not(:disabled) {
    color: var(--text-main);
    border-bottom-color: rgba(99, 102, 241, 0.4);
}

.inner-tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.inner-tab-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.inner-tab-wrapper {
    background: rgba(30, 41, 59, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.inner-tab-content {
    display: none;
}

.inner-tab-content.active {
    display: block;
}

/* --- FS-PV-08 Multi-select Year Checks and Chart styles --- */
.year-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    transition: var(--transition-smooth);
    user-select: none;
}

.year-checkbox-label:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.15);
}

.year-checkbox-label.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.year-checkbox-label input[type="checkbox"] {
    display: none;
}

