/* Crimson Streets - Modern UI Overhaul v2.2 (Final Fixes) */
@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;700&family=Oswald:wght@500&display=swap');

:root {
    --color-background: #111217;
    --color-surface: #1a1b21;
    --color-surface-light: #21232a;
    --color-border: #2c2e39;
    --color-primary: #e51d37;
    --color-primary-rgb: 229, 29, 55;
    --color-primary-dark: #c1152c;
    --color-text-primary: #f0f0f0;
    --color-text-secondary: #a0a0a0;
    --font-body: 'Nunito Sans', sans-serif;
    --font-heading: 'Oswald', sans-serif;
    --bar-red: #e43f5a;
    --bar-blue: #3f88e4;
    --bar-green: #4caf50;
    --status-ok: #4caf50;
    --status-hospital: #e43f5a;
}

/* --- General Styles --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-background);
    color: var(--color-text-primary);
    font-size: 16px;
    line-height: 1.6;
}

body.in-hospital {
    background: radial-gradient(ellipse at center, #411319 0%, var(--color-background) 70%);
}

h2, h3, h4 {
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-text-primary);
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-primary-dark);
}

/* --- AUTHENTICATION PAGES --- */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(rgba(17, 18, 23, 0.8), rgba(17, 18, 23, 0.8)), url('https://via.placeholder.com/1920x1080.png/111217/111217') no-repeat center center;
    background-size: cover;
}

.auth-panel {
    width: 100%;
    max-width: 450px;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.auth-panel .logo { margin-bottom: 20px; }
.auth-panel .logo img { max-width: 200px; }
.auth-panel h2 { color: var(--color-primary); margin-bottom: 25px; font-size: 2rem; }

.auth-error {
    background-color: rgba(var(--color-primary-rgb), 0.1);
    color: var(--color-primary);
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    border: 1px solid var(--color-primary);
}

.auth-form .form-group { margin-bottom: 20px; text-align: left; }
.auth-form label { display: block; margin-bottom: 8px; color: var(--color-text-secondary); font-weight: bold; font-size: 0.9rem; }
.auth-form label i { margin-right: 8px; }

.auth-form input {
    width: 100%;
    padding: 12px;
    background-color: var(--color-background);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.2);
}

.auth-button { width: 100%; padding: 15px; font-size: 1.1rem; margin-top: 10px; }
.auth-switch { margin-top: 25px; color: var(--color-text-secondary); }

