/*
 * Crimson Streets - Modern UI Overhaul v5.1 (Final)
 * A complete, atmospheric, and responsive redesign for the entire game.
 */

/* --- Fonts & Root Variables --- */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&family=Oswald:wght@400;600&display=swap');

:root {
    --color-background: #0d0d12;
    --color-surface: rgba(22, 23, 30, 0.7);
    --color-surface-solid: #16171e;
    --color-surface-light: #21232a;
    --color-border: rgba(68, 71, 90, 0.5);
    --color-border-solid: #333644;
    --color-primary: #e51d37;
    --color-primary-rgb: 229, 29, 55;
    --color-primary-dark: #c1152c;
    --color-primary-glow: rgba(229, 29, 55, 0.5);
    --color-text-primary: #e1e1e6;
    --color-text-secondary: #90929e;
    --font-body: 'Roboto', sans-serif;
    --font-heading: 'Oswald', sans-serif;
    --bar-red: #e43f5a;
    --bar-blue: #3f88e4;
    --bar-green: #4caf50;
    --status-ok: #28a745;
    --status-hospital: #dc3545;
    --donator-gold: #FFD700;
}

/* --- General & Body 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;
    background-image: linear-gradient(rgba(13, 13, 18, 0.8), var(--color-background) 60%), url('https://i.ibb.co/204fjTc9/bg.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: scroll !important;
}

body.in-hospital {
    background-image: linear-gradient(rgba(50, 15, 20, 0.8), var(--color-background) 70%), url('https://i.ibb.co/204fjTc9/bg.jpg');
}

h2, h3, h4 {
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    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);
    text-decoration: underline;
}

/* --- Authentication Pages (Login/Register) --- */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}
.auth-panel {
    width: 100%;
    max-width: 450px;
    background-color: var(--color-surface-solid);
    border: 1px solid var(--color-border-solid);
    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: 12px;
    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-solid);
    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); }

/* --- Main Game Layout --- */
.game-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background-color: var(--color-surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease-in-out;
}

.game-main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.page-content {
    flex-grow: 1;
    padding: 30px;
    animation: fadeIn 0.5s ease-in-out;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

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

/* --- Sidebar Navigation --- */
.sidebar .logo {
    padding: 20px;
    text-align: center;
}

.logo img { max-width: 160px; 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.75rem; text-transform: uppercase; letter-spacing: 1.2px; padding: 25px 25px 10px 25px; margin-top: 0; }
.main-nav .nav-item a { 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; border-left: 3px solid transparent; }
.main-nav .nav-item a:hover { background-color: rgba(255, 255, 255, 0.05); color: var(--color-text-primary); text-decoration: none; }
.main-nav .nav-item.active a { background: linear-gradient(90deg, rgba(var(--color-primary-rgb), 0.15), transparent); color: var(--color-primary); border-left-color: var(--color-primary); font-weight: bold; }
.main-nav .nav-item i { width: 20px; text-align: center; }
.main-nav .nav-item.active i { color: var(--color-primary); }
.main-nav .logout { margin-top: 20px; border-top: 1px solid var(--color-border-solid); }
@keyframes notify-glow { 0%, 100% { text-shadow: 0 0 6px var(--color-primary-glow); } 50% { text-shadow: 0 0 16px var(--color-primary-glow); } }
.main-nav .nav-item.nav-item-notify a { color: var(--color-primary); animation: notify-glow 2s infinite; }

/* --- Top Header & Stats Bar --- */
.top-header { position: sticky; top: 0; z-index: 998; background-color: var(--color-surface); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: 0 30px; height: 65px; border-bottom: 1px solid var(--color-border); display: flex; align-items: center; width: 100%; }
.user-stats-bar { display: flex; gap: 20px; align-items: center; width: 100%; }
.stat-item { display: flex; align-items: center; gap: 8px; color: var(--color-text-secondary); font-size: 0.9rem; white-space: nowrap; }
.stat-item > span { color: var(--color-text-primary); font-weight: 500; }
.stat-item i { color: var(--color-text-secondary); font-size: 1.1em; }
.stat-item .donator-star { color: var(--donator-gold); }
.stat-item-bar { display: grid; grid-template-columns: auto 150px; align-items: center; gap: 8px; }
.stat-item-bar > i { grid-column: 1; }
.stat-item-bar .bar-border { grid-column: 2; grid-row: 1; position: relative; width: 150px; height: 20px; background-color: rgba(0, 0, 0, 0.4); border: 1px solid var(--color-border); border-radius: 10px; overflow: hidden; }
.stat-item-bar .bar-text { grid-column: 2; grid-row: 1; z-index: 1; text-align: center; color: #fff; font-size: 12px; font-weight: bold; text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8); line-height: 1; pointer-events: none; }
.bar-fill { height: 100%; border-radius: 10px; transition: width 0.3s ease-in-out; box-shadow: inset 0 -2px 4px rgba(0,0,0,0.3); }
#health-bar { background: linear-gradient(to right, #e43f5a, #c1152c); }
#stamina-bar { background: linear-gradient(to right, #3f88e4, #2a6db5); }
#energy-bar { background: linear-gradient(to right, #4caf50, #388e3c); }
#header-search-icon { margin-left: auto; }

/* --- General Content Styles --- */
.content-panel { background-color: var(--color-surface); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--color-border); border-radius: 8px; padding: 30px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3); }
.content-panel h2 { color: var(--color-primary); margin: -30px -30px 25px -30px; padding: 20px 30px; border-bottom: 1px solid var(--color-border); background: linear-gradient(rgba(0,0,0,0.1), transparent); border-radius: 8px 8px 0 0; font-size: 1.8rem; }
.content-panel h3 { margin: 30px 0 15px 0; border-bottom: 1px solid var(--color-border); padding-bottom: 10px; color: var(--color-text-primary); }
.content-panel h3:first-child { margin-top: 0; }

