/* ==========================================================================
   БАЗОВЫЕ СТИЛИ ПРОЕКТА
   Общие компоненты: формы, кнопки, таблицы, карточки
   ========================================================================== */

/* ==========================================================================
   CSS Переменные (темизация)
   ========================================================================== */
:root {
    /* Основные цвета */
    --primary-gradient-start: #667eea;
    --primary-gradient-end: #764ba2;
    --primary-color: #667eea;
    --primary-dark: #5a67d8;
    --primary-light: #a3bffa;
    
    /* Цвета текста */
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --text-light: #a0aec0;
    
    /* Цвета фона */
    --bg-white: #ffffff;
    --bg-light: #f7fafc;
    --bg-gray: #edf2f7;
    --bg-border: #e2e8f0;
    
    /* Цвета акцентов */
    --accent-blue: #667eea;
    --accent-purple: #764ba2;
    --accent-red: #e53e3e;
    --accent-green: #38a169;
    --accent-yellow: #d69e2e;
    
    /* Тени */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.15);
    --shadow-hover: 0 25px 70px rgba(0, 0, 0, 0.2);
    
    /* Радиусы */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    
    /* Переходы */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ==========================================================================
   Типографика
   ========================================================================== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-primary);
    background: #EFEFEF;
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0;
}

/* Заголовки страниц */
.page-title {
    text-align: center;
    color: var(--text-primary);
    font-size: 2rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.page-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 30px;
}

/* ==========================================================================
   Контейнеры и карточки
   ========================================================================== */
.container-card {
    max-width: 420px;
    margin: 40px auto;
    padding: 40px;
    background: linear-gradient(135deg, var(--bg-white) 0%, var(--bg-light) 100%);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(0, 0, 0, 0.05);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    animation: fadeInUp 0.6s ease-out;
}

.container-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.container-card-wide {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
    background: linear-gradient(135deg, var(--bg-white) 0%, var(--bg-light) 100%);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl), 0 0 0 1px rgba(0, 0, 0, 0.05);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    animation: fadeInUp 0.6s ease-out;
}

/* ==========================================================================
   Формы
   ========================================================================== */
.form-group {
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.form-control {
    padding: 14px 18px;
    border: 2px solid var(--bg-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all var(--transition-normal);
    background: var(--bg-white);
    color: var(--text-primary);
    width: 100%;
    box-sizing: border-box;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.form-control::placeholder {
    color: var(--text-light);
}

/* Чекбоксы */
.checkbox-group {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    position: relative;
    padding-left: 30px;
}

.checkbox-container input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 20px;
    width: 20px;
    background-color: var(--bg-white);
    border: 2px solid var(--bg-border);
    border-radius: var(--radius-sm);
    transition: all var(--transition-normal);
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--primary-color);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

/* ==========================================================================
   Кнопки
   ========================================================================== */
.btn {
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-gradient-start) 0%, var(--primary-gradient-end) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-gradient-end) 0%, var(--primary-gradient-start) 100%);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-full {
    width: 100%;
}

/* ==========================================================================
   Таблицы
   ========================================================================== */
.table-modern {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.table-modern thead {
    background: linear-gradient(135deg, var(--primary-gradient-start) 0%, var(--primary-gradient-end) 100%);
    color: white;
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
    overflow: hidden;
}

.table-modern thead th {
    padding: 16px 12px;
    font-weight: 600;
    text-align: left;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border: none;
}

.table-modern thead th:first-child {
    /* Убрано, так как радиус теперь задается в thead */
}

.table-modern thead th:last-child {
    /* Убрано, так как радиус теперь задается в thead */
}

.table-modern tbody tr {
    border-bottom: 1px solid var(--bg-border);
    transition: background var(--transition-fast);
}

.table-modern tbody tr:last-child {
    border-bottom: none;
}

.table-modern tbody tr:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

.table-modern tbody td {
    padding: 14px 12px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.table-modern tbody td a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.table-modern tbody td a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Адаптивность таблицы */
@media(max-width: 768px) {
    .table-modern {
        font-size: 0.85rem;
    }
    
    .table-modern thead th,
    .table-modern tbody td {
        padding: 10px 8px;
    }
}

/* ==========================================================================
   Сообщения об ошибках
   ========================================================================== */
.error-message {
    color: var(--accent-red);
    font-size: 0.85rem;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.error-message:before {
    content: "⚠";
}

/* ==========================================================================
   Иконки SVG
   ========================================================================== */
.icon-lock,
.icon-user,
.icon-key {
    display: inline-block;
    flex-shrink: 0;
}

.icon-lock svg,
.icon-user svg,
.icon-key svg {
    vertical-align: middle;
}

/* ==========================================================================
   Анимации
   ========================================================================== */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Утилиты
   ========================================================================== */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.opacity-50 {
    opacity: 0.5;
}

.mb-0 { margin-bottom: 0; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }
.mb-40 { margin-bottom: 40px; }

.mt-0 { margin-top: 0; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }

.w-100 { width: 100%; }

/* Ячейки таблицы с датой */
.date-cell {
    font-size: 0.85rem;
    line-height: 1.4;
}

.time-text {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ==========================================================================
   Адаптивность
   ========================================================================== */
@media(max-width: 500px) {
    .container {
        padding: 0 12px;
        margin: 10px auto;
    }
    
    .container-card,
    .container-card-wide {
        padding: 30px 20px;
        margin: 20px;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .btn {
        padding: 14px 24px;
        font-size: 1rem;
    }
}

/* ==========================================================================
   Flexbox утилиты
   ========================================================================== */
.flex-row {
    display: flex;
    flex-direction: row;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.gap-sm {
    gap: 8px;
}

.gap-md {
    gap: 16px;
}

.gap-lg {
    gap: 24px;
}

.mobile-col {
    flex-wrap: wrap;
}

@media(max-width: 768px) {
    .mobile-col {
        flex-direction: column;
    }
}

/* ==========================================================================
   Сайдбар меню
   ========================================================================== */
.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    margin-bottom: 8px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    font-weight: 500;
}

.sidebar-menu a:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    color: var(--primary-color);
    transform: translateX(5px);
}

.sidebar-menu a.active {
    background: linear-gradient(135deg, var(--primary-gradient-start) 0%, var(--primary-gradient-end) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.sidebar-menu svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    flex-shrink: 0;
}

/* Карточка сайдбара */
.sidebar {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 16px;
    margin-bottom: 20px;
}

/* Основной контейнер страницы */
.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 16px;
    width: 100%;
    box-sizing: border-box;
}

/* Контейнер таблицы */
.table-container {
    overflow-x: auto;
    margin-top: 16px;
}

/* Заголовок карточки */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--bg-border);
    margin-bottom: 16px;
}

.card-header span {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.2rem;
}

/* Форма входа */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-gradient-start) 0%, var(--primary-gradient-end) 100%);
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 40px;
    animation: fadeInUp 0.6s ease-out;
}

.login-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 30px;
    text-align: center;
    justify-content: center;
}

.login-form .remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.login-form .remember-me label {
    color: var(--text-secondary);
    font-size: 0.95rem;
    cursor: pointer;
}