/* --- Game Layout --- */
.game-wrapper { display: flex; width: 100%; max-width: 1600px; min-height: 100vh; margin: 0 auto; }
.sidebar { width: 240px; background-color: var(--color-surface); border-right: 1px solid var(--color-border); display: flex; flex-direction: column; padding-bottom: 20px; flex-shrink: 0; }
.game-main-content { flex-grow: 1; display: flex; flex-direction: column; }
.page-content { flex-grow: 1; padding: 30px; animation: fadeIn 0.5s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- Sidebar --- */
.sidebar .logo { padding: 20px; text-align: center; border-bottom: 1px solid var(--color-border); }
.logo img { max-width: 180px; height: auto; }
.main-nav { flex-grow: 1; overflow-y: auto; }
.main-nav ul { list-style: none; }
.main-nav .nav-category { color: var(--color-text-secondary); font-family: var(--font-heading); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; padding: 10px 25px; margin-top: 15px; font-weight: bold; }
.main-nav .nav-item a { cursor: pointer; color: var(--color-text-secondary); transition: background-color 0.2s ease, color 0.2s ease; display: flex; align-items: center; gap: 15px; font-size: 1rem; padding: 12px 25px 12px 30px; border-left: 4px solid transparent; }
.main-nav .nav-item a:hover { background-color: var(--color-surface-light); color: var(--color-text-primary); text-decoration: none; }
.main-nav .nav-item.active a { background: linear-gradient(90deg, rgba(var(--color-primary-rgb), 0.1), transparent); color: var(--color-primary); border-left-color: var(--color-primary); }
.main-nav .nav-item.active i { color: var(--color-primary); }
.main-nav .admin-link { margin-top: 20px; border-top: 1px solid var(--color-border); }
.main-nav .logout { border-top: 1px solid var(--color-border); }
.main-nav .admin-link + .logout { border-top: none; }

@keyframes glow { 0%, 100% { text-shadow: 0 0 5px rgba(229, 29, 55, 0.7); } 50% { text-shadow: 0 0 20px rgba(229, 29, 55, 1); } }
.main-nav .nav-item.nav-item-notify a { color: var(--color-primary) !important; animation: glow 2s infinite; }
.mobile-logo { display: none; }
.mobile-logo img { max-height: 90px; width: auto; vertical-align: middle; }

/* --- Top Header Stats Bar --- */
.top-header { background-color: var(--color-surface); padding: 0 30px; height: 60px; border-bottom: 1px solid var(--color-border); display: flex; align-items: center; }
.user-stats-bar { display: flex; gap: 25px; align-items: center; }
.stat-item { display: flex; align-items: center; gap: 8px; color: var(--color-text-secondary); }
.stat-item i { color: var(--color-primary); }
.stat-item-bar { width: 220px; }
.bar-border { width: 100px; height: 20px; background-color: rgba(0,0,0,0.3); border: 1px solid var(--color-border); border-radius: 4px; position: relative; }
.bar-fill { height: 100%; border-radius: 3px; transition: width 0.3s ease-in-out; background-color: var(--bar-red); }
#health-bar { background-color: var(--bar-red); }
#stamina-bar { background-color: var(--bar-blue); }
#energy-bar { background-color: var(--bar-green); }
.bar-text { position: absolute; width: 100%; left: 0; text-align: center; color: #fff; font-size: 14px; font-weight: bold; text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7); line-height: 20px; }


/* --- Content Panel --- */
.content-panel { background-color: var(--color-surface); border: 1px solid var(--color-border); border-radius: 8px; padding: 25px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2); }
.content-panel h2 { color: var(--color-primary); margin: 0 0 20px 0; padding-bottom: 15px; border-bottom: 1px solid var(--color-border); }
.content-panel h3 { margin: 25px 0 15px 0; border-bottom: 1px solid var(--color-border); padding-bottom: 10px; }

/* --- NPC Page Layout --- */
#npc-list-container { display: flex; flex-direction: column; gap: 15px; }
.npc-row { background-color: var(--color-surface-light); border: 1px solid var(--color-border); border-left: 4px solid var(--color-border); border-radius: 6px; padding: 20px; display: flex; align-items: center; gap: 25px; transition: border-color 0.2s ease; }
.npc-row:hover { border-left-color: var(--color-primary); }
.npc-row.defeated { opacity: 0.6; }
.npc-info { flex: 1; }
.npc-info h3 { margin: 0 0 5px 0; color: var(--color-primary); font-size: 1.3rem; }
.npc-info p { margin: 0; font-size: 0.95rem; color: var(--color-text-secondary); }
.npc-health { flex-basis: 300px; flex-shrink: 0; margin-right: 20px; }
.npc-action { flex-basis: 150px; flex-shrink: 0; text-align: center; }
.npc-cooldown p { margin: 0; font-size: 0.9rem; color: var(--color-text-secondary); }
.npc-cooldown strong { color: var(--color-primary); display: block; margin-top: 5px; font-size: 1.1rem; }
.npc-health .bar-border { height: 28px; width: 100%; }
.npc-health .bar-text { line-height: 28px; font-size: 1rem; }

.npc-health-unknown {
    flex-basis: 300px;
    flex-shrink: 0;
    margin-right: 20px;
    text-align: center;
    color: var(--color-text-secondary);
	font-family: var(--font-heading);
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px var(--color-border);
    border-radius: 4px;
    background-color: rgba(0,0,0,0.3);
    height: 28px;
}

/* --- Action Cards & Grids --- */
.action-list, .shop-grid, .backpack-grid, .gym-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.action-card, .shop-item, .backpack-item { background-color: var(--color-surface-light); border: 1px solid var(--color-border); border-radius: 6px; padding: 20px; display: flex; flex-direction: column; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.action-card:hover, .shop-item:hover, .backpack-item:hover { transform: translateY(-5px); box-shadow: 0 6px 25px rgba(var(--color-primary-rgb), 0.1); border-color: var(--color-primary); }
.action-details, .item-details { flex-grow: 1; margin-bottom: 15px; }
.action-details h3, .item-details h4 { font-size: 1.3rem; margin: 0 0 5px 0; }
.action-cost, .item-price { color: var(--color-primary); font-weight: bold; }
.item-stats { color: var(--color-text-secondary); font-size: 0.9rem; margin-bottom: 10px; }
.gym-input-group, .shop-sell-group { display: flex; gap: 10px; margin-top: 15px; align-items: center; }
.gym-input-group input, .shop-sell-group input { flex-grow: 1; width: 100%; padding: 10px; border-radius: 5px; border: 1px solid var(--color-border); background-color: var(--color-background); color: var(--color-text-primary); font-size: 1rem; text-align: center; }

/* --- Buttons --- */
.primary-button { background-color: var(--color-primary); color: #fff; border: none; border-radius: 5px; padding: 10px 20px; font-family: var(--font-heading); font-size: 1rem; text-transform: uppercase; cursor: pointer; transition: background-color 0.2s ease; text-align: center; }
.primary-button:hover { background-color: var(--color-primary-dark); }
.primary-button:disabled { background-color: #555; cursor: not-allowed; }

/* --- Profile & Bank --- */
.profile-stats-grid { display: grid; gap: 10px; }
.stat-line { display: flex; justify-content: space-between; padding: 10px; border-radius: 4px; }
.stat-line:nth-child(odd) { background-color: var(--color-surface-light); }
.stat-label { color: var(--color-primary); font-weight: bold; }
.dashboard-overview { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.overview-card { background-color: var(--color-surface-light); padding: 20px; border-radius: 6px; text-align: center; }
.overview-card h3 { color: var(--color-primary); margin: 0 0 10px 0; }
.overview-card p { font-size: 2rem; font-weight: bold; }
.bank-form { display: flex; gap: 10px; margin-top: 20px; }
.bank-form input { flex-grow: 1; padding: 10px; border-radius: 5px; border: 1px solid var(--color-border); background-color: var(--color-background); color: var(--color-text-primary); font-size: 1rem; }

/* --- Inventory UI --- */
.equipped-slots-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.slot-card { background-color: var(--color-surface-light); border: 1px solid var(--color-border); border-radius: 6px; padding: 15px; }
.slot-card .slot-title { font-family: var(--font-heading); color: var(--color-text-secondary); text-transform: uppercase; font-size: 0.9rem; margin-bottom: 10px; }
.slot-card .equipped-item-name { font-size: 1.1rem; font-weight: bold; display: flex; justify-content: space-between; align-items: center; min-height: 38px; }
.slot-card .equipped-item-name .primary-button { padding: 5px 10px; font-size: 0.8rem; }
.slot-card .item-stats-equipped { font-size: 0.9rem; color: var(--color-text-secondary); margin-top: 5px; }

/* --- Tables (Leaderboard & Admin) --- */
.admin-table, #leaderboard-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.admin-table th, .admin-table td, #leaderboard-table th, #leaderboard-table td { padding: 15px; text-align: left; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.admin-table th, #leaderboard-table th { font-size: 1.1rem; background-color: var(--color-surface-light); font-family: var(--font-heading); }
.admin-table tr:hover, #leaderboard-table tr:hover { background-color: var(--color-surface-light); }
.admin-table td, #leaderboard-table td { font-size: 1.1rem; }
.leaderboard-name { display: flex; align-items: center; gap: 10px; }
.fa-medal { font-size: 1.5rem; }
.fa-medal.gold { color: #FFD700; }
.fa-medal.silver { color: #C0C0C0; }
.fa-medal.bronze { color: #CD7F32; }

/* --- Status Colors & Hospital Page --- */
.status-ok { color: var(--status-ok); font-weight: bold; }
.status-hospital { color: var(--status-hospital); font-weight: bold; }
.status-online { color: var(--status-ok); font-weight: bold; }
.status-offline { color: var(--color-text-secondary); }
.hospital-view { text-align: center; padding: 40px 20px; }
.hospital-view .fa-hospital-user { font-size: 5rem; color: var(--color-primary); margin-bottom: 20px; }
.hospital-view h2 { font-size: 2.5rem; }
.hospital-timer { margin-top: 30px; font-size: 1.2rem; color: var(--color-text-secondary); }
#hospital-countdown { display: block; font-size: 3rem; font-family: var(--font-heading); color: var(--color-primary); margin-top: 10px; }

/* --- Profile Attack Buttons --- */
.profile-attack-options { margin-top: 30px; border-top: 1px solid var(--color-border); padding-top: 20px; }
.profile-attack-options .button-group { display: flex; gap: 15px; justify-content: center; }
.attack-leave { background-color: #4F5469; }
.attack-leave:hover { background-color: #6D7287; }
.attack-mug { background-color: #8B1A2C; }
.attack-mug:hover { background-color: #a12d3e; }
.attack-hospitalize { background-color: var(--color-primary); }
.attack-hospitalize:hover { background-color: var(--color-primary-dark); }

/* --- Fight Log Page --- */
.fight-log-container { background-color: var(--color-background); padding: 20px; border-radius: 6px; border: 1px solid var(--color-border); font-family: 'Courier New', Courier, monospace; font-size: 0.95rem; max-height: 50vh; overflow-y: auto; }
.fight-summary { text-align: center; padding-bottom: 15px; margin-bottom: 15px; border-bottom: 1px dashed var(--color-border); }
.fight-summary h4 { font-size: 1.5rem; }
.log-entry { padding: 8px; border-radius: 4px; margin-bottom: 5px; }
.log-entry.attacker-turn { background-color: rgba(42, 157, 143, 0.1); border-left: 3px solid #2a9d8f; }
.log-entry.defender-turn { background-color: rgba(231, 111, 81, 0.1); border-left: 3px solid #e76f51; }

/* --- Mailbox --- */
.mailbox-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.mailbox-container { display: flex; border: 1px solid var(--color-border); border-radius: 6px; min-height: 60vh; background-color: var(--color-surface-light); }
.inbox-list-panel { width: 35%; border-right: 1px solid var(--color-border); overflow-y: auto; }
.message-view-panel { width: 65%; padding: 25px; }
.inbox-item { padding: 15px; border-bottom: 1px solid var(--color-border); cursor: pointer; transition: background-color 0.2s ease; }
.inbox-item:hover, .inbox-item.active { background-color: var(--color-surface); }
.inbox-item .sender-name { font-weight: bold; }
.inbox-item.unread .sender-name, .inbox-item.unread .subject-line { color: var(--color-primary); font-weight: bold; }
.inbox-item .subject-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-item .mail-date { font-size: 0.8rem; color: var(--color-text-secondary); }
.message-view-panel .placeholder-text { color: var(--color-text-secondary); text-align: center; margin-top: 50px; }
.message-header { border-bottom: 1px solid var(--color-border); padding-bottom: 15px; margin-bottom: 20px; }
.message-header h3 { margin: 0 0 10px 0; color: var(--color-primary); }
.message-header p { margin: 2px 0; }
.message-body { line-height: 1.7; min-height: 200px; }
.message-actions { margin-top: 20px; border-top: 1px solid var(--color-border); padding-top: 20px; }

/* --- Modals & Forms --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.7); display: none; justify-content: center; align-items: center; z-index: 1001; }
.modal-content { background-color: var(--color-surface); padding: 30px; border-radius: 8px; width: 90%; max-width: 600px; box-shadow: 0 5px 25px rgba(0,0,0,0.5); }
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--color-border); padding-bottom: 15px; margin-bottom: 20px; }
.modal-close-btn { background: none; border: none; color: var(--color-text-secondary); font-size: 1.8rem; cursor: pointer; }
#compose-mail-form textarea { height: 150px; resize: vertical; }

.form-group { margin-bottom: 20px; text-align: left; }
.form-group label { display: block; margin-bottom: 8px; color: var(--color-text-secondary); font-weight: bold; font-size: 0.9rem; }
.form-group.relative { position: relative; }

.form-group input[type="text"], .form-group input[type="number"], .form-group textarea, .form-group select {
    width: 100%;
    padding: 12px;
    background-color: var(--color-background);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input[type="text"]:focus, .form-group input[type="number"]:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.2);
}

.form-group select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23f0f0f0'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 1.2em;
    padding-right: 40px;
}

.autocomplete-suggestions { position: absolute; top: 100%; left: 0; right: 0; background-color: var(--color-surface-light); border: 1px solid var(--color-border); border-top: none; border-radius: 0 0 4px 4px; z-index: 1002; max-height: 150px; overflow-y: auto; }
.autocomplete-suggestion { padding: 10px; cursor: pointer; }
.autocomplete-suggestion:hover { background-color: var(--color-primary); color: #fff; }

/* --- Admin Panel --- */
.admin-wrapper { padding: 30px; max-width: 1400px; margin: auto; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--color-border); }
.admin-header h1, .admin-header p { margin: 0; }
.admin-tabs { display: flex; gap: 1px; margin-bottom: 20px; background-color: var(--color-border); border-radius: 8px 8px 0 0; overflow: hidden; flex-wrap: wrap; }
.admin-tab { padding: 12px 20px; cursor: pointer; background-color: var(--color-surface-light); flex-grow: 1; text-align: center; font-family: var(--font-heading); letter-spacing: 1px; }
.admin-tab:hover { background-color: #3c3f4c; }
.admin-tab.active { background-color: var(--color-surface); color: var(--color-primary); }
.admin-content-area { display: none; background-color: var(--color-surface); padding: 20px; border: 1px solid var(--color-border); border-top: none; border-radius: 0 0 8px 8px; }
.admin-content-area.active { display: block; }
.admin-table input, .admin-table select { width: 100%; padding: 8px; background-color: var(--color-background); border: 1px solid var(--color-border); color: var(--color-text-primary); border-radius: 4px; }
.admin-table .action-buttons { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.admin-table .action-buttons .primary-button { font-size: 0.8rem; padding: 5px 10px; }
.admin-form-container { background-color: var(--color-surface-light); padding: 20px; border-radius: 8px; margin-top: 20px; border: 1px solid var(--color-border); }
.admin-form-container h3 { margin: 0 0 20px 0; padding-bottom: 15px; border-bottom: 1px solid var(--color-border); color: var(--color-primary); }
.admin-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.form-actions { margin-top: 20px; display: flex; gap: 10px; }

/* --- Crime Progress Bar --- */
.progress-bar-container { width: 100%; height: 30px; background-color: var(--color-background); border: 1px solid var(--color-border); border-radius: 6px; padding: 4px; margin-top: 10px; }
.progress-bar-fill { width: 0%; height: 100%; background-color: var(--color-primary); border-radius: 4px; transition: width 0.5s ease-in-out; text-align: center; line-height: 20px; color: white; font-weight: bold; }

/* --- Casino & Mystery Box --- */
.game-grid { display: grid; grid-template-columns: 1fr; gap: 20px; margin-top: 20px; }
.game-card { background-color: var(--color-surface-light); border: 1px solid var(--color-border); border-radius: 6px; padding: 25px; text-align: center; }
.game-card h3 { color: var(--color-primary); margin-top: 0; }
.casino-interface input[type="number"] {
    width: 100%;
    max-width: 250px;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background-color: var(--color-background);
    color: var(--color-text-primary);
    font-size: 1rem;
    text-align: center;
}
.casino-interface .button-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
	justify-content: center;
}
.coin-container { display: flex; justify-content: center; align-items: center; height: 120px; perspective: 1000px; margin-bottom: 20px; }
.coin { width: 100px; height: 100px; position: relative; transform-style: preserve-3d; transition: transform 2.5s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 0 15px rgba(0, 0, 0, 0.5), 0 5px 15px rgba(0, 0, 0, 0.3); border-radius: 50%; }
.coin .side-a, .coin .side-b { position: absolute; width: 100%; height: 100%; border-radius: 50%; backface-visibility: hidden; display: flex; justify-content: center; align-items: center; font-size: 3rem; font-weight: bold; font-family: 'Arial Black', sans-serif; color: #fff; text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); box-sizing: border-box; border: 5px solid rgba(255, 255, 255, 0.3); }
.coin .side-a { background: linear-gradient(145deg, #FFD700 0%, #DAA520 70%, #B8860B 100%); z-index: 2; transform: translateZ(1px); }
.coin .side-b { background: linear-gradient(145deg, #E6E8FA 0%, #B0C4DE 70%, #708090 100%); transform: rotateY(180deg) translateZ(1px); }
#hot-outcome-text { min-height: 24px; font-size: 1.5rem; color: var(--color-text-primary); }
#hot-result-text { font-weight: bold; font-size: 1.8rem; margin-top: 10px; color: var(--color-primary); }

.mystery-box-container { height: 150px; display: flex; align-items: center; justify-content: center; perspective: 800px; margin-bottom: 20px; }
.mystery-box { width: 100px; height: 100px; position: relative; transform-style: preserve-3d; transform: rotateX(-20deg) rotateY(-30deg); }
.mystery-box .box-body, .mystery-box .box-lid { position: absolute; width: 100%; height: 100%; }
.box-body { background-color: #4a1e26; border: 2px solid #a34659; color: #e51d37; font-size: 3rem; display: flex; align-items: center; justify-content: center; font-weight: bold; }
.box-lid { transform-origin: bottom left; transition: transform 0.5s ease-in-out; }
.box-lid-front, .box-lid-top { position: absolute; background-color: var(--color-primary); border: 2px solid #ff6b81; }
.box-lid-front { width: 100%; height: 20px; transform: rotateX(90deg) translateZ(10px); transform-origin: top; color: white; font-size: 1rem; text-align: center; line-height: 20px; }
.box-lid-top { width: 100%; height: 100%; transform: translateZ(20px); }
.mystery-box.open .box-lid { transform: rotateX(-120deg); }
.prize-text {
    min-height: 24px;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--status-ok);
    transition: opacity 0.3s ease;
    position: relative; /* Lifts the text above the 3D box */
    z-index: 10;       /* Ensures it's on top */
}

/* --- Notification Toasts --- */
#notification-container { position: fixed; bottom: 20px; right: 20px; z-index: 1050; display: flex; flex-direction: column; gap: 10px; }
.toast-notification { min-width: 300px; background-color: var(--color-surface-light); color: var(--color-text-primary); padding: 15px 20px; border-radius: 6px; border-left: 5px solid var(--color-primary); box-shadow: 0 5px 15px rgba(0,0,0,0.4); display: flex; align-items: center; gap: 15px; opacity: 0; transform: translateX(20px); transition: all 0.4s cubic-bezier(0.215, 0.610, 0.355, 1); }
.toast-notification.success { border-left-color: var(--status-ok); }
.toast-notification.error { border-left-color: var(--status-hospital); }
.toast-notification.show { opacity: 1; transform: translateX(0); }
.toast-notification i { font-size: 1.5rem; }
.toast-notification.success i { color: var(--status-ok); }
.toast-notification.error i { color: var(--status-hospital); }
.toast-notification.info i { color: var(--bar-blue); }

/* --- Shop Page Tabs & Donator Star --- */
.shop-tabs-container { display: flex; border-bottom: 1px solid var(--color-border); }
.shop-tab { background: none; border: none; border-bottom: 3px solid transparent; padding: 10px 20px; cursor: pointer; font-size: 1.1rem; color: var(--color-text-secondary); transition: color 0.2s ease, border-color 0.2s ease; font-family: var(--font-heading); text-transform: uppercase; }
.shop-tab:hover { color: var(--color-text-primary); }
.shop-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.donator-star { color: #FFD700; margin-left: 5px; animation: glow-gold 2s infinite; }
@keyframes glow-gold { 0%, 100% { text-shadow: 0 0 5px rgba(255, 215, 0, 0.7); } 50% { text-shadow: 0 0 15px rgba(255, 215, 0, 1); } }
.stat-item i.donator-star { color: #FFD700; }

/* --- Responsive Mobile Design --- */
.mobile-menu-button { display: none; background: none; border: none; color: var(--color-text-primary); font-size: 1.5rem; cursor: pointer; margin-right: 15px; }
.menu-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); z-index: 999; }

/* --- Crimes Page UI Overhaul --- */
.crime-table-layout {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.crime-entry {
    background-color: var(--color-surface-light);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.2s ease-in-out;
    border-left: 4px solid var(--color-border);
}

.crime-entry:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    border-left-color: var(--color-primary);
}

.crime-icon {
    font-size: 2.5rem;
    color: var(--color-primary);
    flex-shrink: 0;
    width: 60px;
    text-align: center;
}

.crime-info {
    flex-grow: 1;
}

.crime-info h3 {
    margin: 0 0 5px 0;
    font-size: 1.4rem;
    color: var(--color-text-primary);
}

.crime-reward {
    color: var(--status-ok);
    font-weight: bold;
    font-size: 1.1rem;
}

.crime-reward i {
    margin-right: 5px;
}

.crime-stats {
    display: flex;
    gap: 15px;
    flex-shrink: 0;
}

.stat-box {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 8px 12px;
    text-align: center;
    min-width: 110px;
}

.stat-box strong {
    display: block;
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    margin-bottom: 5px;
}

.stat-box span {
    font-size: 1rem;
    font-weight: bold;
}

.stat-box span i {
    color: var(--color-text-secondary);
    margin-right: 5px;
}

.crime-action {
    flex-shrink: 0;
    margin-left: 20px;
}

@media (max-width: 900px) {
    .game-wrapper { flex-direction: column; }
    .sidebar { position: fixed; left: 0; top: 0; height: 100vh; z-index: 1000; transform: translateX(-100%); transition: transform 0.3s ease-in-out; border-right: 1px solid var(--color-border); }
	.sidebar .logo { display: none; }
    .sidebar.open { transform: translateX(0); box-shadow: 5px 0 15px rgba(0,0,0,0.3); }
	.mobile-logo { display: block; margin-right: auto; padding-left: 15px; }
    .menu-overlay.open { display: block; }
    .game-main-content { width: 100%; }
    .top-header { justify-content: space-between; height: auto; min-height: 60px; padding: 10px 15px; }
    .user-stats-bar { flex-wrap: wrap; gap: 15px; justify-content: flex-end; flex-grow: 1; }
    .bar-border { width: 80px; }
    .mobile-menu-button { display: block; }
    .shop-tabs-container { flex-wrap: wrap; }
    .npc-row { flex-direction: column; align-items: stretch; padding: 15px; }
    .npc-health { flex-basis: auto; margin-top: 15px; margin-right: 0; }
    .npc-health-unknown { flex-basis: auto; margin-top: 15px; margin-right: 0; }
    .npc-action { flex-basis: auto; margin-top: 15px; }
    
    .crime-entry {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        padding: 15px;
    }
    .crime-icon {
        width: auto;
        text-align: left;
    }
    .crime-info {
       text-align: left;
    }
    .crime-stats {
        flex-direction: column;
    }
    .stat-box {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
        padding: 10px;
    }
    .stat-box strong {
        margin-bottom: 0;
    }
    .crime-action {
        margin-left: 0;
        margin-top: 10px;
    }
    .crime-action .primary-button {
        width: 100%;
    }
}

.crime-category-locked {
    background-color: var(--color-surface-light);
    border: 1px dashed var(--color-border);
    border-radius: 6px;
    padding: 30px;
    text-align: center;
    color: var(--color-text-secondary);
    opacity: 0.7;
    margin-bottom: 15px;
}

.crime-category-locked i {
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
}

.crime-category-locked h4 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--color-text-primary);
    margin: 0;
}

/* =================================== */
/* HEADER BAR LAYOUT CORRECTIONS      */
/* =================================== */

/* This rule makes the header bar flexible */
.stat-item-bar .bar-border {
    position: static; /* Overrides the default positioning */
    flex-grow: 1;
    width: auto; /* Removes the fixed width */
}

/* This rule styles the header bar text */
.stat-item-bar .bar-text {
    position: static; /* Overrides the default positioning */
    width: auto;
    text-align: left;
    color: var(--color-text-secondary);
    font-size: 16px;
    font-weight: normal;
    text-shadow: none;
    line-height: normal;
}

/* --- Bank Investment Plans --- */
.bank-plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.plan-card {
    background-color: var(--color-surface-light);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 20px;
    text-align: center;
    transition: all 0.2s ease-in-out;
}
.plan-card.active {
    border-color: var(--status-ok);
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.3);
}
.plan-card.next-upgrade {
    border-color: var(--color-primary);
}
.plan-card.locked {
    opacity: 0.5;
    background-color: var(--color-surface);
}
.plan-card h4 {
    color: var(--color-primary);
    font-size: 1.5rem;
    margin: 0 0 10px 0;
}
.plan-card p {
    margin: 5px 0;
    color: var(--color-text-secondary);
}
.plan-card .plan-cost {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--color-text-primary);
    margin-top: 15px;
}
.plan-card.locked .plan-cost {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--color-text-primary);
    margin: 0;
}
.plan-card.locked i {
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
}
.interest-collection {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
    text-align: center;
}
.interest-collection h4 {
    font-size: 1.3rem;
    margin-bottom: 15px;
}
#interest-accrued {
    color: var(--status-ok);
    font-weight: bold;
}

/* --- Game Boost Styles --- */
@keyframes flashing-boost {
    0%, 100% {
        color: var(--color-primary);
        text-shadow: 0 0 8px rgba(var(--color-primary-rgb), 0.8);
    }
    50% {
        color: #FFD700; /* Gold color */
        text-shadow: 0 0 12px #FFD700;
    }
}

#game-boost-alert.active i {
    animation: flashing-boost 1.5s infinite;
}

#game-boost-modal .boost-details {
    text-align: center;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--color-border);
}

#game-boost-modal .boost-details:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

#game-boost-modal .boost-details h3 {
    font-size: 1.5rem;
    color: var(--color-primary);
    margin: 10px 0;
}
#game-boost-modal .boost-details p {
    font-size: 1rem;
    color: var(--color-text-secondary);
    margin: 5px 0;
}
#game-boost-modal .boost-countdown-timer {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: #FFD700; /* Gold color to stand out */
    margin: 10px 0;
    display: block;
}
/* --- Global Chat Styles --- */
#global-chat-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s, transform 0.3s;
    z-index: 1000;
}

#global-chat-btn:hover {
    background-color: var(--color-primary-dark);
    transform: scale(1.1);
}

#global-chat-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    max-width: 90vw;
    height: 500px;
    max-height: 70vh;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
    display: none;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
}

.chat-header {
    background-color: var(--color-surface-light);
    color: var(--color-text-primary);
    padding: 10px 15px;
    font-weight: bold;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header .modal-close-btn {
    font-size: 1rem; /* Adjusted for the minus icon */
    padding: 5px;
    line-height: 1;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column-reverse; /* Newest messages at the bottom */
}

.chat-message {
    margin-bottom: 8px;
    line-height: 1.4;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

.chat-message .username {
    font-weight: bold;
    color: var(--color-text-primary);
    cursor: pointer;
}

.chat-message .username.admin {
    color: #ff4d4d; /* Red */
}

.chat-message .username.moderator {
    color: limegreen; /* Lime Green */
}

.chat-message .timestamp {
    font-size: 0.8rem;
    margin-right: 5px;
}

.chat-message .message-content {
    color: var(--color-text-primary);
    word-wrap: break-word;
}

.message-delete-btn {
    background: none;
    border: none;
    color: #ff4d4d;
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 5px;
    display: inline-block;
    padding: 0 5px;
    opacity: 0.7;
}

.message-delete-btn:hover {
    opacity: 1;
    font-weight: bold;
}


.chat-input-area {
    padding: 10px;
    border-top: 1px solid var(--color-border);
}

#chat-form {
    display: flex;
}

#chat-message-input {
    flex-grow: 1;
    background-color: var(--color-surface-light);
    border: 1px solid var(--color-border);
    border-radius: 5px;
    color: var(--color-text-primary);
    padding: 8px;
    font-size: 0.9rem;
}

#chat-message-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

#chat-send-btn {
    margin-left: 10px;
    padding: 8px 12px;
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#chat-send-btn:hover {
    background-color: var(--color-primary-dark);
}

