/* ===================================
   VERTEX DASHBOARD - MODERN CSS
   Светлая/Темная тема с необычными цветами
   =================================== */

/* === VARIABLES === */
:root {
    /* Light Theme (Default) */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8FAFB;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F1F5F9;
    --text-primary: #1A202C;
    --text-secondary: #64748B;
    --border: #E2E8F0;
    
    /* Необычные акцентные цвета */
    --accent-purple: #6366F1;      /* Индиго */
    --accent-pink: #EC4899;        /* Розовый */
    --accent-emerald: #10B981;     /* Изумрудный */
    --accent-amber: #F59E0B;       /* Янтарный */
    --accent-cyan: #06B6D4;        /* Циан */
    --accent-violet: #8B5CF6;      /* Фиолетовый */
    
    /* Градиенты */
    --gradient-purple: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-pink: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-cyan: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-emerald: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    
    /* Status Colors */
    --success: #10B981;
    --success-bg: #ECFDF5;
    --danger: #EF4444;
    --danger-bg: #FEF2F2;
    --warning: #F59E0B;
    --warning-bg: #FFFBEB;
    --info: #3B82F6;
    --info-bg: #EFF6FF;
    
    /* Effects */
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
    --glow-purple: 0 0 20px rgba(102, 126, 234, 0.3);
    --glow-pink: 0 0 20px rgba(236, 72, 153, 0.3);
    --radius: 16px;
    --radius-sm: 8px;
    --radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-card: #1E293B;
    --bg-card-hover: #334155;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --border: #334155;
    
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.6);
    
    --success-bg: rgba(16, 185, 129, 0.1);
    --danger-bg: rgba(239, 68, 68, 0.1);
    --warning-bg: rgba(245, 158, 11, 0.1);
    --info-bg: rgba(59, 130, 246, 0.1);
}

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

html {
    scroll-behavior: smooth;
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
    width: 100%;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

img {
    max-width: 100%;
    height: auto;
}

/* === CONTAINER === */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
    box-sizing: border-box;
}

/* Адаптация для разных устройств */
@media (max-width: 1600px) {
    .container {
        max-width: 1280px;
    }
}

@media (max-width: 1440px) {
    .container {
        max-width: 1200px;
    }
}

@media (max-width: 1280px) {
    .container {
        max-width: 1024px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
}

/* === NAVBAR === */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    width: 100%;
    overflow-x: hidden;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.navbar-brand h1 {
    font-size: 24px;
    font-weight: 800;
    background: var(--gradient-purple);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-menu {
    display: flex;
    gap: 6px;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 100%;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
    transition: var(--transition);
    white-space: nowrap;
}

.nav-link:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--gradient-purple);
    color: white;
}

.nav-link i {
    font-size: 16px;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: var(--gradient-purple);
    color: white;
}

.btn-primary:hover {
    box-shadow: var(--glow-purple);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-icon {
    padding: 10px;
    border-radius: 50%;
    aspect-ratio: 1;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--accent-purple);
    color: var(--accent-purple);
}

/* === USER MENU === */
.user-menu {
    position: relative;
}

.btn-user {
    background: var(--bg-card-hover);
    padding: 8px 16px;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
    border: 1px solid var(--border);
}

.user-menu:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    transition: var(--transition);
}

.user-dropdown a:hover {
    background: var(--bg-card-hover);
}

.user-dropdown a:first-child {
    border-radius: var(--radius) var(--radius) 0 0;
}

.user-dropdown a:last-child {
    border-radius: 0 0 var(--radius) var(--radius);
}

/* === MAIN CONTENT === */
.main-content {
    min-height: calc(100vh - 200px);
    padding: 40px 0;
    width: 100%;
    overflow-x: hidden;
}

/* === CARDS === */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.card-body {
    padding: 0;
}

/* === STAT CARDS === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
    width: 100%;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

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

.stat-card:nth-child(2)::before {
    background: var(--gradient-pink);
}

.stat-card:nth-child(3)::before {
    background: var(--gradient-emerald);
}

.stat-card:nth-child(4)::before {
    background: var(--gradient-cyan);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card h3 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
    background: var(--gradient-purple);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card:nth-child(2) h3 {
    background: var(--gradient-pink);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-card:nth-child(3) h3 {
    background: var(--gradient-emerald);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-card:nth-child(4) h3 {
    background: var(--gradient-cyan);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-card p {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

/* === SECTIONS === */
.section {
    margin-bottom: 40px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

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

.section-header h2 {
    font-size: 24px;
    font-weight: 700;
}

/* === GRIDS === */
.broker-grid, .certificates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 100%;
}

.broker-card, .certificate-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.broker-card:hover, .certificate-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.broker-card h3 {
    font-size: 20px;
    margin-bottom: 16px;
}

.broker-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.broker-stat .label {
    color: var(--text-secondary);
    font-size: 14px;
}

.broker-stat .value {
    font-weight: 600;
    font-size: 16px;
}

/* === CERTIFICATES === */
.certificate-image {
    width: 100%;
    height: 200px;
    background-size: cover;
    background-position: center;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.certificate-info h4 {
    font-size: 16px;
    margin-bottom: 8px;
}

.certificate-amount {
    font-size: 24px;
    font-weight: 800;
    background: var(--gradient-purple);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.certificate-date {
    color: var(--text-secondary);
    font-size: 13px;
}

/* === TABLES === */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius);
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    min-width: 800px;
}

.table thead {
    background: var(--bg-secondary);
}

.table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.table td {
    padding: 16px;
    border-top: 1px solid var(--border);
}

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

