:root {
    --bg: #111;
    --panel: rgba(25, 25, 25, 0.85);
    --text: #f0f0f0;
    --primary: #f39c12;
    --primary-hover: #e67e22;
    --danger: #e74c3c;
    --success: #2ecc71;
    --locked: #555;
    --common: #2ecc71;
    --rare: #9b59b6;
    --epic: #e74c3c;
    --monster: #00d2ff;
    --nerves: #e67e22;
    --skill: #3498db;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    margin: 0;
    padding: 0;
    background: #111 url('mesto.jpg') no-repeat center center fixed;
    background-size: cover;
}

/* --- TOP BAR --- */
.top-bar {
    position: fixed; top: 0; left: 0; width: 100%; height: 65px;
    background: rgba(15, 15, 15, 0.95); z-index: 1000;
    border-bottom: 2px solid var(--primary);
    display: flex; align-items: center; justify-content: center; gap: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.8); backdrop-filter: blur(10px);
}
.top-stat { display: flex; align-items: center; font-weight: bold; font-size: 1.15em; color: #fff; }
.money-stat { color: var(--success); font-size: 1.3em; }
.mini-bar { width: 100px; height: 10px; background: #333; margin-left: 10px; border-radius: 5px; overflow: hidden; border: 1px solid #555;}
.xp-fill { background: linear-gradient(90deg, #2980b9, #3498db); height: 100%; width: 0%; transition: width 0.4s ease-out; }
.nerves-fill { background: linear-gradient(90deg, #c0392b, #e67e22); height: 100%; width: 100%; transition: width 0.4s ease-out; }

.app-container { display: flex; gap: 20px; max-width: 1400px; margin: 0 auto; min-height: 90vh; padding-top: 85px; }
.sidebar { width: 280px; flex-shrink: 0; display: flex; flex-direction: column; gap: 15px; }
.sidebar-box {
    background: var(--panel); backdrop-filter: blur(12px);
    padding: 20px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

h1 { font-size: 1.6em; margin: 0; text-shadow: 1px 1px 3px #000; color: var(--primary); }

/* --- TLAČÍTKA --- */
.btn-buy-monster, .btn-smoke, .nav-btn, .btn-refresh { transition: all 0.2s ease; box-shadow: 0 4px 0 rgba(0,0,0,0.4); }
.btn-buy-monster:active, .btn-smoke:active, .nav-btn:active, .btn-refresh:active { transform: translateY(4px); box-shadow: 0 0 0 rgba(0,0,0,0); }
.btn-buy-monster { background: #fff; color: #111; border: 2px solid #ccc; border-radius: 8px; font-weight: bold; padding: 10px; cursor: pointer; text-align: center; }
.btn-buy-monster:hover { box-shadow: 0 4px 15px #ccc; }
.btn-smoke { background: var(--nerves); color: #111; border: none; border-radius: 8px; font-weight: bold; padding: 10px; cursor: pointer; }
.btn-smoke:hover:not(:disabled) { box-shadow: 0 4px 15px var(--nerves); }
.btn-smoke:disabled { background: var(--locked); color: #999; cursor: not-allowed; box-shadow: none; transform: none; }
.btn-refresh { background: rgba(255, 255, 255, 0.1); color: #fff; border: 1px solid rgba(255, 255, 255, 0.2); padding: 6px 12px; border-radius: 6px; font-size: 0.85em; font-weight: bold; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-transform: uppercase; }
.btn-refresh:hover { background: var(--primary); color: #111; border-color: var(--primary); }

/* NAV MENU ZÁKLAD */
.nav-menu { display: flex; flex-direction: column; gap: 10px; }
.nav-btn { background: rgba(0, 0, 0, 0.4); color: var(--text); border: 2px solid #444; padding: 12px 15px; border-radius: 8px; font-size: 1.1em; font-weight: bold; cursor: pointer; text-align: left; display: flex; align-items: center; }
.nav-icon { display: none; }
.nav-btn:hover { background: var(--primary); border-color: var(--primary); color: #111; }
.nav-active-pulse { animation: pulseWork 2s infinite; border-color: var(--success) !important; color: var(--success) !important; }

/* --- ZÁKLADNÍ STRUKTURA --- */
.main-content { flex-grow: 1; position: relative; }
.tab-panel { display: none; background: var(--panel); backdrop-filter: blur(12px); padding: 30px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.1); box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5); animation: fadeIn 0.3s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulseWork { 0% { box-shadow: 0 0 5px var(--success); background: rgba(46, 204, 113, 0.1); } 50% { box-shadow: 0 0 25px var(--success); background: rgba(46, 204, 113, 0.4); } 100% { box-shadow: 0 0 5px var(--success); background: rgba(46, 204, 113, 0.1); } }

h2 { font-size: 1.8em; margin: 0 0 5px 0; color: var(--primary); border-bottom: 2px solid #444; padding-bottom: 5px;}
.grid-container { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; margin-top: 15px; }
.jobs-layout-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-top: 15px; }

/* --- KARTY ÚKOLŮ A OBCHODŮ --- */
.task-grid button, .jobs-layout-grid button { background: rgba(0, 0, 0, 0.6); color: #fff; border: 1px solid #444; border-left: 4px solid var(--primary); padding: 12px 15px; border-radius: 8px; cursor: pointer; transition: all 0.2s ease; display: flex; flex-direction: column; gap: 10px; text-align: left; position: relative; box-shadow: 0 4px 6px rgba(0,0,0,0.3); }
.task-grid button:hover:not(:disabled), .jobs-layout-grid button:hover:not(:disabled) { background: rgba(0, 0, 0, 0.8); border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0,0,0,0.5); }
.task-grid button:active:not(:disabled), .jobs-layout-grid button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.task-grid button:disabled, .jobs-layout-grid button:disabled { background: rgba(0,0,0,0.3); color: #777; border-color: #333; border-left-color: #555; cursor: not-allowed; box-shadow: none; transform: none; }

.btn-title { font-weight: bold; font-size: 1.1em; width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; color: #fff; }
.btn-title span:first-child { flex-grow: 1; text-align: left; display: flex; align-items: center; }
.job-timer { font-size: 0.85em; color: var(--primary); font-weight: bold; white-space: nowrap; flex-shrink: 0; background: rgba(0,0,0,0.6); border: 1px solid #555; padding: 4px 8px; border-radius: 6px; }
.task-grid button:disabled .job-timer, .jobs-layout-grid button:disabled .job-timer { color: #555; border-color: #444; background: transparent; }
.btn-stats { display: flex; justify-content: space-between; width: 100%; font-size: 0.9em; font-weight: 600; color: #ccc; }
.task-grid button:disabled .btn-stats, .jobs-layout-grid button:disabled .btn-stats { color: #666; }
.fail-warning { color: var(--danger); font-size: 0.85em; font-weight: bold; background: rgba(0,0,0,0.6); padding: 3px 6px; border-radius: 4px; border: 1px solid var(--danger); }

.job-branch-tag { font-size: 1.1em; padding: 4px 8px; border-radius: 6px; background: #222; border: 1px solid #555; margin-right: 10px; display: inline-flex; align-items: center; box-shadow: 0 2px 4px rgba(0,0,0,0.4); }
.branch-name { font-size: 0.65em; text-transform: uppercase; letter-spacing: 0.5px; color: #aaa; margin-left: 6px; }

.btn-danger { background: var(--danger) !important; color: white !important; padding: 10px 20px; border-radius: 5px; font-weight: bold; border: none; cursor: pointer; display: flex; align-items: center; box-shadow: 0 4px 0 #922b21 !important; }
.btn-danger:hover:not(:disabled) { background: #c0392b !important; }
.btn-danger:active:not(:disabled) { transform: translateY(4px) !important; box-shadow: none !important; }

/* DÍLNA */
.active-task-box { background: rgba(0,0,0,0.5); padding: 30px; border-radius: 8px; text-align: center; border: 2px solid var(--primary); margin-top: 20px; transition: 0.3s; }
.progress-bar { width: 100%; height: 18px; background: rgba(0,0,0,0.8); border-radius: 8px; margin-top: 15px; overflow: hidden; border: 1px solid #444; }
.progress-fill { height: 100%; background: var(--success); width: 0%; transition: width 0.1s linear; }

/* INVENTÁŘ A POSTAVA */
.character-slots { display: grid; grid-template-columns: repeat(3, 130px); justify-content: center; gap: 35px 20px; background: rgba(0,0,0,0.3); padding: 20px 20px 30px 20px; border-radius: 12px; }
.inventory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 15px; background: rgba(0,0,0,0.3); padding: 20px; border-radius: 12px; min-height: 200px; align-content: start; transition: 0.3s; }
.item-slot { width: 100%; min-height: 220px; height: 100%; background: rgba(0,0,0,0.6); border: 2px dashed #666; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; cursor: pointer; position: relative; transition: 0.2s; padding: 15px 10px 10px 10px; box-sizing: border-box; }
.item-slot:hover { transform: translateY(-5px); background: rgba(0,0,0,0.8); z-index: 5; box-shadow: 0 8px 20px rgba(0,0,0,0.6); }
.item-slot.filled { border-style: solid; border-width: 3px; background: rgba(20,20,20,0.9); }
.item-slot.empty { cursor: default; justify-content: center; }
.item-slot[draggable="true"] { cursor: grab; }
.item-slot[draggable="true"]:active { cursor: grabbing; }
.drag-highlight { border-color: var(--primary) !important; box-shadow: 0 0 15px var(--primary) !important; background: rgba(243, 156, 18, 0.4) !important; }
.item-level { position: absolute; top: -10px; left: -10px; background: #222; border: 2px solid var(--primary); color: white; border-radius: 50%; width: 26px; height: 26px; font-size: 0.75em; font-weight: bold; display: flex; align-items: center; justify-content: center; z-index: 10; box-shadow: 0 2px 5px rgba(0,0,0,0.8); }

.sell-btn, .buy-btn, .auc-btn { color: white; border: none; border-radius: 4px; font-size: 0.7em; padding: 6px; margin-top: 6px; cursor: pointer; width: 100%; font-weight: bold; text-transform: uppercase; box-shadow: 0 2px 4px rgba(0,0,0,0.5); transition: 0.2s; }
.sell-btn { background: var(--danger); } .sell-btn:hover { background: #c0392b; }
.buy-btn { background: var(--success); color:#111; } .buy-btn:hover { background: #27ae60; }
.auc-btn { background: var(--skill); margin-top: 4px; } .auc-btn:hover { background: #2980b9; }

.item-common { border-color: var(--common) !important; box-shadow: inset 0 0 15px rgba(46, 204, 113, 0.2); }
.item-rare { border-color: var(--rare) !important; box-shadow: inset 0 0 15px rgba(155, 89, 182, 0.3); }
.item-epic { border-color: var(--epic) !important; box-shadow: inset 0 0 20px rgba(231, 76, 60, 0.4); }
.item-icon { font-size: 2.2em; margin-bottom: 5px; }
.item-name { font-size: 0.75em; font-weight: bold; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; margin-bottom: 10px; color: #fff; }
.slot-label { position: absolute; bottom: -24px; font-size: 0.8em; color: #aaa; white-space: nowrap; font-weight: bold; text-transform: uppercase; }
.item-attributes { font-size: 0.7em; display: flex; flex-direction: column; width: 100%; margin-bottom: auto; gap: 2px; }
.item-attr { display: flex; justify-content: space-between; padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }

.attr-pos { color: var(--success); font-weight: bold; }
.attr-neg { color: var(--danger); font-weight: bold; }
.attr-nerves { color: var(--nerves); font-weight: bold; }
.attr-skill { color: var(--skill); font-weight: bold; }

.total-stats-panel { background: rgba(0,0,0,0.4); padding: 15px; border-radius: 12px; margin-top: 20px; border: 1px solid var(--primary); }
.total-stats-panel h4 { margin: 0 0 10px 0; text-align: center; color: var(--primary); }
.total-stat-row { display: flex; justify-content: space-between; margin-bottom: 5px; font-size: 1.1em; }

/* AUKCE & DASHBOARD */
.auction-card { background: rgba(0,0,0,0.6); border: 1px solid var(--primary); border-radius: 8px; padding: 15px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.auction-header { font-size: 0.9em; font-weight: bold; color: #ccc; width: 100%; text-align: center; border-bottom: 1px solid #444; padding-bottom: 5px; }
.auction-info { width: 100%; font-size: 0.85em; display: flex; flex-direction: column; gap: 3px; }
.auction-info div { display: flex; justify-content: space-between; }
.auction-inputs { display: flex; flex-direction: column; gap: 5px; width: 100%; margin-top: 5px; }
.auction-inputs input { width: 100%; padding: 5px; box-sizing: border-box; background: #222; border: 1px solid #555; color: white; border-radius: 4px; text-align: center; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.stat-box { background: rgba(0,0,0,0.4); padding: 15px; border-radius: 8px; border-left: 4px solid var(--primary); display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 1.1em; }
.stat-val { font-weight: bold; color: var(--success); }
.mailbox-container { background: rgba(0,0,0,0.3); border-radius: 8px; padding: 15px; min-height: 300px; max-height: 500px; overflow-y: auto; }
.mail-item { background: rgba(0,0,0,0.5); border: 1px solid #444; border-radius: 6px; padding: 10px; margin-bottom: 10px; position: relative; }
.mail-header { font-size: 0.85em; color: var(--primary); margin-bottom: 5px; border-bottom: 1px solid #333; padding-bottom: 3px; }
.mail-body { font-size: 0.9em; color: #ddd; margin-bottom: 10px; }

/* MODALS & TOASTS */
.login-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.95) url('mesto.jpg') no-repeat center center fixed; background-size: cover; z-index: 9999; display: flex; align-items: center; justify-content: center; }
.login-box { position: relative; background: var(--panel); padding: 40px; border-radius: 12px; border: 2px solid var(--primary); text-align: center; width: 100%; max-width: 350px; box-shadow: 0 10px 40px rgba(0,0,0,0.8); z-index: 10; }
.login-box input, .login-box select { width: 100%; padding: 12px; margin: 10px 0 15px 0; border-radius: 5px; border: 1px solid #555; background: #222; color: #fff; font-size: 1.1em; box-sizing: border-box; text-align: center; }
.msg-box { border-color: var(--primary); }
.msg-box.success { border-color: var(--success); } .msg-box.success h2 { color: var(--success); }
.msg-box.error { border-color: var(--danger); } .msg-box.error h2 { color: var(--danger); }

.toast-container { position: fixed; bottom: 80px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 9999; pointer-events: none; }
.toast { background: var(--panel); border-left: 4px solid var(--primary); padding: 15px 20px; border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.5); color: #fff; font-weight: bold; animation: slideIn 0.3s ease-out forwards; pointer-events: auto; backdrop-filter: blur(5px); }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateX(100%); } }

/* SÍŇ SLÁVY & TALENTOVÝ STROM */
.hof-table { width: 100%; border-collapse: collapse; margin-top: 15px; background: rgba(0,0,0,0.4); border-radius: 8px; overflow: hidden; }
.hof-table th { background: var(--primary); color: #111; padding: 12px; text-align: left; font-weight: bold; }
.hof-table td { padding: 12px; border-bottom: 1px solid rgba(255,255,255,0.1); color: #fff; }
.hof-table tr:hover { background: rgba(255,255,255,0.05); }

.talent-tree { display: grid; grid-template-columns: repeat(5, 1fr); gap: 15px; background: rgba(0,0,0,0.4); padding: 20px; border-radius: 12px; margin-bottom: 30px; border: 1px solid #444; }
.talent-branch { display: flex; flex-direction: column; align-items: center; background: rgba(0,0,0,0.6); padding: 15px 10px; border-radius: 8px; border: 1px solid #555; transition: 0.2s; }
.talent-branch:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.5); border-color: var(--primary); }
.talent-branch h4 { margin: 5px 0 10px 0; font-size: 0.9em; text-align: center; color: var(--primary); }
.talent-icon { font-size: 2.5em; margin-bottom: 5px; }
.talent-points { font-weight: bold; font-size: 1.2em; color: #fff; margin-bottom: 10px; }
.btn-add-talent { background: var(--success); color: #111; border: none; padding: 6px 20px; font-weight: bold; font-size: 1.2em; border-radius: 6px; cursor: pointer; transition: 0.2s; }
.btn-add-talent:hover:not(:disabled) { background: #27ae60; transform: scale(1.1); }
.btn-add-talent:disabled { background: var(--locked); color: #888; cursor: not-allowed; }
.legendary-hammer-box { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; background: rgba(231, 76, 60, 0.1); border: 2px solid var(--epic); padding: 20px; border-radius: 8px; margin-top: 5px; }
.cross-xp-bonus { color: var(--epic); font-size: 0.8em; margin-left: 5px; animation: pulseXP 1.5s infinite; text-shadow: 0 0 5px var(--epic); }
@keyframes pulseXP { 0% { opacity: 0.7; } 50% { opacity: 1; transform: scale(1.1); } 100% { opacity: 0.7; } }

/* ========================================= */
/* --- RESPONSIVE MOBILE LOGIC --- */
/* ========================================= */
@media (max-width: 1200px) {
    .jobs-layout-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .app-container { flex-direction: column; padding-top: 90px; padding-bottom: 70px; }
    .tab-panel { padding: 15px; } /* BEZPEČNOSTNÍ POJISTKA - méně paddingu na mobilu = grid nepřeteče */

    .grid-container, .dash-grid { grid-template-columns: 1fr; }
    .character-slots { grid-template-columns: repeat(2, 130px); }
    .talent-tree { grid-template-columns: repeat(2, 1fr); }
    .legendary-hammer-box { flex-direction: column; text-align: center; gap: 15px; }

    .top-bar { padding: 10px 5px; justify-content: center; gap: 10px; flex-wrap: wrap; height: auto; }
    .mini-bar { width: 50px; }
    .top-stat { font-size: 0.9em; }

    .sidebar { width: 100%; border-radius: 0; }
    .mobile-hide { display: none; }
    .mobile-only-actions { display: flex !important; }
    .sidebar-box { box-shadow: none; padding: 0; background: transparent; border: none; }

    .nav-menu {
        position: fixed; bottom: 0; left: 0; width: 100%; height: 65px;
        background: rgba(15, 15, 15, 0.98); border-top: 2px solid var(--primary);
        display: flex; flex-direction: row; justify-content: space-around; align-items: center;
        padding: 0; z-index: 2000; box-shadow: 0 -4px 15px rgba(0,0,0,0.8); backdrop-filter: blur(10px);
    }

    .nav-btn {
        background: transparent; border: none; border-radius: 0; padding: 5px;
        flex-direction: column; justify-content: center; gap: 4px; box-shadow: none; height: 100%; width: 100%;
    }
    .nav-btn:hover, .nav-btn:active { background: rgba(255,255,255,0.05); transform: none; box-shadow: none; }

    .nav-text { font-size: 0.6em; text-align: center; }
    .nav-icon { display: block; font-size: 1.5em; text-align: center; }

    .nav-active-pulse {
        animation: none; background: rgba(46, 204, 113, 0.2); border-bottom: 3px solid var(--success) !important; border: none;
    }
    #mail-badge { position: absolute; top: 5px; right: 10px; font-size: 0.8em; }
}

@media (max-width: 800px) {
    .jobs-layout-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    /* BEZPEČNOSTNÍ POJISTKA PRO MOBILE - nedovolíme CSS Gridu přetéct mimo obrazovku */
    .task-grid { grid-template-columns: 1fr; }
    .character-slots { grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px; }
    .inventory-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; padding: 10px; }
    .talent-tree { grid-template-columns: 1fr; }
}
