/* TycoSim Global Styles V1.3 - Premium Dark */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons+Round');
@import url('custom-select.css');

:root {
    /* Colors - Premium Dark Theme */
    --bg-dark: #050505;
    /* Deep Black */
    --bg-surface: #0F0F0F;
    /* Slightly lighter for contrasts if needed */
    --bg-card: rgba(255, 255, 255, 0.03);
    /* Glass Effect */

    --primary: #FFD700;
    /* Premium Gold */
    --primary-rgb: 255, 215, 0;
    --primary-hover: #FFED4D;
    --primary-dim: rgba(255, 215, 0, 0.15);
    --primary-glow: rgba(255, 215, 0, 0.3);

    --text-main: #ffffff;
    --text-muted: #888888;

    --success: #4caf50;
    --danger: #f44336;
    --warning: #ff9800;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-radius: 12px;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    /* Ambient Background Texture */
    background-image: radial-gradient(circle at 50% 0%, rgba(255, 215, 0, 0.03) 0%, transparent 60%);
    background-attachment: fixed;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-main);
    margin-bottom: var(--spacing-sm);
    font-weight: 700;
    letter-spacing: -0.5px;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.2s;
}

a:hover {
    color: var(--primary-hover);
    text-shadow: 0 0 10px var(--primary-dim);
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-md);
}

.grid {
    display: grid;
    gap: var(--spacing-md);
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* Components: Cards (Glassmorphism) */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 215, 0, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 6px;
    /* Slightly sharper than cards */
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.btn-primary {
    background-color: var(--primary);
    color: #000;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.4);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background-color: var(--primary-dim);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.1);
}

.btn-danger {
    background-color: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}

.btn-danger:hover {
    background-color: rgba(244, 67, 54, 0.1);
    box-shadow: 0 0 10px rgba(244, 67, 54, 0.2);
}

.btn-small {
    padding: 5px 12px;
    font-size: 0.85rem;
}

/* Forms & Inputs */
.input-group {
    margin-bottom: var(--spacing-md);
}

.input-group label {
    display: block;
    margin-bottom: var(--spacing-xs);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 12px;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-main);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-dim);
}

/* Navbar (In-Game) */
.navbar {
    background-color: rgba(5, 5, 5, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-md) 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    /* Increased z-index */
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
    text-decoration: none;
}

.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-menu {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    margin-left: var(--spacing-xl);
}

.nav-links {
    display: flex;
    gap: var(--spacing-sm);
}

.nav-link {
    color: var(--text-muted);
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s;
    text-decoration: none;
}

.nav-link:hover,
.nav-link.active {
    color: #000;
    background-color: var(--primary);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

/* Stats Bar in Navbar */
.nav-stats {
    display: flex;
    gap: var(--spacing-md);
    font-size: 0.9rem;
    color: var(--text-muted);
    background-color: rgba(255, 255, 255, 0.05);
    /* Slight highlight */
    padding: 6px 16px;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    align-items: center;
}

.stat-value {
    color: var(--text-main);
    font-weight: 600;
    font-family: monospace;
    /* Tabular nums */
}

/* Auth Page overrides */
.auth-container {
    max-width: 420px;
    margin: 100px auto;
}

.auth-card {
    background-color: var(--bg-card);
    backdrop-filter: blur(16px);
    padding: 40px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.auth-title {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary);
    font-size: 2rem;
    font-weight: 700;
}

/* Roadmap Details Styling */
.roadmap-details {
    margin-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 10px;
}

.roadmap-details summary {
    cursor: pointer;
    color: var(--primary);
    font-size: 0.9em;
    font-weight: 500;
    margin-bottom: 5px;
    user-select: none;
    outline: none;
}

.roadmap-details summary:hover {
    text-decoration: underline;
}

.roadmap-details ul {
    list-style: none;
    padding-left: 10px;
    margin-top: 5px;
}

.roadmap-details li {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 4px;
    position: relative;
    padding-left: 15px;
}

.roadmap-details li::before {
    content: "•";
    color: var(--primary);
    position: absolute;
    left: 0;
}

.roadmap-details strong {
    color: #dedede;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background-color: #0F0F0F;
    /* Solid background for modal content readability */
    padding: var(--spacing-lg);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 550px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--spacing-md);
}

