@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
    --gemini-gradient: linear-gradient(101deg, #1b6ef3, #8c52ff, #ff5c9d);
    --primary-color: #3730a3;
    --primary-hover: #312e81;
    --secondary-color: #64748b;
    --accent-color: #8c52ff;
    --success-color: #10b981;
    --info-color: #3b82f6;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;

    --font-main: 'Inter', sans-serif;
    --font-heading: 'Poppins', sans-serif;

    --nav-height: 70px;
    --sidebar-width: 260px;

    --transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 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.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

[data-bs-theme="light"] {
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-nav: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --input-bg: #ffffff;
}

[data-bs-theme="dark"] {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-nav: #0f172a;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --input-bg: #1e293b;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: var(--transition-base);
    min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 600;
}

/* Gemini Gradient Text with Continuous Animation */
.text-gemini {
    background: var(--gemini-gradient);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    animation: geminiFlow 6s ease infinite;
}

@keyframes geminiFlow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.bg-gemini {
    background: var(--gemini-gradient);
}

/* Navbar Improvements */
.navbar {
    height: var(--nav-height);
    /* Stable height to prevent shifts */
    background-color: var(--bg-nav) !important;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.navbar-brand {
    font-size: 1.5rem;
    letter-spacing: -0.5px;
}

/* Card Redesign */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem;
}

/* Button Styling */
.btn {
    border-radius: 0.5rem;
    padding: 0.6rem 1.25rem;
    font-weight: 500;
    transition: var(--transition-base);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
}

/* Form Controls */
.form-control,
.form-select {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 0.5rem;
    padding: 0.6rem 1rem;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--input-bg);
    color: var(--text-main);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* Admin Sidebar */
#sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-nav);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: var(--nav-height);
    bottom: 0;
    left: 0;
    z-index: 100;
    overflow-y: auto;
    /* Only transition left property to avoid jumpy feeling on other properties on load */
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#main-content {
    padding: 2rem;
    flex: 1;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Removed fadeInPage to ensure immediate appearance as per user request */
}

.has-sidebar #main-content {
    margin-left: var(--sidebar-width);
}

.footer {
    background-color: var(--bg-nav);
    border-top: 1px solid var(--border-color);
    transition: margin-left 0.3s ease;
    z-index: 10;
}

.has-sidebar .footer {
    margin-left: var(--sidebar-width);
}

/* Removed slideUp animation to fix "missing menu" and delayed appearance issues */

/* Mobile Responsiveness */
@media (max-width: 991.98px) {
    #sidebar {
        left: calc(-1 * var(--sidebar-width));
    }

    #sidebar.show {
        left: 0;
    }

    .has-sidebar #main-content,
    .has-sidebar .footer {
        margin-left: 0;
    }

    .navbar-collapse {
        background-color: var(--bg-nav);
        padding: 1rem;
        border-radius: 0.75rem;
        margin-top: 0.5rem;
        border: 1px solid var(--border-color);
        box-shadow: var(--shadow-lg);
    }
}

/* Custom Alert Styles */
.alert {
    border-radius: 1rem;
    border: none;
    box-shadow: var(--shadow-sm);
}

/* Utilities */
.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .glass-effect {
    background: rgba(15, 23, 42, 0.6);
}


.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.border-dashed {
    border-style: dashed !important;
}

.bg-primary-subtle {
    background-color: rgba(79, 70, 229, 0.1) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

[data-bs-theme="dark"] .text-primary {
    color: #818cf8 !important;
}

.bg-info-subtle {
    background-color: rgba(59, 130, 246, 0.1) !important;
}

.text-info {
    color: var(--info-color) !important;
}

.bg-secondary-subtle {
    background-color: rgba(100, 116, 139, 0.1) !important;
}

.text-secondary {
    color: var(--secondary-color) !important;
}

.game-info-card {
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.game-info-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg) !important;
}

/* Micro-interactions */
.hover-lift {
    transition: var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-4px);
}

.hover-glow {
    transition: var(--transition-base);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.4) !important;
}

