/**
 * LOTTERY95 Main Stylesheet
 * Version: 4.2.0
 */

/* ===== CSS Variables ===== */
:root {
    /* Light Theme */
    --bg-primary: #e8eff5;
    --bg-secondary: #ffffff;
    --bg-sidebar: #2d3848;
    --bg-sidebar-hover: #000296;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-sidebar: #c8d4e0;
    --text-muted: #8599ad;
    --accent-primary: #0ea5e9;
    --accent-secondary: #0284c7;
    --border-color: #e2e8f0;
    --input-bg: #f8fafc;
    --input-border: #e2e8f0;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-sidebar: #0f0f23;
    --bg-sidebar-hover: #030325;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-sidebar: #ecf0f1;
    --text-muted: #7f8c8d;
    --border-color: #2c2c54;
    --input-bg: #2c2c54;
    --input-border: #3d3d6b;
}

/* ===== Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
}

body {
    font-family: 'Kantumruy Pro', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    width: 100% !important;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== Login Page ===== */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 50%, #0369a1 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.login-container {
    background: var(--bg-secondary);
    border-radius: 20px;
    box-shadow: var(--shadow);
    display: flex;
    max-width: 700px;
    width: 90%;
    padding: 40px;
    gap: 40px;
    align-items: center;
}

.login-logo {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-logo img {
    max-width: 180px;
    height: auto;
}

.login-form-container {
    flex: 1.2;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 25px;
    text-align: right;
}

.form-group {
    margin-bottom: 15px;
    position: relative;
}

.input-group {
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 5px;
    overflow: hidden;
}

.input-icon {
    padding: 12px 15px;
    color: var(--text-muted);
    background: var(--input-bg);
    border-right: 1px solid var(--input-border);
}

.input-group input {
    flex: 1;
    border: none;
    padding: 12px 15px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text-primary);
    outline: none;
}

.input-group input::placeholder {
    color: var(--text-muted);
}

.checkbox-group {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 20px;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checkbox-group label {
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--accent-primary);
    color: #ffffff;
    width: 100%;
}