/* Confirmation Dialog (Missing in V1.0) */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2500;
    /* Higher than toast */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.confirm-overlay.confirm-show {
    opacity: 1;
    pointer-events: all;
}

.confirm-overlay.confirm-hide {
    opacity: 0;
    pointer-events: none;
}

.confirm-dialog {
    background-color: #0F0F0F;
    padding: var(--spacing-lg);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.confirm-overlay.confirm-show .confirm-dialog {
    transform: scale(1);
}

.confirm-message {
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: var(--spacing-lg);
    text-align: center;
    line-height: 1.5;
}

.confirm-buttons {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
}

.confirm-buttons .btn {
    min-width: 100px;
}

/* Utilities */
.text-primary {
    color: var(--primary);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

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

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.flex {
    display: flex;
}

.flex-between {
    justify-content: space-between;
}

.flex-center {
    justify-content: center;
    align-items: center;
}

.gap-sm {
    gap: var(--spacing-sm);
}

.gap-md {
    gap: var(--spacing-md);
}

.mt-md {
    margin-top: var(--spacing-md);
}

.mb-md {
    margin-bottom: var(--spacing-md);
}

/* Loading Screen */
.loading-screen {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--bg-dark);
}

.loader {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 215, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.1);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 90px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    pointer-events: none;
}

.toast {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: var(--spacing-md);
    min-width: 320px;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: all;
    backdrop-filter: blur(10px);
}

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

.toast-success {
    border-left-color: var(--success);
}

.toast-error {
    border-left-color: var(--danger);
}

.toast-info {
    border-left-color: var(--primary);
}

.toast-icon {
    font-size: 1.2rem;
}

.toast-success .toast-icon {
    color: var(--success);
}

.toast-error .toast-icon {
    color: var(--danger);
}

.toast-info .toast-icon {
    color: var(--primary);
}

/* Animation Utils */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ============================================
   COMPONENT STYLES (FAQ, Tables)
   ============================================ */

/* FAQ Accordion */
.accordion {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.accordion-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all 0.3s;
}

.accordion-item:hover {
    border-color: rgba(255, 215, 0, 0.2);
    background: rgba(255, 255, 255, 0.03);
}

.accordion-header {
    padding: 1.25rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    user-select: none;
}

.accordion-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.accordion-title {
    font-size: 1.1rem;
    color: var(--text-main);
    font-weight: 600;
}

.accordion-icon {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.3s, color 0.3s;
}

.accordion-item.active .accordion-icon {
    transform: rotate(180deg);
    color: var(--primary);
}

.accordion-item.active .accordion-title {
    color: var(--primary);
}

.accordion-content {
    display: none;
    padding: 0 1.25rem 1.25rem;
    color: var(--text-muted);
    line-height: 1.7;
    border-top: 1px solid transparent;
}

.accordion-item.active .accordion-content {
    display: block;
    border-top-color: var(--border-color);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Premium Table Styles */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
    /* Prevent wrapping on small screens by default if needed, or let it wrap */
}

