/* === БАЗОВЫЕ СТИЛИ === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --success-color: #16a34a;
    --warning-color: #ea580c;
    --danger-color: #dc2626;
    --info-color: #0891b2;
    --text-color: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --bg-gray: #f9fafb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #fff;
    color: var(--text-color);
    line-height: 1.6;
    font-size: 14px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* === НАВИГАЦИЯ === */
.navbar {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 8px;
}

.nav-menu a {
    display: block;
    padding: 18px 20px;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: background 0.2s;
}

.nav-menu a:hover {
    background: var(--bg-gray);
}

.nav-menu a.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

/* === КНОПКИ === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-color);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    text-decoration: none;
    min-height: 44px;
}

.btn:hover {
    background: var(--bg-gray);
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-success {
    background: var(--success-color);
    color: #fff;
    border-color: var(--success-color);
}

.btn-success:hover {
    background: #15803d;
}

.btn-warning {
    background: var(--warning-color);
    color: #fff;
    border-color: var(--warning-color);
}

.btn-warning:hover {
    background: #c2410c;
}

.btn-danger {
    background: var(--danger-color);
    color: #fff;
    border-color: var(--danger-color);
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-info {
    background: var(--info-color);
    color: #fff;
    border-color: var(--info-color);
}

.btn-info:hover {
    background: #0e7490;
}

.btn-link {
    background: transparent;
    border: none;
    color: var(--primary-color);
    padding: 10px 12px;
}

.btn-link:hover {
    background: var(--bg-gray);
    text-decoration: underline;
}

.btn-large {
    padding: 14px 28px;
    font-size: 16px;
    min-height: 52px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    min-height: 36px;
}

/* === DROPDOWN === */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle::after {
    content: "▼";
    font-size: 10px;
    margin-left: 6px;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    display: none;
    z-index: 1000;
}

.dropdown.active .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 10px 16px;
    color: var(--text-color);
    text-decoration: none;
    transition: background 0.2s;
}

.dropdown-menu a:hover {
    background: var(--bg-gray);
}

/* === ФОРМЫ === */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    min-height: 44px;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

select.form-control {
    cursor: pointer;
}

.checkbox,
.radio {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.checkbox input,
.radio input {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

/* === ТАБЛИЦЫ === */
.table-wrapper {
    overflow-x: auto;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

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

th {
    background: var(--bg-gray);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: var(--bg-gray);
}

/* === ПАГИНАЦИЯ === */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
}

.pagination a:hover {
    background: var(--bg-gray);
}

.pagination .active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* === ТАБЫ === */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.tab {
    padding: 12px 24px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    min-height: 44px;
}

.tab:hover:not(:disabled) {
    color: var(--text-color);
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* === МОДАЛЬНОЕ ОКНО === */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* === УВЕДОМЛЕНИЯ === */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: #fff;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    border-radius: 6px;
    padding: 16px 20px;
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

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

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

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

/* === АЛЕРТЫ === */
.alert {
    padding: 16px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid;
}

.alert-success {
    background: #f0fdf4;
    border-color: #86efac;
    color: #15803d;
}

.alert-warning {
    background: #fff7ed;
    border-color: #fdba74;
    color: #c2410c;
}

.alert-danger {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #b91c1c;
}

.alert-info {
    background: #ecfeff;
    border-color: #67e8f9;
    color: #0e7490;
}

/* === ФИЛЬТРЫ === */
.filters {
    background: var(--bg-gray);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.filters-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* === ФУТЕР === */
.footer {
    background: var(--bg-gray);
    border-top: 1px solid var(--border-color);
    padding: 20px 0;
    margin-top: 60px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

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

.footer a:hover {
    text-decoration: underline;
}

/* === ОСНОВНОЙ КОНТЕНТ === */
.main-content {
    padding: 32px 0;
    min-height: calc(100vh - 200px);
}

.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

/* === СТРАНИЦА АВТОРИЗАЦИИ === */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-gray);
}

.auth-card {
    background: #fff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 400px;
}

.auth-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 24px;
    text-align: center;
}

/* === ДЕЙСТВИЯ === */
.actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.actions-left,
.actions-right {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* === СТАТУСЫ === */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: #dcfce7;
    color: #15803d;
}

.badge-warning {
    background: #ffedd5;
    color: #c2410c;
}

.badge-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-info {
    background: #cffafe;
    color: #0e7490;
}

/* === АДАПТИВНОСТЬ === */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        height: auto;
        padding: 12px 20px;
    }

    .nav-menu {
        width: 100%;
        flex-direction: column;
        gap: 0;
    }

    .nav-menu a {
        padding: 12px 16px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .filters-row {
        grid-template-columns: 1fr;
    }

    .actions-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .actions-left,
    .actions-right {
        width: 100%;
    }

    .table-wrapper {
        font-size: 13px;
    }

    th, td {
        padding: 8px 12px;
    }

    .toast-container {
        left: 20px;
        right: 20px;
    }

    .toast {
        min-width: auto;
    }
}

/* === ИКОНКИ (простые символы) === */
.icon {
    display: inline-block;
    width: 16px;
    height: 16px;
}

.icon-add::before { content: "➕"; }
.icon-sync::before { content: "🔄"; }
.icon-save::before { content: "💾"; }
.icon-cancel::before { content: "✖"; }
.icon-edit::before { content: "✏"; }
.icon-delete::before { content: "🗑"; }
.icon-search::before { content: "🔍"; }
.icon-filter::before { content: "⚙"; }