/* --- Buttons --- */
.primary-button { background: linear-gradient(to top, var(--color-primary), #f8455c); color: #fff; border: 1px solid var(--color-primary-dark); border-radius: 5px; padding: 10px 20px; font-family: var(--font-heading); font-size: 1rem; text-transform: uppercase; letter-spacing: 0.5px; cursor: pointer; transition: all 0.2s ease; text-shadow: 1px 1px 3px rgba(0,0,0,0.3); box-shadow: 0 2px 5px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.1); }
.primary-button:hover { background: linear-gradient(to top, var(--color-primary-dark), var(--color-primary)); transform: translateY(-2px); box-shadow: 0 4px 10px rgba(var(--color-primary-rgb), 0.2), inset 0 1px 0 rgba(255,255,255,0.1); }
.primary-button:disabled { background: #555; border-color: #444; cursor: not-allowed; transform: none; box-shadow: none; }

/* --- Tables & Pagination --- */
#leaderboard-table, .admin-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
#leaderboard-table th, #leaderboard-table td, .admin-table th, .admin-table td { padding: 15px; text-align: left; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
#leaderboard-table thead, .admin-table thead { background-color: rgba(0,0,0,0.2); }
#leaderboard-table th, .admin-table th { font-size: 0.9rem; font-family: var(--font-heading); color: var(--color-text-secondary); }
#leaderboard-table tbody tr:hover, .admin-table tbody tr:hover { background-color: rgba(var(--color-primary-rgb), 0.05); }
.fa-medal { font-size: 1.5rem; }
.fa-medal.gold { color: #FFD700; }
.fa-medal.silver { color: #C0C0C0; }
.fa-medal.bronze { color: #CD7F32; }
.leaderboard-name { display: flex; align-items: center; gap: 10px; }
.pagination-controls { margin-top: 20px; display: flex; justify-content: space-between; align-items: center; }
.pagination-info { color: var(--color-text-secondary); }
.pagination-buttons { display: flex; gap: 10px; }

/* --- Action Cards & Grids --- */
.action-list, .shop-grid, .backpack-grid, .gym-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.action-card, .shop-item, .backpack-item { background-color: var(--color-surface-solid); border: 1px solid var(--color-border-solid); border-radius: 6px; padding: 20px; display: flex; flex-direction: column; transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; }
.action-card:hover, .shop-item:hover, .backpack-item:hover { transform: translateY(-5px); border-color: var(--color-primary); box-shadow: 0 6px 25px rgba(0,0,0, 0.3); }


/* --- Item icons in shop cards (top-right) --- */
.shop-item { position: relative; }
.shop-item .item-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 64px;
    height: 64px;
    object-fit: contain;
    pointer-events: none;
    opacity: 0.95;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.45));
}
/* Make room so the title/stats don't sit under the icon */
.shop-item .item-details { padding-right: 84px; }
.action-details, .item-details { flex-grow: 1; margin-bottom: 15px; }
.action-details h3, .item-details h4 { font-size: 1.3rem; margin: 0 0 10px 0; color: var(--color-text-primary); }
.action-cost, .item-price { color: var(--color-primary); font-weight: bold; }
.item-stats { color: var(--color-text-secondary); font-size: 0.9rem; margin: 5px 0 10px; border-top: 1px dashed var(--color-border); padding-top: 10px; }
.item-desc { font-size: 0.95rem; color: var(--color-text-secondary); }

/* --- Forms & Modals --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(10, 10, 15, 0.7); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); display: none; justify-content: center; align-items: center; z-index: 1001; animation: fadeIn 0.3s; }
.modal-content { background-color: var(--color-surface-solid); padding: 30px; border-radius: 8px; width: 90%; max-width: 600px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); border: 1px solid var(--color-border-solid); }
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--color-border-solid); padding-bottom: 15px; margin-bottom: 20px; }
.modal-header h2, .modal-header h3 { color: var(--color-primary); }
.modal-close-btn { background: none; border: none; color: var(--color-text-secondary); font-size: 1.8rem; cursor: pointer; transition: color 0.2s; }
.modal-close-btn:hover { color: var(--color-text-primary); }
.form-group input, .form-group textarea, .form-group select, .bank-form input, .gym-input-group input, .casino-interface input { width: 100%; padding: 12px; background-color: #0d0d12; border: 1px solid var(--color-border-solid); color: var(--color-text-primary); border-radius: 4px; font-size: 1rem; transition: border-color 0.2s, box-shadow 0.2s; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus, .bank-form input:focus, .gym-input-group input:focus, .casino-interface input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.2); }
/* FIX: Added missing utility class for autocomplete positioning */
.form-group.relative { position: relative; }

/* --- Admin & Moderator Panels --- */
.admin-wrapper { padding: 30px; max-width: 1600px; margin: auto; background-color: var(--color-surface-solid); min-height: 100vh; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--color-border-solid); }
.admin-tabs { display: flex; gap: 1px; margin-bottom: 20px; background-color: var(--color-border-solid); 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; transition: background-color 0.2s; }
.admin-tab:hover { background-color: #3c3f4c; }
.admin-tab.active { background-color: var(--color-surface-solid); color: var(--color-primary); }
.admin-content-area { display: none; background-color: var(--color-surface-solid); padding: 20px; border: 1px solid var(--color-border-solid); 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-solid); color: var(--color-text-primary); border-radius: 4px; }
.admin-table .action-buttons { display: flex; flex-wrap: wrap; gap: 5px; }
.admin-form-container { background-color: var(--color-surface-light); padding: 20px; border-radius: 8px; margin-top: 20px; border: 1px solid var(--color-border-solid); }
.admin-form-container h3 { margin: 0 0 20px 0; padding-bottom: 15px; border-bottom: 1px solid var(--color-border-solid); color: var(--color-primary); }
.admin-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; }
.admin-sortable-list { list-style: none; padding: 0; }
.admin-sortable-list li { padding: 15px; background-color: var(--color-surface-solid); border: 1px solid var(--color-border-solid); margin-bottom: 5px; border-radius: 4px; cursor: grab; }
.report-sub-tabs { display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 1px solid var(--color-border-solid); }
.report-sub-tab { padding: 8px 15px; cursor: pointer; border-bottom: 3px solid transparent; transition: all 0.2s; }
.report-sub-tab.active, .report-sub-tab:hover { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* --- PAGE SPECIFIC STYLES --- */
.news-post { background-color: var(--color-surface-solid); border-left: 4px solid var(--color-primary); padding: 20px; margin-bottom: 20px; border-radius: 0 6px 6px 0; }
.news-post h4 { margin: 0 0 10px 0; }
.news-post .post-meta { font-size: 0.9rem; color: var(--color-text-secondary); margin-top: 15px; }
.gym-input-group { display: flex; gap: 10px; margin-top: 15px; }
.gym-input-group input { flex-grow: 1; }
.crime-entry { background-color: var(--color-surface-solid); border: 1px solid var(--color-border-solid); border-radius: 6px; padding: 20px; display: grid; grid-template-columns: 60px 1fr auto auto; align-items: center; gap: 20px; transition: all 0.2s ease-in-out; border-left: 4px solid var(--color-border-solid); }
.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); text-align: center; }
.crime-info h3 { margin: 0 0 5px 0; font-size: 1.4rem; }
.crime-reward { color: var(--status-ok); font-weight: bold; }
.crime-stats { display: flex; gap: 15px; }
.stat-box { background-color: var(--color-background); border: 1px solid var(--color-border-solid); border-radius: 4px; padding: 8px 12px; text-align: center; min-width: 100px; }
.stat-box strong { display: block; font-size: 0.8rem; color: var(--color-text-secondary); margin-bottom: 5px; }
.stat-box span { font-weight: bold; }
.progress-bar-container { width: 100%; height: 30px; background-color: var(--color-background); border: 1px solid var(--color-border-solid); border-radius: 6px; padding: 4px; margin-top: 10px; }
.progress-bar-fill { height: 100%; background: linear-gradient(to right, var(--color-primary-dark), var(--color-primary)); border-radius: 4px; transition: width 0.5s ease-in-out; }
.crime-category-locked { background-color: var(--color-surface-solid); border: 1px dashed var(--color-border-solid); 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; }
.hospital-view { text-align: center; padding: 40px 20px; }
.hospital-view .fa-hospital-user { font-size: 6rem; color: var(--color-primary); margin-bottom: 20px; }
.hospital-view h2 { font-size: 2.5rem; margin-bottom: 10px; }
.hospital-timer { margin-top: 30px; font-size: 1.2rem; color: var(--color-text-secondary); }
#hospital-countdown { display: block; font-size: 3.5rem; font-family: var(--font-heading); color: var(--color-primary); margin-top: 10px; letter-spacing: 2px; }
.dashboard-overview { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.overview-card { background-color: var(--color-surface-solid); padding: 20px; border-radius: 6px; text-align: center; border: 1px solid var(--color-border-solid); }
.overview-card h3 { color: var(--color-text-secondary); margin: 0 0 10px 0; font-size: 1rem; }
.overview-card p { font-size: 2rem; font-weight: bold; }
.bank-form { display: flex; gap: 10px; margin-bottom: 30px; }

.bank-form .max-amount-btn{
    background: var(--color-surface-solid);
    border-color: var(--color-border-solid);
    color: var(--color-text-primary);
    padding: 10px 12px;
    font-size: 0.85rem;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    white-space: nowrap;
}
.bank-form .max-amount-btn:hover{
    border-color: var(--color-primary);
    transform: translateY(-1px);
}
.bank-plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.plan-card { background-color: var(--color-surface-solid); border: 1px solid var(--color-border-solid); 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(40, 167, 69, 0.3); }
.plan-card.next-upgrade { border-color: var(--color-primary); }
.plan-card.locked { opacity: 0.5; }
.plan-card h4 { color: var(--color-primary); margin: 0 0 10px 0; }
.plan-card .plan-cost, .plan-card .primary-button { margin-top: 15px; }
.interest-collection { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--color-border); text-align: center; }
.interest-collection h4 { margin-bottom: 15px; }
.countdown-timer { font-family: var(--font-heading); font-size: 2.5rem; color: var(--color-primary); margin: 5px 0; }
.game-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 20px; margin-top: 20px; }
.game-card { background-color: var(--color-surface-solid); border: 1px solid var(--color-border-solid); border-radius: 6px; padding: 25px; text-align: center; }
.game-card h3 { color: var(--color-primary); margin-top: 0; }
.casino-interface .button-group { display: flex; gap: 10px; justify-content: center; }
.casino-interface input { max-width: 250px; margin: 0 auto 15px auto; display: block; text-align: center; }
.fight-log-container { background-color: var(--color-background); padding: 20px; border-radius: 6px; border: 1px solid var(--color-border-solid); font-family: 'Courier New', Courier, monospace; font-size: 0.95rem; max-height: 60vh; overflow-y: auto; }
.fight-summary { text-align: center; padding-bottom: 15px; margin-bottom: 15px; border-bottom: 1px dashed var(--color-border); }
.log-entry { padding: 8px; border-radius: 4px; margin-bottom: 5px; }
.log-entry.attacker-turn { background-color: rgba(40, 167, 69, 0.1); border-left: 3px solid var(--status-ok); }
.log-entry.defender-turn { background-color: rgba(220, 53, 69, 0.1); border-left: 3px solid var(--status-hospital); }
.events-list-container { display: flex; flex-direction: column; gap: 2px; }
.event-item { background-color: var(--color-surface-solid); padding: 15px; display: flex; justify-content: space-between; align-items: center; border-left: 4px solid var(--color-border-solid); }
.event-item:nth-child(odd) { background-color: transparent; }
.event-message { flex-grow: 1; }
.event-timestamp { color: var(--color-text-secondary); font-size: 0.9rem; flex-shrink: 0; margin-left: 20px; }
.events-pagination { margin-top: 20px; display: flex; justify-content: space-between; align-items: center; }
.equipped-slots-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.slot-card { background-color: var(--color-surface-solid); border: 1px solid var(--color-border-solid); border-radius: 6px; padding: 15px; }
.slot-title { font-family: var(--font-heading); color: var(--color-text-secondary); text-transform: uppercase; font-size: 0.9rem; margin-bottom: 10px; }
.equipped-item-name { font-size: 1.1rem; font-weight: bold; display: flex; justify-content: space-between; align-items: center; min-height: 38px; }
.item-stats-equipped { font-size: 0.9rem; color: var(--color-text-secondary); margin-top: 5px; }
.shop-tabs-container { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--color-border); margin-bottom: 20px; }
.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: all 0.2s ease; font-family: var(--font-heading); text-transform: uppercase; }
.shop-tab.active, .shop-tab:hover { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.profile-stats-grid { display: flex; flex-direction: column; gap: 2px; }
.stat-line { display: flex; justify-content: space-between; padding: 12px; border-radius: 4px; }
.stat-line:nth-child(odd) { background-color: var(--color-surface-solid); }
.stat-label { color: var(--color-text-secondary); font-weight: bold; }
.profile-attack-options .button-group { display: flex; flex-wrap: wrap; gap: 15px; justify-content: center; }
.attack-leave { background: linear-gradient(to top, #4a5568, #2d3748); border-color: #2d3748; }
.attack-leave:hover { background: linear-gradient(to top, #2d3748, #4a5568); }
.attack-mug { background: linear-gradient(to top, #e53e3e, #c53030); border-color: #9b2c2c; }
.attack-mug:hover { background: linear-gradient(to top, #c53030, #e53e3e); }
.attack-hospitalize { background: linear-gradient(to top, #9b2c2c, #742a2a); border-color: #551e1e; }
.attack-hospitalize:hover { background: linear-gradient(to top, #742a2a, #9b2c2c); }
[data-action="open_send_money_modal"] { background: linear-gradient(to top, #3182ce, #2b6cb0); border-color: #2c5282; }
[data-action="open_send_money_modal"]:hover { background: linear-gradient(to top, #2b6cb0, #3182ce); }
.mailbox-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.mailbox-view-switcher .primary-button { background: var(--color-surface-solid); border-color: var(--color-border-solid); }
.mailbox-view-switcher .primary-button.active-view { background: linear-gradient(to top, var(--color-primary), #f8455c); border-color: var(--color-primary-dark); }
.mailbox-container { display: flex; border: 1px solid var(--color-border-solid); border-radius: 6px; min-height: 65vh; background-color: var(--color-surface-solid); }
.inbox-list-panel { width: 35%; border-right: 1px solid var(--color-border-solid); overflow-y: auto; }
.message-view-panel { width: 65%; padding: 25px; }
.inbox-item { padding: 15px; border-bottom: 1px solid var(--color-border-solid); cursor: pointer; transition: background-color 0.2s ease; position: relative; }
.inbox-item:hover, .inbox-item.active { background-color: var(--color-surface-light); }
.inbox-item .sender-name { font-weight: bold; }
.inbox-item.unread { font-weight: bold; color: var(--color-text-primary); }
.inbox-item.unread::before { content: ''; display: block; width: 8px; height: 8px; border-radius: 50%; background-color: var(--color-primary); position: absolute; left: 8px; top: 50%; transform: translateY(-50%); }
.inbox-item.unread { padding-left: 25px; }
.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-header { border-bottom: 1px solid var(--color-border-solid); padding-bottom: 15px; margin-bottom: 20px; }
.message-body { line-height: 1.7; min-height: 200px; }
.message-actions { margin-top: 20px; border-top: 1px solid var(--color-border-solid); padding-top: 20px; }
.property-list-item { background-color: var(--color-surface-solid); border: 1px solid var(--color-border-solid); border-radius: 6px; padding: 20px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.property-details h4 { color: var(--color-primary); }
.property-income-info { text-align: right; }
.income-status.ready { color: var(--status-ok); font-weight: bold; }
.income-timer { font-family: var(--font-heading); color: var(--color-primary); }
#active-mission-container .action-card { border-color: var(--color-primary); box-shadow: 0 0 20px rgba(var(--color-primary-rgb), 0.2); }
.shop-sell-group { display: flex; gap: 10px; align-items: center; margin-top: 15px; }
.shop-sell-group input { flex-grow: 1; padding: 10px; border-radius: 5px; border: 1px solid var(--color-border-solid); background-color: var(--color-background); color: var(--color-text-primary); font-size: 1rem; text-align: center; }
#npc-list-container { display: flex; flex-direction: column; gap: 15px; }
.npc-row { background-color: var(--color-surface-solid); border: 1px solid var(--color-border-solid); border-radius: 6px; padding: 20px; display: flex; align-items: center; gap: 25px; transition: border-color 0.2s ease; }
.npc-row:hover { border-color: var(--color-primary); }
.npc-row.defeated { opacity: 0.6; }
.npc-info { flex: 1; }
.npc-info h3 { color: var(--color-primary); }
.npc-health { flex-basis: 300px; flex-shrink: 0; }
.npc-health .bar-border { width: 100%; height: 28px; background-color: rgba(0,0,0,0.3); border: 1px solid var(--color-border); border-radius: 4px; position: relative; }
.npc-health .bar-fill { height: 100%; border-radius: 3px; background-color: var(--bar-red); }
.npc-health .bar-text { position: absolute; width: 100%; left: 0; text-align: center; color: #fff; font-size: 1rem; font-weight: bold; text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7); line-height: 28px; }
.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-unknown { flex-basis: 300px; flex-shrink: 0; 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 solid var(--color-border-solid); border-radius: 4px; background-color: rgba(0,0,0,0.3); height: 28px; }
.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); }
.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; }

/* --- Game Boosts --- */
@keyframes flashing-boost {
    0%, 100% {
        color: var(--color-primary);
        text-shadow: 0 0 8px rgba(var(--color-primary-rgb), 0.8);
    }
    50% {
        color: var(--donator-gold);
        text-shadow: 0 0 12px var(--donator-gold);
    }
}
#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-solid);
}
#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: var(--donator-gold);
    margin: 10px 0;
    display: block;
}


/* --- Responsive Design --- */
.mobile-menu-button { display: none; background: none; border: none; color: var(--color-text-primary); font-size: 1.5rem; cursor: pointer; }
.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; }
.mobile-logo { display: none; }

@media (max-width: 1200px) {
    .user-stats-bar .stat-item { display: none; }
    .user-stats-bar .stat-item-bar, .user-stats-bar #username-display, #header-search-icon { display: flex; }
    .user-stats-bar #username-display { background-color: var(--color-surface-solid); padding: 5px 10px; border-radius: 5px; border: 1px solid var(--color-border-solid); }
}

/* --- Add this small block to prevent conflicts with the mobile view --- */
@media (max-width: 1200px) and (min-width: 901px) {
    .user-stats-bar .stat-item {
        display: none;
    }
}

@media (max-width: 900px) {
    .top-header {
        display: flex;
        align-items: center;
        padding: 10px 15px;
        gap: 15px;
        height: auto;
    }

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

    /* --- TWEAK: Make the logo visible again for mobile --- */
    .mobile-logo {
        display: flex;
        align-items: center;
    }
    .mobile-logo img {
        max-height: 75px; /* Control the logo size */
    }

    .user-stats-bar {
        display: flex;
        flex-wrap: wrap;
        flex-grow: 1;
        align-items: center;
        gap: 12px;
        row-gap: 8px;
    }

    .user-stats-bar .stat-item {
        display: flex !important;
        align-items: center;
        font-size: 0.85rem;
        white-space: nowrap;
        margin-right: 8px;
    }

    /* --- TWEAK: Push the boost alert icon (and logo) to the far right --- */
    /* This assumes your boost icon has the ID #game-boost-alert */
    #game-boost-alert {
        margin-left: auto; /* This creates the space on the top row */
    }

    .user-stats-bar .stat-item-bar {
        display: grid !important;
        grid-template-columns: auto 1fr;
        align-items: center;
        gap: 8px;
        flex-grow: 1;
        flex-basis: 40%;
    }
    
    .stat-item-bar .bar-border {
        width: 100%;
        height: 20px;
    }

    #header-search-icon {
        display: flex;
        align-items: center;
        margin-left: auto;
    }

    /* --- TWEAK: Center the game clock on mobile --- */
    .game-clock-container {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .sidebar {
        position: fixed;
        z-index: 1000;
        transform: translateX(-100%);
        box-shadow: 5px 0 25px rgba(0,0,0,0.5);
        height: 100vh;
    }
	/* --- Add these styles inside your @media (max-width: 900px) block --- */

/* --- FIX for crimes.php --- */
/* Rework the grid for a cleaner 2-row mobile layout */
.crime-entry {
    grid-template-columns: 60px 1fr; /* Two columns: one for the icon, one for the info */
    grid-template-areas:
        "icon   info"
        "stats  stats"
        "action action";
    gap: 15px;
    text-align: left; /* Reset text alignment for better readability */
}

/* Assign grid areas to each element */
.crime-icon { grid-area: icon; }
.crime-info { grid-area: info; }
/* --- FIX for crimes.php: Create a 2x2 grid for the stat boxes --- */
.crime-stats {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Create two equal-width columns */
    gap: 10px;                     /* Add space between the boxes */
    width: 100%;
    grid-area: stats;
}

.crime-stats .stat-box {
    min-width: 0; /* Allow the box to shrink to fit the grid column */
}
.crime-action {
    grid-area: action;
    width: 100%;
}
.crime-action .primary-button {
    width: 100%; /* Make the button full-width */
}

/* --- FINAL ATTEMPT FIX for npc.php --- */
/* Switching to CSS Grid to override stubborn flexbox behavior */
.npc-row {
    display: grid;
    grid-template-columns: 1fr; /* A single column */
    grid-auto-rows: min-content; /* CRITICAL: Make each row only as tall as its content */
    gap: 15px;
    justify-items: stretch; /* Make items like the button full-width */
}

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

.npc-info h3 {
    margin-bottom: 5px;
}

.npc-action .primary-button {
    width: 100%;
}
/* Turn the bar's border into a grid container */
.npc-health .bar-border {
    display: grid;
    align-items: center; /* Vertically center the text */
    position: relative; /* Maintain as a positioning context */
}

/* Place both the bar-fill and the bar-text in the exact same grid cell */
.npc-health .bar-fill,
.npc-health .bar-text {
    grid-column: 1;
    grid-row: 1;
}

/* Ensure the text is on top and centered */
.npc-health .bar-text {
    z-index: 1; /* Makes sure the text is layered above the bar-fill */
    text-align: center;
    width: 100%;
}

    .sidebar .logo {
        display: none;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .menu-overlay.open {
        display: block;
    }

    .page-content {
        padding: 15px;
    }
}

/* --- MISC UI ELEMENTS (Clock, Chat, Search) --- */
.placeholder-text-container, .placeholder-text { text-align: center; padding: 40px; color: var(--color-text-secondary); font-style: italic; }
.donator-star { color: var(--donator-gold); text-shadow: 0 0 8px rgba(255, 215, 0, 0.7); }
.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); }
.game-clock-container { position: fixed; bottom: 15px; left: 250px; background-color: rgba(13, 13, 18, 0.8); border: 1px solid var(--color-border-solid); padding: 5px 15px; border-radius: 6px; z-index: 1000; font-size: 0.9rem; }
#game-clock {
    font-family: monospace;
    font-weight: bold;
}

#header-search-bar { position: absolute; top: 65px; right: 30px; z-index: 1001; background-color: var(--color-surface-solid); border: 1px solid var(--color-border-solid); border-radius: 8px; padding: 15px; width: 300px; box-shadow: 0 5px 15px rgba(0,0,0,0.4); display: none; }
#header-search-input { width: 100%; padding: 10px; background-color: var(--color-background); border: 1px solid var(--color-border-solid); color: var(--color-text-primary); border-radius: 5px; font-size: 1rem; }
#header-search-results { margin-top: 10px; max-height: 200px; overflow-y: auto; }
.search-result-item { display: block; padding: 10px; color: var(--color-text-secondary); text-decoration: none; border-radius: 5px; transition: background-color 0.2s; }
.search-result-item:hover { background-color: var(--color-surface-light); color: var(--color-text-primary); }
.search-no-results { padding: 10px; color: var(--color-text-secondary); text-align: center; }
.autocomplete-suggestions { position: absolute; top: 100%; left: 0; right: 0; background-color: var(--color-surface-light); border: 1px solid var(--color-border-solid); 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; }

#global-chat-btn { position: fixed; bottom: 20px; right: 20px; width: 55px; height: 55px; background: linear-gradient(to top, var(--color-primary), #f8455c); border: 1px solid var(--color-primary-dark); border-radius: 50%; font-size: 22px; color: white; display: flex; justify-content: center; align-items: center; cursor: pointer; box-shadow: 0 4px 15px rgba(var(--color-primary-rgb), 0.3); transition: all 0.2s ease; z-index: 1040; }
#global-chat-btn:hover { 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-solid); border: 1px solid var(--color-border-solid); border-radius: 10px; box-shadow: 0 5px 25px rgba(0, 0, 0, 0.4); display: none; flex-direction: column; z-index: 1045; overflow: hidden; }
.chat-header { background-color: rgba(0,0,0,0.2); color: var(--color-text-primary); padding: 10px 15px; font-weight: bold; border-bottom: 1px solid var(--color-border-solid); display: flex; justify-content: space-between; align-items: center; font-family: var(--font-heading); }
.chat-messages { flex-grow: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column-reverse; }
.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; }
.chat-message .username.moderator { color: #50fa7b; }
.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; opacity: 0.7; }
.message-delete-btn:hover { opacity: 1; }
.chat-input-area { padding: 10px; border-top: 1px solid var(--color-border-solid); }
#chat-form { display: flex; }
#chat-message-input { flex-grow: 1; background-color: var(--color-background); border: 1px solid var(--color-border-solid); 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); }
#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); }

/* =========================================================
   PATCH PACK v5.1a — Fix CSS truncation + remove scroll stutter
   Paste at END OF FILE
   ========================================================= */

/* 1) Safety: ensure the stylesheet ends cleanly (no broken parsing) */
.toast-notification.info i { color: var(--bar-blue); }

/* 2) PERFORMANCE FIX:
   Move heavy background painting off <body> and onto a fixed pseudo-element.
   This prevents expensive repaints during scrolling (the stutter you saw). */
body {
    background-image: none !important;
    background-attachment: scroll !important;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;

    /* same visuals as before, but painted once */
    background-image:
        linear-gradient(rgba(13, 13, 18, 0.8), var(--color-background) 60%),
        url('https://i.ibb.co/204fjTc9/bg.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    /* small nudge for smoother compositor behavior */
    transform: translateZ(0);
    will-change: transform;
}

/* Hospital variation now affects the pseudo-element instead of body */
body.in-hospital::before {
    background-image:
        linear-gradient(rgba(50, 15, 20, 0.8), var(--color-background) 70%),
        url('https://i.ibb.co/204fjTc9/bg.jpg');
}

/* 3) BACKDROP BLUR FALLBACK:
   Backdrop-filter is expensive on some GPUs. This reduces stutter on weaker devices. */
@supports not ((backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px))) {
    .sidebar,
    .top-header,
    .content-panel,
    .modal-overlay {
        background-color: var(--color-surface-solid) !important;
    }
}

/* Optional: reduce painting cost a bit more */
.content-panel,
.sidebar,
.top-header {
    transform: translateZ(0);
}

