/* ==========================================================================
   ЭКСВИЛ.РУ - B2B РЕКЛАМНАЯ ПЛАТФОРМА (ЕДИНЫЙ CSS)
   Файлы: auth.php, dashboard.php, profile_settings.php, campaign_create.php
   ========================================================================== */

/* --- 1. ЦВЕТОВАЯ ПАЛИТРА И БАЗА --- */
:root {
    --orange-primary: #FF5A00;
    --orange-hover: #E04E00;
    --orange-light: #FFF0E6;
    
    --bg-app: #F3F4F6;
    --bg-card: #FFFFFF;
    --sidebar-dark: #111827;
    
    --text-main: #1F2937;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    
    --color-green: #10B981;
    --color-gray: #9CA3AF;
    
    --radius-card: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background-color: var(--bg-app); color: var(--text-main); font-size: 14px; }
a { text-decoration: none; color: inherit; transition: color 0.2s; }

/* --- 2. ЛЕЙАУТ ПРИЛОЖЕНИЯ (ДАШБОРД) --- */
.app-container { display: flex; min-height: 100vh; }
.sidebar-dark { width: 60px; background-color: var(--sidebar-dark); flex-shrink: 0; min-height: 100vh; }
.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }

/* Шапка (Header) */
.dash-header { background-color: var(--bg-card); height: 64px; display: flex; justify-content: space-between; align-items: center; padding: 0 32px; border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 50; }
.dash-header-left, .dash-header-right { display: flex; align-items: center; gap: 32px; }
.dash-logo { font-size: 1.25rem; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.logo-text { color: var(--text-main); }
.logo-badge { background-color: var(--orange-primary); color: white; font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; line-height: 1; font-weight: 700; }
.logo-desc { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); }

.dash-nav { display: flex; gap: 24px; height: 64px; }
.dash-nav a { display: flex; align-items: center; color: var(--text-muted); font-weight: 500; border-bottom: 2px solid transparent; }
.dash-nav a:hover { color: var(--text-main); }
.dash-nav a.active { color: var(--text-main); border-bottom-color: var(--orange-primary); }

/* Выпадающее меню профиля */
.profile-dropdown { position: relative; display: inline-block; }
.dropdown-trigger { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 6px 12px; border-radius: 8px; border: 1px solid transparent; user-select: none; }
.dropdown-trigger:hover { background: var(--bg-app); border-color: var(--border-color); }
.company-info { display: flex; flex-direction: column; text-align: right; }
.company-info strong { font-size: 0.95rem; font-weight: 600; }
.company-info span { font-size: 0.75rem; color: var(--text-muted); }
.dropdown-trigger > svg { color: var(--text-muted); transition: transform 0.2s; }
.dropdown-trigger.active > svg { transform: rotate(180deg); }

.avatar-circle { width: 36px; height: 36px; background: var(--border-color); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-muted); overflow: hidden; flex-shrink: 0; transition: 0.2s; }
.dropdown-trigger:hover .avatar-circle { background: var(--orange-primary); color: #FFF; }
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; }

