@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #0D9488;       /* Kazakh Teal */
    --primary-light: #14B8A6;
    --primary-glow: rgba(13, 148, 136, 0.15);
    --secondary: #D97706;     /* Golden Sun Amber */
    --secondary-light: #F59E0B;
    
    /* Dark Theme (Default) */
    --bg-main: #090D16;
    --bg-sidebar: #0F1424;
    --bg-card: #151C2F;
    --bg-card-hover: #1B243B;
    --border-color: rgba(255, 255, 255, 0.06);
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    
    --success: #10B981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #F59E0B;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #EF4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
    
    --font-sans: 'Outfit', 'Inter', sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme overrides */
.theme-light {
    --bg-main: #F8FAFC;
    --bg-sidebar: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F1F5F9;
    --border-color: rgba(0, 0, 0, 0.06);
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --primary-glow: rgba(13, 148, 136, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.05), 0 4px 6px -2px rgba(15, 23, 42, 0.02);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    transition: background-color var(--transition-normal), color var(--transition-normal);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* General Layout Structure */
.app-container {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-main);
    color: var(--text-primary);
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.main-content {
    flex: 1;
    margin-left: 280px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 32px;
}

/* Logo and Brand styling */
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}
.brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #FFFFFF;
    font-size: 1.25rem;
    box-shadow: 0 0 15px var(--primary-glow);
}
.brand-name {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Role Selector inside Sidebar */
.role-container {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-top: auto;
}
.role-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}
.role-select {
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    outline: none;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.875rem;
}

/* Topbar Header */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}
.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.user-menu {
    display: flex;
    align-items: center;
    gap: 16px;
}
.theme-toggle {
    background: none;
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}
.theme-toggle:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--text-muted);
}
.badge-role {
    background-color: var(--primary-glow);
    border: 1px solid var(--primary);
    color: var(--primary-light);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.8125rem;
    font-weight: 600;
}

/* Navigation Menu */
.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}
.nav-link:hover {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
}
.nav-link.active {
    background-color: var(--primary);
    color: #FFFFFF;
    box-shadow: 0 4px 12px var(--primary-glow);
}

/* Premium Dashboard Widgets */
.widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}
.widget-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}
.widget-card:hover {
    transform: translateY(-2px);
    border-color: rgba(13, 148, 136, 0.3);
}
.widget-glow {
    position: absolute;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    top: -50px;
    right: -50px;
    pointer-events: none;
}
.widget-title {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.widget-value {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1;
}

/* Tables and Lists */
.data-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 32px;
}
.data-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.premium-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}
.premium-table th {
    padding: 16px;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}
.premium-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9375rem;
    color: var(--text-secondary);
}
.premium-table tr {
    transition: var(--transition-fast);
}
.premium-table tr:hover td {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
}

/* Status Pills */
.badge-status {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.status-draft {
    background-color: var(--border-color);
    color: var(--text-muted);
}
.status-review {
    background-color: var(--warning-bg);
    color: var(--warning);
}
.status-action {
    background-color: var(--danger-bg);
    color: var(--danger);
}
.status-approved {
    background-color: var(--success-bg);
    color: var(--success);
}
.status-rejected {
    background-color: var(--danger-bg);
    color: var(--danger);
}

/* UI Elements & Buttons */
.btn-premium {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #FFFFFF;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--primary-glow);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
    text-decoration: none;
}
.btn-premium:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--primary-glow);
}
.btn-premium:active {
    transform: translateY(0);
}
.btn-premium:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.btn-secondary {
    background: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
    text-decoration: none;
}
.btn-secondary:hover {
    background-color: var(--border-color);
    border-color: var(--text-secondary);
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.form-input {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-input:disabled {
    background-color: rgba(0, 0, 0, 0.25);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Wizard Steps Indicator */
.wizard-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    position: relative;
}
.wizard-steps::before {
    content: '';
    position: absolute;
    height: 2px;
    background-color: var(--border-color);
    top: 20px;
    left: 40px;
    right: 40px;
    z-index: 1;
}
.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
    width: 120px;
}
.wizard-step-circle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background-color: var(--bg-card);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 8px;
    transition: var(--transition-normal);
}
.wizard-step-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    transition: var(--transition-normal);
}
.wizard-step.active .wizard-step-circle {
    border-color: var(--primary);
    background-color: var(--bg-main);
    color: var(--primary-light);
    box-shadow: 0 0 15px var(--primary-glow);
}
.wizard-step.active .wizard-step-title {
    color: var(--text-primary);
}
.wizard-step.completed .wizard-step-circle {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #FFFFFF;
}
.wizard-step.completed .wizard-step-title {
    color: var(--primary-light);
}

/* File Upload drag-and-drop simulated component */
.upload-zone {
    border: 2px dashed var(--border-color);
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-lg);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-fast);
}
.upload-zone:hover {
    border-color: var(--primary);
    background-color: var(--primary-glow);
}
.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin: 0 auto 16px auto;
}
.upload-title {
    font-weight: 600;
    margin-bottom: 6px;
}
.upload-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Chat & Comments UI */
.chat-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 400px;
    overflow-y: auto;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background-color: rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}
