/* ============================================
   АРМИКОН UI — Единый CSS-фреймворк v1.0
   Подключается во всех модулях ПЕРВЫМ
   ============================================ */

/* === CSS ПЕРЕМЕННЫЕ === */
:root {
    /* Фоны */
    --au-bg: linear-gradient(135deg, #0f1729 0%, #1a2332 50%, #0d1520 100%);
    --au-bg-flat: #0a0e1a;
    --au-bg-card: rgba(255,255,255,0.04);
    --au-bg-card-hover: rgba(255,255,255,0.08);
    --au-bg-header: rgba(255,255,255,0.03);

    /* Текст */
    --au-text: #e0e6ed;
    --au-text-secondary: rgba(255,255,255,0.5);
    --au-text-muted: rgba(255,255,255,0.35);

    /* Акцентные цвета */
    --au-accent: #e85d75;
    --au-accent-hover: #d14d65;
    --au-accent-bg: rgba(232,93,117,0.12);
    --au-accent-border: rgba(232,93,117,0.3);

    /* Семантические */
    --au-success: #22c55e;
    --au-warning: #f59e0b;
    --au-danger: #ef4444;
    --au-info: #3b82f6;

    /* Границы */
    --au-border: rgba(255,255,255,0.06);
    --au-border-hover: rgba(255,255,255,0.12);

    /* Скругления */
    --au-radius-sm: 8px;
    --au-radius: 12px;
    --au-radius-lg: 16px;
    --au-radius-xl: 20px;

    /* Тени */
    --au-shadow: 0 4px 16px rgba(0,0,0,0.2);
    --au-shadow-lg: 0 12px 32px rgba(0,0,0,0.3);

    /* Шрифт */
    --au-font: 'Segoe UI', system-ui, -apple-system, sans-serif;

    /* Типографика */
    --au-fs-xs: 11px;
    --au-fs-sm: 12px;
    --au-fs-base: 14px;
    --au-fs-md: 16px;
    --au-fs-lg: 20px;
    --au-fs-xl: 24px;
    --au-fs-h1: 28px;
}

/* === ЦВЕТА МОДУЛЕЙ (переопределяются в каждом модуле) === */
/* Портал: --au-module: #e85d75 */
/* ПТО:    --au-module: #ff8c00 */
/* HR:     --au-module: #e85d75 */
/* СБ:     --au-module: #ef4444 */
/* Админ:  --au-module: #e94560 */

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

/* === BODY === */
body {
    font-family: var(--au-font);
    background: var(--au-bg);
    min-height: 100vh;
    color: var(--au-text);
    font-size: var(--au-fs-base);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* === HEADER === */
.au-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 32px;
    background: var(--au-bg-header);
    border-bottom: 1px solid var(--au-border);
    gap: 16px;
}

.au-header-logo {
    font-size: var(--au-fs-lg);
    font-weight: 700;
    color: var(--au-module, var(--au-accent));
    letter-spacing: 2px;
    white-space: nowrap;
    flex-shrink: 0;
}

.au-header-logo span {
    color: var(--au-text-secondary);
    font-weight: 300;
    font-size: var(--au-fs-base);
    margin-left: 12px;
    letter-spacing: 0;
}

.au-header-nav {
    display: flex;
    gap: 8px;
    align-items: center;
    overflow-x: auto;
}

.au-header-user {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.au-header-user .au-name {
    font-size: var(--au-fs-base);
    color: var(--au-text-secondary);
}

.au-header-user .au-role {
    font-size: var(--au-fs-xs);
    background: var(--au-accent-bg);
    color: var(--au-module, var(--au-accent));
    padding: 3px 10px;
    border-radius: var(--au-radius);
    font-weight: 600;
}

/* === КНОПКИ === */
.au-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--au-radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    border: 1px solid transparent;
    line-height: 1.4;
}

.au-btn-primary {
    background: var(--au-module, var(--au-accent));
    color: #fff;
    border-color: transparent;
}
.au-btn-primary:hover {
    filter: brightness(0.9);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

.au-btn-secondary {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.1);
    color: var(--au-text-secondary);
}
.au-btn-secondary:hover {
    border-color: var(--au-accent-border);
    color: var(--au-module, var(--au-accent));
    background: var(--au-accent-bg);
}

.au-btn-ghost {
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--au-text-secondary);
}
.au-btn-ghost:hover {
    border-color: var(--au-module, var(--au-accent));
    color: var(--au-module, var(--au-accent));
}

.au-btn-danger {
    background: rgba(239,68,68,0.1);
    border-color: rgba(239,68,68,0.3);
    color: var(--au-danger);
}
.au-btn-danger:hover {
    background: rgba(239,68,68,0.2);
}

.au-btn-sm {
    padding: 5px 12px;
    font-size: var(--au-fs-sm);
    border-radius: 6px;
}

/* === КАРТОЧКИ === */
.au-card {
    background: var(--au-bg-card);
    border: 1px solid var(--au-border);
    border-radius: var(--au-radius-lg);
    padding: 24px;
    transition: all 0.25s;
}

.au-card:hover {
    background: var(--au-bg-card-hover);
    border-color: var(--au-border-hover);
}

.au-card-clickable {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.au-card-clickable:hover {
    transform: translateY(-3px);
    box-shadow: var(--au-shadow-lg);
    border-color: var(--au-accent-border);
}

/* === КОНТЕНТ === */
.au-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px;
}

/* === СЕКЦИЯ === */
.au-section-title {
    font-size: var(--au-fs-md);
    color: var(--au-text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 24px;
}

/* === СЕТКА МОДУЛЕЙ === */
.au-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.au-grid-2 { grid-template-columns: repeat(2, 1fr); }
.au-grid-3 { grid-template-columns: repeat(3, 1fr); }
.au-grid-4 { grid-template-columns: repeat(4, 1fr); }

/* === ИКОНКА МОДУЛЯ === */
.au-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: var(--au-accent-bg);
    border-radius: var(--au-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* === ТАБЛИЦЫ === */
.au-table-wrap {
    background: var(--au-bg-card);
    border: 1px solid var(--au-border);
    border-radius: var(--au-radius-lg);
    overflow-x: auto;
}

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

.au-table-header h2 {
    font-size: var(--au-fs-md);
    font-weight: 600;
}

.au-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

.au-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: var(--au-fs-sm);
    font-weight: 600;
    color: var(--au-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--au-border);
}

.au-table td {
    padding: 12px 16px;
    font-size: var(--au-fs-base);
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.au-table tr:hover td {
    background: rgba(255,255,255,0.02);
}

/* === БЕЙДЖИ === */
.au-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: var(--au-fs-sm);
    font-weight: 600;
}

.au-badge-accent {
    background: var(--au-accent-bg);
    color: var(--au-module, var(--au-accent));
}

.au-badge-success {
    background: rgba(34,197,94,0.15);
    color: var(--au-success);
}

.au-badge-warning {
    background: rgba(245,158,11,0.15);
    color: var(--au-warning);
}

.au-badge-danger {
    background: rgba(239,68,68,0.15);
    color: var(--au-danger);
}

.au-badge-muted {
    background: rgba(255,255,255,0.06);
    color: var(--au-text-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* === ФОРМЫ === */
.au-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--au-radius);
    color: var(--au-text);
    font-size: 15px;
    font-family: var(--au-font);
    outline: none;
    transition: border 0.2s;
}

.au-input:focus {
    border-color: var(--au-module, var(--au-accent));
}

.au-input::placeholder {
    color: var(--au-text-muted);
}

.au-select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--au-radius-sm);
    color: var(--au-text);
    font-size: var(--au-fs-base);
    font-family: var(--au-font);
    outline: none;
}

.au-select:focus {
    border-color: var(--au-module, var(--au-accent));
}

.au-label {
    display: block;
    font-size: 13px;
    color: var(--au-text-secondary);
    margin-bottom: 4px;
    margin-top: 12px;
}

/* === МОДАЛЬНЫЕ ОКНА === */
.au-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.au-modal {
    background: #141824;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--au-radius-xl);
    padding: 28px;
    width: 480px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
}

.au-modal h3 {
    font-size: 18px;
    margin-bottom: 20px;
}

.au-modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    justify-content: flex-end;
}

/* === ТОСТЫ/УВЕДОМЛЕНИЯ === */
.au-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: var(--au-radius-sm);
    font-size: var(--au-fs-base);
    z-index: 2000;
    animation: au-slideIn 0.3s ease;
    max-width: 400px;
}

.au-toast-success {
    background: #1b5e20;
    color: #a5d6a7;
    border: 1px solid #2e7d32;
}

.au-toast-error {
    background: #b71c1c;
    color: #ef9a9a;
    border: 1px solid #c62828;
}

.au-toast-warning {
    background: #4a3800;
    color: #ffd54f;
    border: 1px solid #6d5200;
}

@keyframes au-slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* === ЛОГИН === */
.au-login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.au-login-card {
    background: var(--au-bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--au-radius-xl);
    padding: 48px 40px;
    width: 400px;
    text-align: center;
}

.au-login-card h1 {
    color: var(--au-module, var(--au-accent));
    font-size: var(--au-fs-h1);
    letter-spacing: 3px;
    margin-bottom: 8px;
}

.au-login-card p {
    color: var(--au-text-muted);
    font-size: var(--au-fs-base);
    margin-bottom: 32px;
}

/* === STAT CARDS === */
.au-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.au-stat {
    background: var(--au-bg-card);
    border: 1px solid var(--au-border);
    border-radius: var(--au-radius-lg);
    padding: 20px;
    text-align: center;
    min-width: 160px;
    flex: 1;
}

.au-stat .au-stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--au-module, var(--au-accent));
    margin: 8px 0 4px;
}

.au-stat .au-stat-label {
    font-size: 13px;
    color: var(--au-text-muted);
}

/* === BREADCRUMBS === */
.au-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    font-size: var(--au-fs-sm);
    color: var(--au-text-muted);
}