.btn,
.form-control,
.form-select,
.card {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:active {
    transform: scale(0.96);
}

.nav-link {
    transition: color 0.2s ease, background-color 0.2s ease;
}

html {
    scroll-behavior: smooth;
}

/* Page entrance animations */
.animate-in {
    animation: slideUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Reduced slideUp animation impact */
@keyframes slideUp {
    from {
        opacity: 0.8;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* Responsive Tables for CKEditor Content */
.table-responsive-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 1rem 0;
}

/* Style tables in modal and game details */
#modalGameRules table,
.border.rounded.p-3 table,
.border.rounded-3.p-3 table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

#modalGameRules table td,
#modalGameRules table th,
.border.rounded.p-3 table td,
.border.rounded.p-3 table th,
.border.rounded-3.p-3 table td,
.border.rounded-3.p-3 table th {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
}

#modalGameRules table th,
.border.rounded.p-3 table th,
.border.rounded-3.p-3 table th {
    background-color: var(--bg-body);
    font-weight: 600;
    color: var(--text-main);
}

/* Mobile responsive tables */
@media (max-width: 768px) {

    #modalGameRules table,
    .border.rounded.p-3 table,
    .border.rounded-3.p-3 table {
        font-size: 0.8rem;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    #modalGameRules table td,
    #modalGameRules table th,
    .border.rounded.p-3 table td,
    .border.rounded.p-3 table th,
    .border.rounded-3.p-3 table td,
    .border.rounded-3.p-3 table th {
        padding: 6px 8px;
        min-width: 100px;
    }
}

/* Alternative: Stack table cells vertically on very small screens */
@media (max-width: 480px) {

    #modalGameRules table,
    .border.rounded.p-3 table,
    .border.rounded-3.p-3 table {
        border: 0;
    }

    #modalGameRules table thead,
    .border.rounded.p-3 table thead,
    .border.rounded-3.p-3 table thead {
        border: none;
        clip: rect(0 0 0 0);
        height: 1px;
        margin: -1px;
        overflow: hidden;
        padding: 0;
        position: absolute;
        width: 1px;
    }

    #modalGameRules table tr,
    .border.rounded.p-3 table tr,
    .border.rounded-3.p-3 table tr {
        border: 1px solid var(--border-color);
        display: block;
        margin-bottom: 0.625rem;
        padding: 0.5rem;
        border-radius: 0.375rem;
    }

    #modalGameRules table td,
    .border.rounded.p-3 table td,
    .border.rounded-3.p-3 table td {
        border: none;
        display: block;
        font-size: 0.8rem;
        text-align: right;
        padding: 0.25rem 0;
        min-width: auto;
    }

    #modalGameRules table td:before,
    .border.rounded.p-3 table td:before,
    .border.rounded-3.p-3 table td:before {
        content: attr(data-label) ": ";
        float: left;
        font-weight: bold;
        text-transform: uppercase;
        font-size: 0.75rem;
        color: var(--text-muted);
    }
}

/* Ensure tables don't break modal layout */
.modal-body {
    overflow-x: hidden;
}

.modal-body table {
    max-width: 100%;
}

/* Accessible contrasts */
.text-muted {
    color: var(--text-muted) !important;
}

[data-bs-theme="dark"] .text-muted {
    color: #94a3b8 !important;
}

/* Quick Management Buttons Dark Mode */
[data-bs-theme="dark"] .btn-light.bg-body-tertiary {
    background-color: #1e293b !important;
    color: #f1f5f9 !important;
    border: 1px solid #334155 !important;
}

[data-bs-theme="dark"] .btn-light.bg-body-tertiary:hover {
    background-color: #334155 !important;
}

/* Payment Info Box Dark Mode and general info panels using bg-light */
[data-bs-theme="dark"] .bg-light:not(.navbar, .btn, .card, .dropdown-menu) {
    background-color: #1e293b !important;
    border: 1px solid #334155 !important;
}

[data-bs-theme="dark"] .bg-light:not(.navbar, .btn, .card, .dropdown-menu) .fw-bold:not(.text-success, .text-warning, .text-danger, .text-primary, .text-info) {
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .bg-light:not(.navbar, .btn, .card, .dropdown-menu) .text-muted {
    color: #94a3b8 !important;
}

.btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Wizard Stepper */
.stepper {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3rem;
    position: relative;
}

.stepper::before {
    content: "";
    position: absolute;
    top: 24px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--border-color);
    z-index: 0;
}

.step {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 25%;
}

.step-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--bg-card);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-bottom: 0.5rem;
    transition: var(--transition-base);
    color: var(--text-muted);
}

.step.active .step-icon {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: white;
}

.step.completed .step-icon {
    border-color: var(--success-color);
    background-color: var(--success-color);
    color: white;
}

.step-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.step.active .step-label {
    color: var(--primary-color);
}

.bg-danger-subtle {
    background-color: rgba(239, 68, 68, 0.1) !important;
}

.bg-warning-subtle {
    background-color: rgba(245, 158, 11, 0.1) !important;
}