.chat-bubble {
    max-width: 80%;
    padding: 16px;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    line-height: 1.5;
}
.chat-inspector {
    align-self: flex-start;
    background-color: var(--bg-card-hover);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
}
.chat-importer {
    align-self: flex-end;
    background-color: var(--primary-glow);
    border-bottom-right-radius: 4px;
    border: 1px solid rgba(13, 148, 136, 0.3);
}
.chat-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
}

/* Timeline/Stepper vertical */
.timeline {
    position: relative;
    padding-left: 32px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background-color: var(--border-color);
}
.timeline-item {
    position: relative;
    margin-bottom: 24px;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -32px;
    top: 6px;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    background-color: var(--bg-card);
    border: 2px solid var(--border-color);
}
.timeline-item.active::before {
    border-color: var(--primary);
    background-color: var(--primary-glow);
}
.timeline-item.completed::before {
    background-color: var(--primary);
    border-color: var(--primary);
}
.timeline-title {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.timeline-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Official Kazakh Certificate replication */
.certificate-frame {
    background-color: #FFFFFF;
    color: #000000;
    border: 10px double #0D9488;
    padding: 40px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-family: 'Inter', sans-serif;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}
.cert-header {
    text-align: center;
    border-bottom: 2px solid #0D9488;
    padding-bottom: 20px;
    margin-bottom: 24px;
}
.cert-emblem {
    width: 80px;
    height: 80px;
    margin: 0 auto 12px auto;
    background: radial-gradient(circle, #D97706 0%, #B45309 100%);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-weight: bold;
    font-size: 0.75rem;
    text-align: center;
    padding: 5px;
    box-shadow: 0 0 10px rgba(217, 119, 6, 0.4);
}
.cert-title-kk {
    font-size: 0.9375rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.cert-title-ru {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #334155;
    margin-top: 4px;
}
.cert-body {
    font-size: 0.875rem;
    line-height: 1.6;
}
.cert-row {
    margin-bottom: 12px;
    display: flex;
}
.cert-label {
    width: 240px;
    font-weight: 700;
    color: #1E293B;
}
.cert-val {
    flex: 1;
    color: #334155;
}
.cert-footer {
    margin-top: 40px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-top: 1px solid #E2E8F0;
    padding-top: 24px;
}
.cert-stamp {
    width: 110px;
    height: 110px;
    border: 3px double #EF4444;
    border-radius: var(--radius-full);
    color: #EF4444;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 800;
    text-transform: uppercase;
    text-align: center;
    padding: 8px;
    transform: rotate(-10deg);
    opacity: 0.8;
}
.cert-qr {
    width: 100px;
    height: 100px;
    border: 1px solid #CBD5E1;
    padding: 4px;
    background-color: #FFFFFF;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.animate-fade-up {
    animation: fadeInUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.diff-container {
    background: #090D16;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    font-family: monospace;
    font-size: 0.875rem;
    max-height: 200px;
    overflow-y: auto;
}
.diff-row {
    display: flex;
    margin-bottom: 4px;
}
.diff-prop {
    width: 160px;
    color: var(--text-muted);
}
.diff-val-old {
    color: var(--danger);
    background-color: var(--danger-bg);
    padding: 0 4px;
    border-radius: 4px;
    margin-right: 8px;
    text-decoration: line-through;
}
.diff-val-new {
    color: var(--success);
    background-color: var(--success-bg);
    padding: 0 4px;
    border-radius: 4px;
}

/* Blazor Error UI Toast - Hidden by default, styled for dark/light premium themes */
#blazor-error-ui {
    background-color: rgba(21, 28, 47, 0.9) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-primary) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding: 16px 24px !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    z-index: 9999 !important;
    display: none; /* Hidden by default! */
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5) !important;
    font-weight: 500;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-sans);
}

.theme-light #blazor-error-ui {
    background-color: rgba(255, 255, 255, 0.9) !important;
    color: var(--text-primary) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.08) !important;
}

#blazor-error-ui.show {
    display: flex !important;
}

#blazor-error-ui .reload {
    color: var(--primary-light) !important;
    font-weight: 600;
    text-decoration: none;
    margin-left: 12px;
    padding: 6px 12px;
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    background-color: var(--primary-glow);
    transition: var(--transition-fast);
}

#blazor-error-ui .reload:hover {
    background-color: var(--primary);
    color: #FFFFFF !important;
}

#blazor-error-ui .dismiss {
    color: var(--text-muted) !important;
    cursor: pointer;
    font-weight: 700;
    font-size: 1.25rem;
    transition: var(--transition-fast);
    padding: 4px 8px;
}

#blazor-error-ui .dismiss:hover {
    color: var(--text-primary) !important;
}

/* Language Selector styles */
.lang-selector {
    position: relative;
    display: inline-block;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 600;
    transition: all 0.2s ease;
    user-select: none;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.theme-light .lang-btn {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
}

.theme-light .lang-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.15);
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: rgba(26, 27, 30, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    min-width: 120px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.theme-light .lang-dropdown {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.lang-option {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    text-align: left;
    transition: all 0.15s ease;
    width: 100%;
}

.lang-option:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.theme-light .lang-option:hover {
    background: rgba(0, 0, 0, 0.04);
}

.lang-option.active {
    background: var(--primary);
    color: white !important;
}