:root {
    --bg-main: #0a0a0f;
    --bg-secondary: rgba(20, 20, 25, 0.7);
    --bg-panel: rgba(30, 30, 40, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #ffffff;
    --text-muted: #a0a0b0;
    
    --accent-primary: #fe1b46; /* Coral Red */
    --accent-secondary: #fc8041; /* Orange */
    --accent-gradient: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    
    --success: #00fa9a;
    --danger: #ff4500;
    --warning: #ffd700;
    
    --glass-blur: blur(12px);
    --shadow-soft: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Glassmorphism utility */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    transition: transform 0.3s ease;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 40px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-icon i {
    color: var(--accent-primary);
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

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

.nav-item.active {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 4px 15px rgba(138, 43, 226, 0.4);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
}

.avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.user-info .name {
    font-size: 14px;
    font-weight: 600;
}

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

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.header {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(10px);
    z-index: 10;
}

.header-title {
    font-size: 24px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    cursor: pointer;
    transition: 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
    box-shadow: 0 4px 15px rgba(138, 43, 226, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(138, 43, 226, 0.5);
}

.w-100 {
    width: 100%;
    margin-top: 16px;
    justify-content: center;
}

/* Page Container */
.page-container {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.page {
    display: none;
    animation: fadeIn 0.4s ease;
}

.page.active {
    display: block;
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 4px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: 0.3s;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-title {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.income-icon { background: rgba(0, 250, 154, 0.1); color: var(--success); }
.profit-icon { background: rgba(138, 43, 226, 0.1); color: var(--accent-primary); }
.expense-icon { background: rgba(255, 69, 0, 0.1); color: var(--danger); }

.stat-value {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -1px;
}

.stat-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.trend {
    display: flex;
    align-items: center;
    font-weight: 600;
}
.trend i { width: 14px; height: 14px; }
.trend.positive { color: var(--success); }
.trend.negative { color: var(--danger); }
.trend.neutral { color: var(--text-muted); }

.trend-label {
    color: var(--text-muted);
}

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.chart-container, .top-models-container {
    padding: 24px;
}

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

.chart-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.period-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
}

.period-select option {
    background: var(--bg-main);
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent-secondary);
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-text i { width: 16px; height: 16px; }

.canvas-wrapper {
    height: 300px;
    width: 100%;
}

.models-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.model-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    transition: 0.2s;
}

.model-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.model-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.model-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff00cc, #333399);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.model-details .name { font-weight: 600; font-size: 15px; }
.model-details .platform { font-size: 12px; color: var(--text-muted); }
.model-revenue { font-weight: 700; color: var(--success); }

/* Models Page Grid */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.model-card {
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    min-height: 480px;
}

.model-card-header {
    width: 100%;
    height: 140px;
    position: relative;
    background: rgba(0,0,0,0.3);
}

.model-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.model-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    font-weight: 700;
    color: rgba(255,255,255,0.1);
    background: linear-gradient(135deg, rgba(20,20,30,0.8), rgba(40,40,60,0.8));
}

.model-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.model-card .model-avatar {
    width: 60px; height: 60px;
    font-size: 24px;
    position: absolute;
    bottom: -30px;
    left: 20px;
    border: 3px solid var(--bg-secondary);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.model-card-stats {
    display: flex;
    width: 100%;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-top: 8px;
}

.stat-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.stat-col span { font-size: 12px; color: var(--text-muted); }
.stat-col strong { font-size: 16px; }

/* Finances */
.finances-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.finances-table-container, .finances-salary-calculator {
    padding: 24px;
}

.finances-table-container h3, .finances-salary-calculator h3 { margin-bottom: 20px; }

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

.data-table th, .data-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
}

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

.badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.badge.income { background: rgba(0, 250, 154, 0.1); color: var(--success); }
.badge.expense { background: rgba(255, 69, 0, 0.1); color: var(--danger); }

/* Salary calc box */
.salary-box {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.salary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
}

.salary-row span { color: var(--text-muted); }
.divider { height: 1px; background: var(--border-color); margin: 8px 0; }
.salary-row.total strong { font-size: 24px; color: var(--accent-secondary); }

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: 0.3s;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 100%;
    max-width: 400px;
    padding: 32px;
    transform: translateY(20px);
    transition: 0.3s;
}

.modal.active .modal-content {
    transform: translateY(0);
}

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

.close-modal {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
}
.close-modal:hover { color: white; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 14px; color: var(--text-muted);
}

.form-group input, .form-group select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: 8px;
    color: white;
    font-size: 15px;
    outline: none;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--accent-primary);
}

.checkbox-group {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}
.checkbox-group input { width: 20px; height: 20px; }

/* Accordion */
.months-accordion {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.accordion-item {
    background: rgba(30, 30, 40, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: 0.3s;
}

.accordion-item.open {
    background: var(--bg-panel);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    cursor: pointer;
    transition: 0.2s;
}

.accordion-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.accordion-title {
    font-size: 18px;
    font-weight: 600;
}

.accordion-summary {
    display: flex;
    align-items: center;
    gap: 16px;
}

.accordion-summary strong {
    font-size: 18px;
}

.accordion-icon {
    width: 24px; height: 24px;
    transition: transform 0.3s;
    color: var(--text-muted);
}
.accordion-item.open .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    display: none;
    padding: 24px;
    border-top: 1px solid var(--border-color);
}
.accordion-item.open .accordion-content {
    display: block;
    animation: fadeIn 0.3s ease;
}

.models-month-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
}
.models-month-table th {
    text-align: left;
    padding: 12px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
}

.models-month-table td {
    padding: 16px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    vertical-align: middle;
}

.models-month-table input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: white;
    padding: 10px 12px;
    border-radius: 8px;
    width: 140px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.models-month-table input:focus {
    border-color: var(--accent-secondary);
    outline: none;
}

.month-salary-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    background: rgba(0,0,0,0.2);
    padding: 20px;
    border-radius: 12px;
}

.ms-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ms-item span { font-size: 12px; color: var(--text-muted); }
.ms-item strong { font-size: 18px; color: var(--success); }

/* Placeholder */
.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    text-align: center;
    color: var(--text-muted);
    gap: 16px;
}
.placeholder i { width: 64px; height: 64px; color: var(--border-color); }
.placeholder h3 { color: white; font-size: 24px; }

/* Responsive adjustments */
@media (max-width: 1024px) {
    .charts-section { grid-template-columns: 1fr; }
    .finances-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        height: 100%;
        z-index: 50;
    }
    .sidebar.open {
        left: 0;
    }
    .menu-toggle { display: block; }
    .page-container { padding: 16px; }
    .header { padding: 0 16px; }
}

/* Custom Select Styling */
select {
    appearance: none;
    -webkit-appearance: none;
    background-color: rgba(255, 255, 255, 0.05); /* Very light glass */
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    width: 100%;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    /* Custom chevron arrow for select */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 255, 204, 0.2);
    background-color: rgba(255, 255, 255, 0.08);
}

select option {
    background-color: #12121a; /* deep dark background matching app */
    color: var(--text-main);
    padding: 12px;
}
/* Analytics Dual Progress Bar */
.progress-dual-container {
    margin: 16px 0;
}

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

.progress-dual-bar {
    position: relative;
    height: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

.progress-layer-forecast {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 215, 0, 0.25);
    border-radius: 10px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-layer-fact {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #00fa9a, #00c9ff);
    border-radius: 10px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(0, 250, 154, 0.3);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

input[type="range"]#modelEditorPhotoZoom {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    outline: none;
    border: 1px solid rgba(255,255,255,0.08);
}
input[type="range"]#modelEditorPhotoZoom::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: 1px solid rgba(255,255,255,0.18);
    box-shadow: 0 6px 14px rgba(0,0,0,0.35);
    cursor: pointer;
}
/* --- ФИКС ДЛЯ ТЕЛЕФОНОВ --- */
@media (max-width: 768px) {
    .sidebar {
        position: fixed !important;
        left: -100%; /* Полностью прячем панель за левый край */
        top: 0;
        width: 280px;
        height: 100vh;
        z-index: 9999 !important; /* Выносим на самый верхний слой */
        background: #121212;
        transition: transform 0.3s ease, left 0.3s ease;
    }
    
    /* Класс для открытия меню (добавляется через JS) */
    .sidebar.active {
        left: 0 !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding-top: 60px; /* Отступ под шапку */
    }

    /* Делаем кнопку меню видимой и кликабельной */
    .menu-toggle {
        display: flex !important;
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 10000;
    }
}