.dropdown-menu { position: absolute; top: calc(100% + 8px); right: 0; width: 220px; background: #FFF; border: 1px solid var(--border-color); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); border-radius: 8px; padding: 8px 0; z-index: 100; opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all 0.2s ease; }
.dropdown-menu.show { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-menu a { display: block; padding: 10px 16px; font-size: 0.9rem; }
.dropdown-menu a:hover { background: var(--bg-app); color: var(--orange-primary); }

/* --- 3. СТРАНИЦА АВТОРИЗАЦИИ (AUTH.PHP) --- */
.auth-container { background: #fff; width: 100%; max-width: 480px; border-radius: 16px; box-shadow: 0 10px 25px rgba(0,0,0,0.05); padding: 40px; margin: 10vh auto; border: 1px solid var(--border-color); }
.auth-logo { text-align: center; font-size: 1.5rem; font-weight: 800; margin-bottom: 30px; letter-spacing: -0.5px; }
.auth-logo span { color: var(--orange-primary); }
.auth-tabs { display: flex; border-bottom: 2px solid var(--border-color); margin-bottom: 30px; }
.tab { flex: 1; text-align: center; padding: 12px 0; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer; transition: 0.2s; }
.tab.active { color: var(--orange-primary); border-bottom-color: var(--orange-primary); }
.hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 5px; display: block; }
.auth-container a { color: var(--orange-primary); font-weight: 500; }
.auth-container a:hover { color: var(--orange-hover); }

/* --- 4. ДАШБОРД (DASHBOARD.PHP) --- */
.dash-body { padding: 24px 32px; display: flex; flex-direction: column; gap: 24px; }
.dash-card { background: var(--bg-card); border-radius: var(--radius-card); padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); border: 1px solid var(--border-color); }
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: 20px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.stat-card { display: flex; flex-direction: column; justify-content: space-between; }
.stat-title { color: var(--text-muted); font-weight: 500; margin-bottom: 12px; }
.stat-value-row { display: flex; align-items: baseline; gap: 12px; }
.stat-number { font-size: 2rem; font-weight: 700; letter-spacing: -0.5px; }
.stat-status { font-size: 0.85rem; color: var(--text-muted); margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.balance-card { display: flex; flex-direction: row; align-items: center; justify-content: space-between; }
.balance-val { font-size: 1.8rem; }

.middle-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.chart-card { display: flex; flex-direction: column; }
.chart-header { display: flex; justify-content: space-between; align-items: center; }
.chart-legend { display: flex; gap: 16px; font-size: 0.85rem; color: var(--text-muted); }
.legend-item { display: flex; align-items: center; gap: 6px; }
.line-orange { width: 12px; height: 3px; background: var(--orange-primary); border-radius: 2px; }
.line-dark { width: 12px; height: 3px; background: var(--text-main); border-radius: 2px; }
.chart-area { flex: 1; min-height: 250px; position: relative; margin-top: 16px; }
.chart-x-axis { display: flex; justify-content: space-between; margin-top: 10px; color: var(--text-muted); font-size: 0.75rem; }

.step-list { display: flex; flex-direction: column; gap: 12px; }
.step-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--bg-app); border-radius: 8px; font-weight: 500; }
.step-done { background: #EFF6FF; }
.step-check { color: #3B82F6; font-weight: bold; }
.step-badge { background: var(--border-color); color: var(--text-muted); font-size: 0.7rem; padding: 4px 8px; border-radius: 4px; }

.bottom-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.dash-table { width: 100%; border-collapse: collapse; }
.dash-table th, .dash-table td { padding: 14px 0; text-align: left; border-bottom: 1px solid var(--border-color); }
.dash-table th { color: var(--text-muted); font-weight: 500; font-size: 0.85rem; }
.dash-table tbody tr:last-child td { border-bottom: none; }
.text-right { text-align: right !important; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot-green { background: var(--color-green); }
.dot-orange { background: #F59E0B; }
.dot-gray { background: var(--color-gray); }

.places-list { list-style: none; display: flex; flex-direction: column; gap: 16px; }
.places-list li { font-weight: 500; padding-bottom: 12px; border-bottom: 1px solid var(--border-color); }

/* --- 5. СОЗДАНИЕ КАМПАНИИ (CAMPAIGN_CREATE.PHP) --- */
.content { flex: 1; padding: 40px; max-width: 1000px; margin: 0 auto; width: 100%; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.page-title { font-size: 1.5rem; font-weight: 600; margin: 0; }
.page-header p { color: var(--text-muted); margin: 8px 0 0 0; }
.btn-back { color: var(--text-muted); font-weight: 500; display: inline-flex; align-items: center; gap: 8px; }
.btn-back:hover { color: var(--orange-primary); }

.form-section { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 8px; padding: 24px; margin-bottom: 24px; }
.section-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border-color); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.file-upload { border: 2px dashed var(--border-color); padding: 30px; text-align: center; border-radius: 6px; cursor: pointer; transition: 0.2s; }
.file-upload:hover { border-color: var(--orange-primary); background: var(--orange-light); }
.file-upload input { display: none; }
.file-upload label { cursor: pointer; color: var(--orange-primary); font-weight: 500; }

/* --- 6. НАСТРОЙКИ ПРОФИЛЯ (PROFILE_SETTINGS.PHP) --- */
.page-wrapper { max-width: 1300px; margin: 40px auto; padding: 0 20px; padding-bottom: 60px; width: 100%; }
.cards-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; align-items: stretch; }
.settings-card { background: var(--bg-card); padding: 32px; border-radius: var(--radius-card); border: 1px solid var(--border-color); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-grid-full { grid-column: span 2; }

/* Загрузка аватара и документов */
.avatar-upload-box { display: flex; align-items: center; gap: 20px; padding: 16px; background: var(--bg-app); border: 1px dashed var(--border-color); border-radius: 8px; }
.avatar-preview { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background: #FFF; border: 2px solid #FFF; box-shadow: 0 2px 4px rgba(0,0,0,0.1); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 0.85rem; flex-shrink: 0; overflow: hidden; }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.file-input-wrapper { flex: 1; }
.doc-link { display: inline-block; margin-top: 8px; font-size: 0.85rem; color: #2563EB; font-weight: 500; }
.doc-link:hover { text-decoration: underline; }

/* Кастомные инпуты для файлов */
input[type="file"] { padding: 4px; background: transparent; cursor: pointer; border: none; font-size: 0.9rem; width: 100%; }
input[type="file"]::file-selector-button { background: var(--bg-app); border: 1px solid var(--border-color); padding: 6px 14px; border-radius: 6px; cursor: pointer; color: var(--text-main); font-weight: 500; transition: 0.2s; margin-right: 12px; }
input[type="file"]::file-selector-button:hover { background: var(--border-color); }

/* --- 7. ОБЩИЕ ЭЛЕМЕНТЫ ФОРМ (ГЛОБАЛЬНО) --- */
.form-group { margin-bottom: 16px; display: flex; flex-direction: column; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 8px; color: var(--text-muted); }
.form-control { width: 100%; padding: 10px 14px; border: 1px solid var(--border-color); border-radius: 6px; font-size: 0.95rem; box-sizing: border-box; transition: 0.2s; background: #FFF; }
.form-control:focus { outline: none; border-color: var(--orange-primary); box-shadow: 0 0 0 3px rgba(255, 90, 0, 0.1); }
select.form-control { appearance: none; background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; }

/* Кнопки */
.btn-primary, .btn-submit { background-color: var(--orange-primary); color: white; border: none; padding: 10px 20px; border-radius: 8px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: 0.2s; font-size: 1rem; width: auto; }
.btn-primary:hover, .btn-submit:hover { background-color: var(--orange-hover); }
.btn-submit.full-width { width: 100%; padding: 14px; margin-top: 10px; } /* Для формы авторизации */

.btn-outline { background: transparent; color: var(--text-main); border: 1px solid var(--border-color); padding: 8px 16px; border-radius: 6px; font-weight: 500; cursor: pointer; transition: 0.2s; }
.btn-outline:hover { border-color: var(--text-muted); background: var(--bg-app); }
.btn-save { background: var(--orange-primary); color: #FFF; border: none; padding: 12px 32px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.2s; font-size: 1rem; }
.btn-save:hover { background: var(--orange-hover); box-shadow: 0 4px 12px rgba(255, 90, 0, 0.2); }

/* Алерт и подвал */
.alert, .error-message { padding: 12px 16px; border-radius: 6px; font-size: 0.95rem; margin-bottom: 24px; font-weight: 500; display: flex; align-items: center; gap: 10px; }
.alert-success { background: #ECFDF5; color: #059669; border: 1px solid #34D399; }
.alert-error, .error-message { background: #FEF2F2; color: #DC2626; border: 1px solid #F87171; }
.sticky-footer { position: sticky; bottom: 0; background: rgba(249, 250, 251, 0.9); backdrop-filter: blur(8px); padding: 20px 0; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; z-index: 10; margin-top: 30px; }

.banner-preview {
    max-width: 150px;
    max-height: 80px;
    border-radius: 4px;
    border: 1px solid #E5E7EB;
    object-fit: contain;
    background: #F9FAFB;
}
.format-badge {
    display: inline-block;
    background: #E5E7EB;
    color: #374151;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    margin-top: 4px;
}