.btn-primary:hover {
    background: var(--accent-secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(93, 173, 226, 0.4);
}

/* Login Background Decorations */
.login-decoration {
    position: absolute;
    bottom: 0;
    right: 0;
    pointer-events: none;
}

.login-decoration img {
    max-width: 400px;
    height: auto;
}

/* ===== Dashboard Layout ===== */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 225px;
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: all 0.3s ease;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.sidebar-header {
    padding: 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-brand {
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffffff;
}

.sidebar-logo {
    height: 32px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    vertical-align: middle;
}

.sidebar-version {
    font-size: 10px;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-sidebar);
    cursor: pointer;
    font-size: 16px;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    opacity: 1;
}

.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

.sidebar-menu {
    padding: 12px 0;
}

.menu-category {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 16px 16px 8px;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 11px 16px;
    color: var(--text-sidebar);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    font-size: 13px;
}

.menu-item:hover {
    background: var(--bg-sidebar-hover);
    color: #ffffff;
}

.menu-item.active {
    background: var(--bg-sidebar-hover);
    color: #ffffff;
}

.menu-item i {
    width: 20px;
    margin-right: 10px;
    font-size: 15px;
    transition: all 0.2s ease;
}

/* Colorful Menu Icons */
.menu-item i.ri-ticket-2-fill { color: #f97316; }
.menu-item i.ri-eye-fill { color: #22c55e; }
.menu-item i.ri-calendar-2-fill { color: #3b82f6; }
.menu-item i.ri-bar-chart-fill { color: #8b5cf6; }
.menu-item i.ri-file-text-fill { color: #ec4899; }
.menu-item i.ri-history-fill { color: #64748b; }
.menu-item i.ri-stack-fill { color: #f59e0b; }
.menu-item i.ri-pie-chart-fill { color: #06b6d4; }
.menu-item i.ri-file-copy-fill { color: #10b981; }
.menu-item i.ri-exchange-funds-fill { color: #22c55e; }
.menu-item i.ri-search-eye-fill { color: #0ea5e9; }
.menu-item i.ri-team-fill { color: #6366f1; }
.menu-item i.ri-settings-3-fill { color: #94a3b8; }
.menu-item i.ri-menu-line { color: #94a3b8; }
.menu-item i.ri-home-5-fill { color: #0ea5e9; }
.menu-item i.ri-coupon-fill { color: #a855f7; }
.menu-item i.ri-coupon-2-fill { color: #14b8a6; }
.menu-item i.ri-coupon-3-fill { color: #f43f5e; }
.menu-item i.ri-file-list-3-fill { color: #6366f1; }
.menu-item i.ri-trophy-fill { color: #eab308; }
.menu-item i.ri-wallet-3-fill { color: #22c55e; }
.menu-item i.ri-user-fill { color: #64748b; }

.menu-item:hover i {
    transform: scale(1.1);
}

.menu-item span {
    flex: 1;
    font-size: 13px;
}

.menu-item .submenu-arrow {
    font-size: 9px;
    transition: transform 0.3s ease;
    opacity: 0.6;
}

.menu-item.expanded .submenu-arrow {
    transform: rotate(90deg);
}

.submenu {
    display: none;
    background: rgba(0,0,0,0.15);
}

.submenu.show {
    display: block;
}

.submenu .menu-item {
    padding-left: 44px;
    font-size: 12px;
    color: var(--text-muted);
}

.submenu .menu-item:hover {
    color: #ffffff;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 225px;
    background: var(--bg-primary);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    width: 100% !important;
}

/* Sidebar Collapsed State */
.sidebar.collapsed {
    width: 60px;
}

.sidebar.collapsed .sidebar-brand,
.sidebar.collapsed .sidebar-logo,
.sidebar.collapsed .sidebar-version,
.sidebar.collapsed .menu-category,
.sidebar.collapsed .menu-item span,
.sidebar.collapsed .submenu-arrow {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 18px 8px;
}

.sidebar.collapsed .menu-item {
    justify-content: center;
    padding: 11px 8px;
}

.sidebar.collapsed .menu-item i {
    margin-right: 0;
    font-size: 18px;
}

.sidebar.collapsed .submenu {
    display: none !important;
}

.main-content.sidebar-collapsed {
    margin-left: 60px;
}

/* Top Bar */
.topbar {
    background: var(--bg-secondary);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.topbar-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.topbar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.topbar-breadcrumb a {
    color: var(--text-muted);
    transition: color 0.2s;
}

.topbar-breadcrumb a:hover {
    color: var(--accent-primary);
}

.topbar-breadcrumb i {
    font-size: 14px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-balance {
    font-size: 13px;
    color: var(--text-secondary);
    padding-right: 12px;
    border-right: 1px solid var(--border-color);
}

.topbar-balance strong {
    color: var(--text-primary);
    font-weight: 600;
}

.topbar-search {
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 13px;
    width: 200px;
    outline: none;
}

.topbar-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
    font-size: 18px;
}

.topbar-icon i.ri-search-line {
    color: #64748b;
}

.topbar-icon i.ri-settings-3-line {
    color: #64748b;
}

.topbar-icon i.ri-arrow-down-s-line {
    color: #94a3b8;
    font-size: 14px;
}

.topbar-icon:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.flag-icon {
    width: 24px;
    height: 18px;
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Language Dropdown */
.topbar-language {
    position: relative;
}

.language-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    min-width: 200px;
    display: none;
    z-index: 1000;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.language-dropdown.show {
    display: block;
    animation: dropdownSlide 0.2s ease;
}

@keyframes dropdownSlide {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.language-header {
    background: var(--bg-sidebar);
    color: #fff;
    padding: 14px 18px;
    font-weight: 600;
    font-size: 14px;
}

.language-menu {
    padding: 8px 0;
}

.language-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 18px;
    color: var(--text-primary);
    transition: all 0.2s ease;
    cursor: pointer;
}

.language-item:hover {
    background: var(--bg-primary);
}

.language-item.active {
    background: rgba(14, 165, 233, 0.1);
    color: var(--accent-primary);
}

.language-flag {
    width: 32px;
    height: 24px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    object-fit: cover;
}

.language-item span {
    font-size: 14px;
    font-weight: 500;
}

/* Settings Dropdown */
.topbar-settings {
    position: relative;
}

.settings-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 10px;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    min-width: 220px;
    display: none;
    z-index: 1000;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.settings-dropdown.show {
    display: block;
    animation: dropdownSlide 0.2s ease;
}

.settings-header {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.3);
}

.settings-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.settings-user-info {
    flex: 1;
}

.settings-username {
    display: block;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

.settings-role {
    display: block;
    color: rgba(255,255,255,0.8);
    font-size: 12px;
}

.settings-logout-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    transition: all 0.2s ease;
}

.settings-logout-btn:hover {
    background: rgba(255,255,255,0.3);
}

.settings-menu {
    padding: 8px 0;
}

.settings-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    transition: all 0.2s ease;
    font-size: 14px;
}

.settings-menu-item:hover {
    background: var(--bg-primary);
}

.settings-menu-item i {
    font-size: 18px;
    color: var(--text-muted);
    width: 24px;
}

.settings-menu-item.logout {
    color: #ef4444;
    border-top: 1px solid var(--border-color);
    margin-top: 4px;
    padding-top: 16px;
}

.settings-menu-item.logout i {
    color: #ef4444;
}

/* Search Overlay */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 100px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.search-overlay.show {
    opacity: 1;
    visibility: visible;
}

.search-modal {
    background: var(--bg-secondary);
    border-radius: 16px;
    width: 90%;
    max-width: 560px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    transform: translateY(-20px);
    transition: transform 0.2s ease;
    overflow: hidden;
}

.search-overlay.show .search-modal {
    transform: translateY(0);
}

.search-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
}

.search-header > i {
    font-size: 22px;
    color: rgba(255,255,255,0.8);
    margin-right: 12px;
}

.search-header input {
    flex: 1;
    border: none;
    background: rgba(255,255,255,0.15);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 15px;
    color: #fff;
    outline: none;
    font-family: inherit;
}

.search-header input::placeholder {
    color: rgba(255,255,255,0.6);
}

.search-close {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 12px;
    transition: background 0.2s ease;
}

.search-close:hover {
    background: rgba(255,255,255,0.3);
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px 0;
}

.search-category {
    padding: 8px 0;
}

.search-category-title {
    padding: 8px 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.search-item:hover {
    background: var(--bg-primary);
}

.search-item i {
    font-size: 20px;
    color: var(--accent-primary);
    width: 28px;
}

.search-item span {
    font-size: 14px;
}

.search-no-results {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.search-no-results i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* Content Area */
.content-area {
    padding: 24px;
}

.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.blue { background: #e3f2fd; color: #1976d2; }
.stat-icon.green { background: #e8f5e9; color: #388e3c; }
.stat-icon.orange { background: #fff3e0; color: #f57c00; }
.stat-icon.purple { background: #f3e5f5; color: #7b1fa2; }
.stat-icon.red { background: #ffebee; color: #c62828; }

.stat-info h3 {
    font-size: 24px;
    margin-bottom: 5px;
}

.stat-info p {
    font-size: 13px;
    color: var(--text-muted);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    background: #f8f9fa;
    font-size: 13px;
    color: var(--text-secondary);
}

.table tbody tr:hover {
    background: #f8f9fa;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-primary { background: #cce5ff; color: #004085; }

/* Forms */
.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(135, 206, 235, 0.2);
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
}

/* Buttons */
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-info { background: var(--info); color: white; }

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 15px 30px;
    font-size: 16px;
}

/* Home Content (Dashboard Logo) */
.home-content {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px);
    padding: 40px;
}

.home-logo {
    max-width: 380px;
    width: 100%;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.15));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Lottery Keypad */
.lottery-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 300px;
}

.keypad-btn {
    padding: 20px;
    font-size: 24px;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.keypad-btn:hover {
    background: var(--accent-primary);
    color: white;
}

.keypad-btn:active {
    transform: scale(0.95);
}

/* Group Buttons */
.group-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.group-btn {
    padding: 10px 20px;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.group-btn:hover,
.group-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* Bet Entry List */
.bet-entries {
    max-height: 300px;
    overflow-y: auto;
}

.bet-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
}

.bet-entry:last-child {
    border-bottom: none;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
    animation: modalFadeIn .25s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(24px) scale(.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    max-width: 500px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255,255,255,0.05);
    animation: modalSlideUp .3s cubic-bezier(.16,1,.3,1);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all .2s;
    line-height: 1;
}

.modal-close:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.modal-body {
    padding: 24px;
}

.modal-body .form-group {
    margin-bottom: 0;
}

.modal-body .form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.modal-body .form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--input-border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text-primary);
    transition: border-color .2s, box-shadow .2s;
    font-family: 'Kantumruy Pro', sans-serif;
}

.modal-body .form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
    
}

.modal-body select.form-control {
    appearance: auto;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--bg-primary);
    border-radius: 0 0 16px 16px;
}

.modal-footer .btn {
    padding: 9px 22px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all .2s;
}

.modal-footer .btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.modal-footer .btn-secondary:hover {
    background: var(--border-color);
}

.modal-footer .btn-primary {
    background: var(--accent-primary);
    color: #fff;
}

.modal-footer .btn-primary:hover {
    background: var(--accent-secondary);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.modal-footer .btn-success {
    background: var(--success);
    color: #fff;
}

.modal-footer .btn-success:hover {
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.modal-footer .btn-warning {
    background: var(--warning);
    color: #fff;
}

.modal-footer .btn-warning:hover {
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.mb-3 { margin-bottom: 16px; }

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* Mobile Hamburger */
.mobile-hamburger {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 999;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.show { display: block; }

/* Responsive - Tablet */
@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }
    .main-content {
        margin-left: 200px;
    }
    .sidebar.collapsed + .main-content,
    .main-content.sidebar-collapsed {
        margin-left: 60px;
    }
    .menu-item {
        padding: 10px 14px;
        font-size: 12px;
    }
    .menu-item i {
        font-size: 14px;
    }
    .menu-category {
        padding: 14px 14px 6px;
        font-size: 9px;
    }
    .submenu .menu-item {
        padding-left: 38px;
        font-size: 11px;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .mobile-hamburger { display: flex; align-items: center; }

    .sidebar {
        width: 0;
        overflow: hidden;
        z-index: 1001;
        transition: width 0.3s ease;
    }

    .sidebar.mobile-open {
        width: 260px;
        overflow-y: auto;
    }

    .main-content {
        margin-left: 0 !important;
    }

    /* Topbar */
    .topbar {
        padding: 8px 12px;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .topbar-left {
        min-width: 0;
        flex: 1;
        overflow: hidden;
    }

    .topbar-title {
        font-size: 14px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .topbar-breadcrumb {
        font-size: 10px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .topbar-balance {
        font-size: 11px;
        padding-right: 8px;
        white-space: nowrap;
    }

    .topbar-search {
        display: none;
    }

    .topbar-right {
        gap: 4px;
        flex-shrink: 0;
    }

    .topbar-icon {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }

    .flag-icon {
        width: 20px;
        height: 15px;
    }

    /* Content Area */
    .content-area {
        padding: 12px;
    }

    /* Cards */
    .card-body {
        padding: 12px;
    }

    .card-header {
        padding: 10px 12px;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
        gap: 10px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .stat-info h3 {
        font-size: 18px;
    }

    .stat-info p {
        font-size: 11px;
    }

    /* Tables */
    .table th,
    .table td {
        padding: 8px 10px;
        font-size: 12px;
    }

    /* Modals */
    .modal-content {
        width: 96%;
        max-height: 92vh;
        border-radius: 12px;
    }

    .modal-header {
        padding: 16px;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-footer {
        padding: 12px 16px;
    }

    /* Login */
    .login-container {
        flex-direction: column;
        padding: 30px;
    }
    
    .login-logo {
        margin-bottom: 20px;
    }

    /* Home Logo */
    .home-logo {
        max-width: 250px;
    }

    /* Form layouts */
    .form-row { flex-direction: column; align-items: stretch; }
    .form-label-col { width: 100%; text-align: left; padding-right: 0; padding-bottom: 4px; }
    .form-input-col { width: 100%; }

    /* Toolbar wraps */
    .toolbar-wrap { flex-direction: column; align-items: stretch; }
    .toolbar-left { flex-wrap: wrap; }
    .toolbar-right { flex-wrap: wrap; }

    /* Profile modal */
    .profile-modal .modal-content { max-width: 96%; }
    .profile-form-row { flex-direction: column; align-items: stretch; }
    .pf-label { width: 100%; margin-bottom: 4px; }

    /* Search overlay */
    .search-modal { width: 95%; max-width: none; }

    /* Sidebar menu touch-friendly */
    .sidebar .menu-item {
        padding: 12px 16px;
        font-size: 13px;
        min-height: 44px;
    }
    .sidebar .menu-item i {
        font-size: 16px;
        width: 22px;
        margin-right: 12px;
    }
    .sidebar .menu-category {
        padding: 16px 16px 8px;
        font-size: 10px;
    }
    .sidebar .submenu .menu-item {
        padding-left: 48px;
        font-size: 12px;
        min-height: 40px;
    }
    .sidebar-header {
        padding: 14px 16px;
    }
    .sidebar-brand {
        font-size: 14px;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar.mobile-open {
        width: 220px;
    }
    .sidebar .menu-item {
        padding: 8px 14px;
        font-size: 12px;
        min-height: 36px;
    }
    .sidebar .menu-category {
        padding: 10px 14px 4px;
        font-size: 9px;
    }
    .sidebar .submenu .menu-item {
        padding-left: 40px;
        font-size: 11px;
        min-height: 32px;
    }
    .sidebar-header {
        padding: 10px 14px;
    }
}

@media (max-width: 480px) {
    .topbar {
        padding: 6px 8px;
    }

    .topbar-title {
        font-size: 13px;
    }

    .topbar-breadcrumb {
        display: none;
    }

    .topbar-balance {
        display: none;
    }

    .topbar-right {
        gap: 2px;
    }

    .topbar-icon {
        width: 30px;
        height: 30px;
        font-size: 15px;
    }

    .mobile-hamburger {
        font-size: 20px;
        padding: 2px;
    }

    .content-area {
        padding: 8px;
    }

    .card-body {
        padding: 10px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .modal-content {
        width: 99%;
        border-radius: 10px;
    }

    .modal-header { padding: 12px; }
    .modal-body { padding: 12px; }
    .modal-footer { padding: 10px 12px; }

    .login-container {
        padding: 20px;
        width: 95%;
    }

    .home-logo {
        max-width: 200px;
    }

    /* Language/Settings dropdowns - bottom sheet style */
    .language-dropdown, .settings-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        margin-top: 0;
        border-radius: 16px 16px 0 0;
        min-width: 100%;
        max-height: 70vh;
        overflow-y: auto;
    }

    /* Table responsive */
    .table th,
    .table td {
        padding: 6px 8px;
        font-size: 11px;
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar.mobile-open {
        width: 240px;
    }
}

@media (max-width: 360px) {
    .topbar {
        padding: 5px 6px;
    }

    .topbar-title {
        font-size: 12px;
    }

    .topbar-icon {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .topbar-right {
        gap: 1px;
    }

    .content-area {
        padding: 6px;
    }

    .flag-icon {
        width: 18px;
        height: 13px;
    }

    .sidebar.mobile-open {
        width: 220px;
    }
    .sidebar .menu-item {
        padding: 10px 12px;
        font-size: 12px;
        min-height: 40px;
    }
    .sidebar .menu-item i {
        font-size: 14px;
        width: 20px;
        margin-right: 10px;
    }
    .sidebar .submenu .menu-item {
        padding-left: 40px;
        font-size: 11px;
    }
    .sidebar-brand {
        font-size: 13px;
    }
}

@media (max-width: 320px) {
    .sidebar.mobile-open {
        width: 200px;
    }
    .sidebar .menu-item {
        padding: 9px 10px;
        font-size: 11px;
        min-height: 36px;
    }
    .sidebar .menu-item i {
        font-size: 13px;
        width: 18px;
        margin-right: 8px;
    }
    .sidebar .submenu .menu-item {
        padding-left: 34px;
        font-size: 10px;
    }
    .sidebar-header {
        padding: 10px;
    }
    .sidebar-brand {
        font-size: 12px;
    }
    .menu-category {
        padding: 12px 10px 4px;
        font-size: 9px;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }

.mb-1 { margin-bottom: 5px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 15px; }
.mb-4 { margin-bottom: 20px; }
.mt-1 { margin-top: 5px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 15px; }
.mt-4 { margin-top: 20px; }

.p-2 { padding: 10px; }
.p-3 { padding: 15px; }
.p-4 { padding: 20px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 10px; }
.gap-3 { gap: 15px; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }
