:root {
    --bg-dark: #0f172a;
    --card-bg: rgba(15, 23, 42, 0.9);
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --text-main: #f1f5f9;
    --text-muted: #cbd5e1;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(30, 41, 59, 0.8);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: 'Inter', 'Montserrat', -apple-system, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Override Bootstrap dark text (#212529) globally */
body p, body span, body small, body div, body label, body li, body td, body th,
body h1, body h2, body h3, body h4, body h5, body h6 {
    color: var(--text-main) !important;
}

body .text-muted {
    color: var(--text-muted) !important;
}

body small.text-muted {
    color: #94a3b8 !important;
}

/* Glassmorphism utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
}

/* Navbar */
.navbar {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    color: var(--text-main) !important;
}

.navbar-brand {
    font-size: 1.5rem;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #3b82f6, #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.navbar-nav .nav-link {
    color: var(--text-muted);
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: var(--transition);
}

.navbar-nav .nav-link:hover {
    color: var(--text-main);
}

/* Cards */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: var(--transition);
    color: var(--text-main) !important;
}

.card p, .card span, .card small, .card div, .card label, .card li,
.card h1, .card h2, .card h3, .card h4, .card h5, .card h6 {
    color: var(--text-main) !important;
}

.card .text-muted {
    color: var(--text-muted) !important;
}

.card .form-text {
    color: #94a3b8 !important;
}

.card:hover {
    border-color: rgba(59, 130, 246, 0.3);
}

/* Buttons */
.btn {
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border: none;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.4);
}

/* Form Controls */
.form-control, .form-select {
    background: rgba(51, 65, 85, 0.5);
    border: 1px solid var(--border-color);
    color: white;
    border-radius: 12px;
    padding: 0.8rem 1rem;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    background: rgba(51, 65, 85, 0.8);
    border-color: var(--accent-blue);
    color: white;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.input-group-text {
    background: rgba(51, 65, 85, 0.3);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 12px 0 0 12px;
}

.form-label {
    color: #e2e8f0 !important;
}

.form-text {
    color: #94a3b8 !important;
}

/* Auth Pages */
.auth-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    max-width: 440px;
    width: 100%;
    padding: 3rem;
}

.logo-text {
    font-size: 2.5rem;
    font-weight: 900;
    text-align: center;
    margin-bottom: 0.5rem;
    background: linear-gradient(to bottom right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Dashboard */
.skin-preview-card {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 24px;
    overflow: hidden;
}

#skin-container {
    background: radial-gradient(circle, #1e293b 0%, #0f172a 100%);
    position: relative;
}

#skin-container::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.8), transparent);
    pointer-events: none;
}

.sidebar-item {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 1rem 1.2rem;
    margin-bottom: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
}

.sidebar-item span.text-muted {
    color: #cbd5e1 !important;
    font-weight: 500;
}

.sidebar-item span.fw-bold, 
.sidebar-item code,
.sidebar-item .stat-val {
    color: #f1f5f9 !important;
}

.sidebar-item .text-primary {
    color: var(--accent-blue) !important;
}

.sidebar-item small.text-muted {
    color: #94a3b8 !important;
}

.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Lang Switcher */
.lang-switcher .btn {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
}

.lang-switcher .btn.active {
    color: var(--accent-blue);
    font-weight: 700;
}

/* Text Colors */
.text-muted {
    color: var(--text-muted) !important;
}

small.text-muted {
    color: #94a3b8 !important;
}

.text-danger {
    color: #ff6b6b !important;
}

.text-success {
    color: #51cf66 !important;
}

.text-primary {
    color: #60a5fa !important;
}

/* Alerts */
.alert {
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.alert-danger {
    background: rgba(220, 38, 38, 0.15) !important;
    color: #fca5a5 !important;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15) !important;
    color: #6ee7b7 !important;
}

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

.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

/* Password Strength */
.password-strength .progress {
    background: rgba(51, 65, 85, 0.5);
}

.password-strength .progress-bar {
    transition: width 0.3s ease, background-color 0.3s ease;
}

/* Dropdown Menu */
.dropdown-menu {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.dropdown-item {
    color: var(--text-main) !important;
    transition: var(--transition);
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white !important;
}

.dropdown-divider {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Pagination */
.pagination .page-link {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    transition: var(--transition);
}

.pagination .page-link:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--accent-blue);
}

.pagination .page-item.active .page-link {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* Rules Page */
.rules-content .rule-item {
    padding: 1.5rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
}

.rules-content .rule-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(59, 130, 246, 0.2);
    transform: translateX(5px);
}

.rules-content p {
    color: var(--text-muted) !important;
}

.rules-content h5 {
    color: var(--text-main) !important;
}

/* News content */
.card .text-light {
    color: #e2e8f0 !important;
}

/* File Input Styling */
input[type="file"]::file-selector-button {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

input[type="file"]::file-selector-button:hover {
    background: #2563eb;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Responsive Improvements */
@media (max-width: 768px) {
    .auth-card {
        padding: 2rem;
    }
    
    .logo-text {
        font-size: 2rem;
    }
    
    .card {
        border-radius: 16px;
    }
    
    .btn {
        border-radius: 10px;
    }
    
    .navbar {
        padding: 0.75rem 0;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .main-content {
        padding: 20px !important;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
}

@media (max-width: 576px) {
    .auth-card {
        padding: 1.5rem;
    }
    
    .logo-text {
        font-size: 1.75rem;
    }
    
    .card {
        border-radius: 12px;
    }
    
    .btn {
        padding: 0.625rem 1rem;
    }
    
    .sidebar {
        position: relative !important;
        width: 100% !important;
        min-height: auto !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 15px !important;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for better accessibility */
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
a:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .navbar, footer, .btn, .dropdown, .sidebar {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .card {
        border: 1px solid #ccc !important;
        box-shadow: none !important;
    }
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Badge Improvements */
.badge {
    font-weight: 600;
    padding: 0.4em 0.8em;
}

/* Table Improvements */
.table {
    color: var(--text-main) !important;
}

.table td, .table th {
    color: var(--text-main) !important;
}

.table .text-muted {
    color: var(--text-muted) !important;
}

.table-hover tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Modal Improvements */
.modal-content.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-main);
}

.modal-content.glass * {
    color: inherit;
}

.modal-content.glass .text-muted {
    color: var(--text-muted) !important;
}

.modal-header .btn-close-white {
    filter: invert(1);
}

/* List Group */
.list-group-item {
    color: var(--text-main) !important;
}

/* Icon Box */
.icon-box {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Animation Buttons */
.anim-btn {
    transition: var(--transition);
}

.anim-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.anim-btn.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

/* Footer */
footer {
    color: var(--text-main) !important;
}
