/* Глобальные стили CRM системы в стиле MATRIX */
:root {
    /* Основные цвета из вашего дашборда */
    --bg-color: #8C9CCF;
    --text-color: #262e59;
    --primary: #455AA5;
    --primary-dark: #262e59;
    --success: #28a745;
    --danger: #dc3545;
    --danger-dark: #c82333;
    --warning: #ffc107;
    --info: #17a2b8;
    --card-bg: rgba(255, 255, 255, 0.97);
    
    /* Размеры */
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --border-radius-sm: 8px;
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* MATRIX анимации */
@keyframes matrix-flow {
    0% { transform: translateY(-100%); opacity: 1; }
    80% { opacity: 1; }
    100% { transform: translateY(100vh); opacity: 0; }
}

@keyframes matrix-bg-pulse {
    0% { background-color: rgba(0, 40, 0, 0.03); }
    50% { background-color: rgba(0, 60, 0, 0.06); }
    100% { background-color: rgba(0, 40, 0, 0.03); }
}

.matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 50%, rgba(0, 255, 0, 0.05) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
    animation: matrix-bg-pulse 8s ease-in-out infinite;
}

.matrix-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    padding: 0 5px;
    box-sizing: border-box;
}

.matrix-column {
    flex: 0 0 auto;
    width: 20px;
    color: #0f0;
    text-shadow: 0 0 5px #0f0, 0 0 8px #0a0;
    animation: matrix-flow linear infinite;
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: -2px;
    font-weight: bold;
    opacity: 0.4;
    white-space: nowrap;
    font-size: 14px;
    mix-blend-mode: screen;
    position: relative;
    margin: 0 1px;
}

.hex-corner {
    position: fixed;
    font-family: 'Courier New', monospace;
    color: var(--primary);
    opacity: 0.15;
    font-size: 9px;
    pointer-events: none;
    z-index: 5;
    font-weight: bold;
}

.hex-corner-tl { top: 8px; left: 8px; transform: rotate(-90deg); }
.hex-corner-tr { top: 8px; right: 8px; transform: rotate(90deg); }
.hex-corner-bl { bottom: 8px; left: 8px; transform: rotate(0deg); }
.hex-corner-br { bottom: 8px; right: 8px; transform: rotate(180deg); }

/* Навигация в стиле MATRIX */
.navbar {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    margin: 12px 20px;
    padding: 12px 20px;
    box-shadow: 0 8px 20px rgba(38, 46, 89, 0.25);
    border: 1px solid rgba(255,255,255,0.5);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-decoration: none;
}

.navbar-menu {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    transform: translateY(-2px);
}

/* Контейнеры - полная ширина */
.container {
    width: 100%;
    padding: 12px 20px;
    position: relative;
    z-index: 10;
}

/* Карточки в стиле MATRIX */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.5);
    box-shadow: 0 8px 20px rgba(38, 46, 89, 0.25);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
}

.card-header {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--primary);
    color: var(--text-color);
}

/* Сетка для статистики */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    border-left: 4px solid var(--info);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--info);
}

.stat-label {
    color: #666;
    font-size: 0.8rem;
    margin-top: 5px;
    font-weight: 500;
}

/* Таблицы в стиле MATRIX */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table th {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
}

.table td {
    padding: 12px;
    border-bottom: 1px solid #eaeef7;
    color: var(--text-color);
}

.table tr:hover {
    background: linear-gradient(135deg, rgba(23, 162, 184, 0.05) 0%, rgba(69, 90, 165, 0.05) 100%);
}

/* Статусы */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.new { background: rgba(255, 193, 7, 0.15); color: #856404; }
.status-badge.accepted { background: rgba(23, 162, 184, 0.15); color: #0c5460; }
.status-badge.in_progress { background: rgba(23, 162, 184, 0.15); color: #0c5460; }
.status-badge.completed { background: rgba(40, 167, 69, 0.15); color: #155724; }
.status-badge.revision { background: rgba(255, 193, 7, 0.15); color: #856404; }
.status-badge.closed { background: rgba(108, 117, 125, 0.15); color: #383d41; }

/* Кнопки в стиле MATRIX */
.btn {
    display: inline-block;
    padding: 8px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(69, 90, 165, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #212529;
}

.btn-warning:hover {
    transform: translateY(-2px);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.75rem;
}

/* Формы */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.85rem;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #eaeef7;
    border-radius: 10px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--info);
    box-shadow: 0 0 0 3px rgba(23, 162, 184, 0.1);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Уведомления */
.alert {
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-lg);
    border-left: 4px solid;
    backdrop-filter: blur(10px);
}

.alert-success {
    background: rgba(40, 167, 69, 0.15);
    border-color: var(--success);
    color: #155724;
}

.alert-danger {
    background: rgba(220, 53, 69, 0.15);
    border-color: var(--danger);
    color: #721c24;
}

.alert-warning {
    background: rgba(255, 193, 7, 0.15);
    border-color: var(--warning);
    color: #856404;
}

.alert-info {
    background: rgba(23, 162, 184, 0.15);
    border-color: var(--info);
    color: #0c5460;
}

/* Аутентификация */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
}

.auth-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.5);
}

.auth-title {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-color);
    font-weight: 700;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(0,0,0,0.1);
}

.auth-footer a {
    color: var(--info);
    text-decoration: none;
}

/* Фильтры */
.filters-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 12px;
}

.filter-btn {
    background: white;
    border: 2px solid #e0e5f0;
    border-radius: 25px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn.active {
    background: var(--info);
    border-color: var(--info);
    color: white;
}

/* Адаптивность */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        margin: 10px;
    }
    
    .navbar-menu {
        justify-content: center;
    }
    
    .container {
        padding: 10px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .auth-card {
        margin: 20px;
        padding: 25px;
    }
    
    .table th, .table td {
        padding: 8px;
        font-size: 0.75rem;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 5px;
    }
    
    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-btn {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .card {
        padding: 15px;
    }
}