thead tr {
    border-bottom: 2px solid var(--border-color);
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

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

th {
    padding: 0.875rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 0.875rem;
    color: var(--text-muted);
}

td strong {
    color: var(--text-main);
}

/* Header Actions Layout */
.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

/* Tabs Styling */
.tabs {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    margin-bottom: var(--spacing-md);
}

.tabs .btn {
    border-radius: 8px;
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Tablet (max-width: 1024px) */
@media (max-width: 1024px) {
    .nav-links {
        gap: var(--spacing-sm);
    }

    .container {
        padding: var(--spacing-sm);
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {

    /* Typography Scaling */
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    /* Navigation */
    .navbar {
        padding: var(--spacing-sm) 0;
    }

    .nav-content {
        align-items: flex-start;
        /* Ensure top alignment */
    }

    .nav-header {
        width: 100%;
        padding-right: 0;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .nav-menu {
        display: none;
        /* Hide default on mobile */
        width: 100%;
        flex-direction: column;
        margin-left: 0;
        margin-top: var(--spacing-md);
        padding-top: var(--spacing-md);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        gap: var(--spacing-md);
    }

    .nav-menu.active {
        display: flex;
        animation: fadeIn 0.3s ease-out;
    }

    .nav-links {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }

    .nav-link {
        width: 100%;
        display: flex;
        justify-content: flex-start;
        align-items: center;
        background: rgba(255, 255, 255, 0.03);
    }

    .nav-stats {
        flex-direction: column;
        width: 100%;
        gap: var(--spacing-sm);
        padding: var(--spacing-md);
        border-radius: 12px;
        align-items: stretch;
        text-align: center;
    }

    /* Buttons */
    .btn {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
    }

    .btn-small {
        width: auto;
    }

    /* Cards & Modals */
    .card {
        padding: var(--spacing-sm);
    }

    .modal {
        width: 95%;
        padding: var(--spacing-md);
        max-height: 90vh;
    }

    .modal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }

    /* Forms */
    .input-group input,
    .input-group select,
    .input-group textarea {
        font-size: 16px;
        /* Prevents zoom on iOS */
    }

    /* Auth Pages */
    .auth-container {
        margin: 50px auto;
        padding: 0 var(--spacing-md);
    }

    .auth-card {
        padding: var(--spacing-lg);
    }

    /* Toast Notifications */
    #toast-container {
        top: auto;
        bottom: 20px;
        right: 10px;
        left: 10px;
    }

    .toast {
        min-width: 100%;
    }

    /* Grid Layouts */
    .grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }

    /* Touch Targets - Minimum 44px */
    .btn,
    .nav-link,
    a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    .container {
        padding: var(--spacing-xs);
    }

    .modal {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
}

/* Insolvency Banner */
.insolvency-banner {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    background: rgba(255, 152, 0, 0.1);
    /* Warning Orange Tint */
    border: 1px solid var(--warning);
    border-radius: var(--border-radius);
    color: var(--text-main);
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.2);
    animation: fadeIn 0.5s ease-out;
}

.insolvency-banner.critical {
    background: rgba(244, 67, 54, 0.15);
    /* Critical Red Tint */
    border-color: var(--danger);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.insolvency-icon {
    font-size: 2rem;
    line-height: 1;
}

.insolvency-content {
    flex: 1;
}

.insolvency-title {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--warning);
}

.insolvency-banner.critical .insolvency-title {
    color: var(--danger);
}

.insolvency-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    align-self: center;
}

/* ============================================
   AUTH MODAL STYLES (Added Manually)
   ============================================ */
.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    /* Dark overlay */
    backdrop-filter: blur(5px);
    z-index: 3000;
    /* High z-index */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.auth-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.auth-modal {
    background: var(--bg-surface);
    width: 100%;
    max-width: 480px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    padding: 0;
    /* Tabs take top space */
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.auth-modal-overlay.active .auth-modal {
    transform: scale(1);
}

.close-modal-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
}

.close-modal-btn:hover {
    color: var(--text-main);
}

.auth-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
}

.auth-tab {
    flex: 1;
    text-align: center;
    padding: 15px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s;
}

.auth-tab:hover {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-main);
}

.auth-tab.active {
    background: var(--bg-surface);
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.auth-content {
    padding: 30px;
}

.auth-form .input-group {
    margin-bottom: 20px;
}

.auth-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-form input {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: white;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.auth-form input:focus {
    border-color: var(--primary);
    outline: none;
}