.au-breadcrumbs a {
    color: var(--au-text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.au-breadcrumbs a:hover {
    color: var(--au-module, var(--au-accent));
}

.au-breadcrumbs .au-sep::after {
    content: '›';
    margin: 0 4px;
    color: var(--au-text-muted);
}

/* === ФИЛЬТРЫ === */
.au-filters {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* === DISABLED/СКОРО === */
.au-disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* === FOOTER === */
.au-footer {
    text-align: center;
    padding: 24px 32px;
    font-size: var(--au-fs-xs);
    color: var(--au-text-muted);
    border-top: 1px solid var(--au-border);
    margin-top: 48px;
}

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

.au-footer a:hover {
    color: var(--au-module, var(--au-accent));
}

/* === СКЕЛЕТОН ЗАГРУЗКИ === */
.au-skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: au-shimmer 1.5s infinite;
    border-radius: var(--au-radius-sm);
}

@keyframes au-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* === АДАПТИВ === */
@media (max-width: 768px) {
    .au-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .au-content {
        padding: 20px 16px;
    }
    .au-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .au-grid-3, .au-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    .au-stats {
        flex-wrap: wrap;
    }
    .au-stat {
        min-width: 140px;
    }
    .au-modal {
        width: 95vw;
        padding: 20px;
    }
    .au-breadcrumbs {
        padding: 10px 16px;
    }
}

@media (max-width: 480px) {
    .au-grid {
        grid-template-columns: 1fr;
    }
    .au-header-nav {
        gap: 4px;
    }
    .au-btn {
        padding: 6px 12px;
        font-size: var(--au-fs-sm);
    }
    .au-login-card {
        width: 92%;
        padding: 32px 24px;
    }
}


/* === СВЕТЛАЯ ТЕМА === */
[data-theme="light"] {
    --au-bg: #f8f9fb;
    --au-bg-flat: #ffffff;
    --au-bg-card: #ffffff;
    --au-bg-card-hover: #ffffff;
    --au-bg-header: #ffffff;
    --au-text: #111827;
    --au-text-secondary: #4b5563;
    --au-text-muted: #9ca3af;
    --au-accent-bg: rgba(232,93,117,0.08);
    --au-border: #e5e7eb;
    --au-border-hover: #d1d5db;
    --au-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --au-shadow-lg: 0 10px 25px rgba(0,0,0,0.1), 0 4px 10px rgba(0,0,0,0.05);
}

[data-theme="light"] body {
    background: #f8f9fb;
}

[data-theme="light"] .au-header {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

[data-theme="light"] .au-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

[data-theme="light"] .au-card:hover {
    background: #ffffff;
    border-color: #d1d5db;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

[data-theme="light"] .au-login-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 8px 32px rgba(0,0,0,0.08);
}

[data-theme="light"] .au-modal {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

[data-theme="light"] .au-footer {
    border-top: 1px solid #e5e7eb;
    color: #9ca3af;
}
[data-theme="light"] .au-footer a { color: #6b7280; }
[data-theme="light"] .au-footer a:hover { color: var(--au-module, var(--au-accent)); }

[data-theme="light"] .au-breadcrumbs { color: #9ca3af; }
[data-theme="light"] .au-breadcrumbs a { color: #6b7280; }

[data-theme="light"] .au-section-title { color: #6b7280; }

[data-theme="light"] .au-input,
[data-theme="light"] .au-select {
    background: #f9fafb;
    border: 1px solid #d1d5db;
    color: #111827;
}
[data-theme="light"] .au-input::placeholder { color: #9ca3af; }

[data-theme="light"] .au-btn-secondary {
    background: #f9fafb;
    border: 1px solid #d1d5db;
    color: #4b5563;
}
[data-theme="light"] .au-btn-secondary:hover {
    background: var(--au-accent-bg);
    border-color: var(--au-accent-border);
    color: var(--au-module, var(--au-accent));
}

[data-theme="light"] .au-btn-ghost {
    border: 1px solid #d1d5db;
    color: #6b7280;
}
[data-theme="light"] .au-btn-ghost:hover {
    border-color: var(--au-module, var(--au-accent));
    color: var(--au-module, var(--au-accent));
}

[data-theme="light"] .au-toast-success {
    background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0;
}
[data-theme="light"] .au-toast-error {
    background: #fef2f2; color: #991b1b; border: 1px solid #fecaca;
}
[data-theme="light"] .au-toast-warning {
    background: #fffbeb; color: #92400e; border: 1px solid #fde68a;
}

[data-theme="light"] .au-table th {
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
}
[data-theme="light"] .au-table td {
    border-bottom: 1px solid #f3f4f6;
}
[data-theme="light"] .au-table tr:hover td {
    background: #f9fafb;
}

[data-theme="light"] .au-stat {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

[data-theme="light"] .au-badge-muted {
    background: #f3f4f6;
    color: #6b7280;
}

[data-theme="light"] .au-header-user .au-role {
    background: rgba(232,93,117,0.08);
}

[data-theme="light"] .au-skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: au-shimmer 1.5s infinite;
}
