/* ========================================
   VLADLEN FM - Design System
   Unified Premium UI Framework
   Personal Resume Style (ovnresume.ru)
   ======================================== */

:root {
    /* 1. CORE PALETTE - Deep Slate & Indigo */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    --bg-tertiary: #f1f5f9;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);

    /* 2. ACCENTS - Premium Indigo/Violet */
    --accent: #6366f1;           /* Indigo-500 */
    --accent-secondary: #8b5cf6; /* Violet-500 */
    --accent-hover: #4f46e5;     /* Indigo-600 */
    --accent-light: rgba(99, 102, 241, 0.1);
    
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #DC2626;

    /* 3. LAYOUT & SPACING */
    --sidebar-width: 280px;
    --header-height: 72px;
    
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: clamp(1rem, 2vw + 0.5rem, 1.5rem);
    --spacing-xl: clamp(1.5rem, 3vw + 0.75rem, 2rem);
    --spacing-2xl: clamp(2rem, 5vw + 1rem, 3rem);

    /* 4. RADIUS & EFFECTS */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-2xl: 24px;
    
    --glass-blur: 24px;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* 5. TYPOGRAPHY */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-size-base: 16px;
    --font-size-sm: clamp(0.8125rem, 0.8vw + 0.7rem, 0.875rem);
    --font-size-lg: clamp(1rem, 1vw + 0.9rem, 1.125rem);
    --font-size-xl: clamp(1.125rem, 2vw + 1rem, 1.5rem);
    --font-size-2xl: clamp(1.25rem, 3vw + 1.1rem, 2rem);
    --font-size-3xl: clamp(1.5rem, 5vw + 1.2rem, 3rem);
    --line-height-base: 1.6;

    /* Compatibility Aliases */
    --color-accent: var(--accent);
    --color-accent-soft: var(--accent-secondary);
    --color-success: var(--success);
    --color-warning: var(--warning);
    --color-danger: var(--danger);
}

/* ========================================
   DARK THEME OVERRIDES
   ======================================== */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-primary-rgb: 15, 23, 42;
    --bg-secondary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-hover: rgba(51, 65, 85, 0.5);
    --bg-tertiary: #111827;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --border-color: rgba(148, 163, 184, 0.1);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.6);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.7);
    
    --glass-bg: rgba(30, 41, 59, 0.6);
    --glass-border: rgba(255, 255, 255, 0.05);
}

/* ========================================
   BASE STYLES
   ======================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: var(--font-size-base); scroll-behavior: smooth; }
body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: var(--line-height-base);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

[data-theme="dark"] body {
    background: radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
                radial-gradient(circle at 100% 0%, rgba(139, 92, 246, 0.08) 0%, transparent 40%),
                radial-gradient(circle at 100% 100%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
                radial-gradient(circle at 0% 100%, rgba(139, 92, 246, 0.08) 0%, transparent 40%),
                #0f172a;
}

/* ========================================
   CORE COMPONENTS
   ======================================== */

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform var(--transition-slow);
}

.sidebar-footer {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    margin-top: auto;
}

/* Header */
.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg) var(--spacing-xl);
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .card {
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
}

.glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-secondary) 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    filter: brightness(1.1);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.icon-btn, .theme-toggle {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.icon-btn:hover, .theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--accent);
    transform: translateY(-2px);
}

/* Nav Items */
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-normal);
}

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

.nav-item.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
    box-shadow: inset 4px 0 0 var(--accent);
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 280px;
    max-width: 400px;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--accent); }

.toast-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--accent); }

.toast-message {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
}

/* ========================================
   ANIMATIONS & EFFECTS
   ======================================== */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes ripple {
    0% { transform: scale(0.5); opacity: 0; }
    50% { opacity: 0.5; }
    100% { transform: scale(1.5); opacity: 0; }
}

@keyframes blink {
    from { opacity: 0.4; filter: drop-shadow(0 0 2px var(--accent)); }
    to { opacity: 1; filter: drop-shadow(0 0 8px var(--accent)); }
}