.table tbody tr:hover {
    background: var(--bg-card-hover);
}

/* === BADGES === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
}

/* === PROGRESS BARS === */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-purple);
    transition: width 0.6s ease;
}

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* === FOOTER === */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 32px 0;
    margin-top: 60px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-left p {
    color: var(--text-secondary);
    font-size: 14px;
}

.footer-right {
    display: flex;
    gap: 24px;
}

.footer-right a {
    color: var(--text-secondary);
    font-size: 14px;
    transition: var(--transition);
}

.footer-right a:hover {
    color: var(--accent-purple);
}

/* === EDIT MODE === */
.edit-mode-indicator {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--gradient-purple);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideInUp 0.3s ease;
}

.editable {
    position: relative;
    cursor: pointer;
    transition: var(--transition);
}

.editable:hover {
    outline: 2px dashed var(--accent-purple);
    outline-offset: 4px;
}

.editable::after {
    content: '\f044';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--accent-purple);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    opacity: 0;
    transition: var(--transition);
}

.editable:hover::after {
    opacity: 1;
}

/* === TOAST NOTIFICATIONS === */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--bg-card);
    padding: 16px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    border-left: 4px solid;
    animation: slideInRight 0.3s ease;
}

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

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

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

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

/* === ANIMATIONS === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

.fade-in {
    animation: fadeIn 0.6s ease;
}

/* === MOBILE NAVIGATION === */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
}

.navbar-menu.mobile-open {
    display: flex;
}

/* === RESPONSIVE === */

/* MacBook Pro 16" и большие экраны */
@media (max-width: 1920px) and (min-width: 1440px) {
    .navbar-menu {
        gap: 8px;
    }
    
    .nav-link {
        padding: 9px 14px;
        font-size: 13px;
    }
}

/* MacBook Pro 13-14", MacBook Air */
@media (max-width: 1440px) and (min-width: 1280px) {
    .container {
        max-width: 1200px;
        padding: 0 20px;
    }
    
    .navbar-menu {
        gap: 6px;
    }
    
    .nav-link {
        padding: 8px 12px;
        font-size: 12px;
        gap: 4px;
    }
    
    .nav-link span {
        display: inline;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 16px;
    }
    
    .broker-grid, .certificates-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}

/* Средние устройства */
@media (max-width: 1280px) and (min-width: 1024px) {
    .container {
        max-width: 1024px;
        padding: 0 20px;
    }
    
    .nav-link {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .nav-link span {
        display: none;
    }
    
    .nav-link i {
        font-size: 16px;
    }
}

@media (max-width: 1200px) {
    .container {
        max-width: 100%;
    }
}

@media (max-width: 1024px) {
    .navbar .container {
        flex-wrap: wrap;
    }
    
    .navbar-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        gap: 4px;
        order: 3;
        padding-top: 16px;
        border-top: 1px solid var(--border);
        margin-top: 16px;
    }
    
    .navbar-menu.mobile-open {
        display: flex;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .nav-link {
        width: 100%;
        justify-content: flex-start;
    }
    
    .navbar-actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .broker-grid, .certificates-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .section-header .btn {
        width: 100%;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 24px;
    }
    
    .footer-right {
        flex-direction: column;
        gap: 12px;
    }
    
    /* Tables */
    .table-responsive {
        font-size: 13px;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
    }
    
    /* Cards */
    .card {
        padding: 16px;
    }
    
    /* Buttons */
    .btn {
        font-size: 13px;
        padding: 8px 16px;
    }
    
    /* Modals */
    .modal-dialog {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .modal-header h3 {
        font-size: 18px;
    }
    
    /* Toast */
    .toast-container {
        top: 60px;
        right: 12px;
        left: 12px;
    }
    
    .toast {
        min-width: auto;
        width: 100%;
    }
    
    /* Hero */
    .hero-section h1 {
        font-size: 32px !important;
    }
    
    .hero-tagline {
        font-size: 16px !important;
    }
    
    /* Page Header */
    .page-header h1 {
        font-size: 28px;
    }
    
    .page-header p {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }
    
    .navbar {
        padding: 12px 0;
    }
    
    .navbar-brand h1 {
        font-size: 20px;
    }
    
    .main-content {
        padding: 24px 0;
    }
    
    .stats-grid {
        gap: 12px;
    }
    
    .stat-card {
        padding: 20px 16px;
    }
    
    .stat-card h3 {
        font-size: 24px;
    }
    
    .stat-card p {
        font-size: 13px;
    }
    
    /* Скрываем некоторые колонки в таблицах на маленьких экранах */
    .table th:nth-child(n+5),
    .table td:nth-child(n+5) {
        display: none;
    }
    
    /* Кнопки на всю ширину */
    .section-header .btn,
    .btn-group .btn {
        width: 100%;
    }
}

/* === FORMS === */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    font-family: inherit;
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-purple) !important;
}

/* === MOBILE RESPONSIVE HELPERS === */
@media (max-width: 768px) {
    /* Grid overrides for mobile */
    div[style*="grid-template-columns: repeat(auto-fit"] {
        grid-template-columns: 1fr !important;
    }
    
    div[style*="grid-template-columns: repeat(auto-fill"] {
        grid-template-columns: 1fr !important;
    }
    
    div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    
    div[style*="grid-template-columns: repeat(3"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Buttons in flex containers */
    div[style*="display: flex"][style*="gap"] {
        flex-wrap: wrap;
    }
    
    /* Overflow scrolling for tables */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 600px;
    }
}

/* === UTILITIES === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-weight-bold { font-weight: 700; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