@keyframes pulse-glow {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ========================================
   MAYAK LOGO COMPONENTS
   ======================================== */
.mayak-logo-small {
    width: 32px;
    height: 32px;
    color: var(--accent);
    position: relative;
}

.mayak-logo-small .wave {
    transform-origin: center;
    animation: ripple 2s infinite ease-out;
    opacity: 0;
    stroke: currentColor;
}

.mayak-logo-small .wave-1 { animation-delay: 0s; }
.mayak-logo-small .wave-2 { animation-delay: 1s; }

.mayak-logo-small .tower { fill: currentColor; }
.mayak-logo-small .beacon {
    animation: blink 1.5s infinite alternate;
}

.mayak-logo-large {
    width: 120px;
    height: 120px;
    margin: 0 auto;
    color: var(--accent);
    animation: float 3s ease-in-out infinite;
}

.mayak-logo-large .wave {
    transform-origin: center;
    animation: ripple 3s infinite cubic-bezier(0.4, 0, 0.6, 1);
    opacity: 0;
    stroke: currentColor;
}

.mayak-logo-large .wave-1 { animation-delay: 0s; }
.mayak-logo-large .wave-2 { animation-delay: 1s; }
.mayak-logo-large .wave-3 { animation-delay: 2s; }

.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-small { font-size: 14px; }
.text-large { font-size: var(--font-size-lg); }

/* ========================================
   TABLES
   ======================================== */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

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

thead {
    background: rgba(255, 255, 255, 0.03);
}

th {
    padding: 14px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-primary);
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

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

/* ========================================
   BADGES
   ======================================== */
.badge {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    background: var(--accent);
    color: white;
    margin-left: auto;
}

/* ========================================
   CONTENT LAYOUT
   ======================================== */
.content-wrapper {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.content-wrapper .card {
    max-width: 100%;
    box-sizing: border-box;
}

.card-mt {
    margin-top: 24px;
}

/* ========================================
   FILTERS
   ======================================== */
.filter-section {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 150px;
}

.filter-group-large {
    flex: 2 !important;
}

.filter-group label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.filter-icon {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

.filter-input {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s;
    width: 100%;
}

.filter-input.with-icon {
    padding-left: 40px;
}

.filter-input:focus {
    border-color: var(--accent);
    outline: none;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.filter-input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

select.filter-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

select.filter-input.with-icon {
    background-position: right 12px center;
    padding-left: 40px;
}

/* ========================================
   PAGINATION
   ======================================== */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.pagination-info {
    font-size: 14px;
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    gap: 8px;
}

/* ========================================
   EMPTY STATE
   ======================================== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: var(--text-muted);
    opacity: 0.5;
}

.empty-state-text {
    font-size: 16px;
    margin-bottom: 8px;
}

.empty-state-subtext {
    font-size: 14px;
    opacity: 0.7;
}

/* ========================================
   LOADING
   ======================================== */
.loading-cell {
    text-align: center;
    padding: 48px 24px;
}

.loading-cell .spinner {
    margin: 0 auto 16px;
}

/* ========================================
   TABLE CELL STYLES
   ======================================== */
.th-narrow {
    width: 60px;
}

.th-time {
    width: 160px;
}

.th-action {
    width: 120px;
}

.th-ip {
    width: 130px;
}

.td-time {
    display: flex;
    align-items: center;
    gap: 8px;
}

.td-time i {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.td-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
}

.user-name {
    font-weight: 500;
}

.ip-code {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* ========================================
   ACTION BADGES
   ======================================== */
.action-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.action-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.action-badge.action-login {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.action-badge.action-login::before {
    background: var(--success);
}

.action-badge.action-create {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent);
}

.action-badge.action-create::before {
    background: var(--accent);
}

.action-badge.action-update {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.action-badge.action-update::before {
    background: var(--warning);
}

.action-badge.action-delete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.action-badge.action-delete::before {
    background: var(--danger);
}

/* ========================================
   RESPONSIVE DESIGN (Core Breakpoints)
   ======================================== */

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 0px; /* Hide sidebar by default on tablets */
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
        width: 280px;
    }
    
    .main-content {
        margin-left: 0 !important;
    }
}

@media (max-width: 768px) {
    .main-header {
        padding: var(--spacing-md);
    }
    
    .card {
        padding: var(--spacing-md);
        border-radius: var(--radius-xl);
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    :root {
        --font-size-base: 14px;
    }
    
    .page-title {
        font-size: var(--font-size-lg);
    }
}

/* Sidebar Overlay for mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

