/* ============================================================
   GLOBAL VARIABLES (LIGHT + DARK MODE)
   ============================================================ */

:root {
    --bg: #f1f1f1;
    --fg: #111;
    --panel: #ffffff;
    --panel-alt: #e6e6e6;
    --border: #ccc;
    --accent: #4d7398;

    --nav-bg: #333;
    --nav-fg: #fff;
}

body.dark {
    --bg: #0d0d0d;
    --fg: #e6e6e6;
    --panel: #1a1a1a;
    --panel-alt: #262626;
    --border: #444;

    --nav-bg: #111;
    --nav-fg: #eee;
}

/* ============================================================
   BASE LAYOUT
   ============================================================ */

body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: helvetica, arial, verdana;
    transition: background 0.3s ease, color 0.3s ease;
}

#app {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* ============================================================
   NAVIGATION (DEFAULT = PC / LANDSCAPE TABLET)
   ============================================================ */

#nav {
    background: var(--nav-bg);
    color: var(--nav-fg);
    width: 200px;
    height: 100vh;
    padding: 20px;
    border-right: 2px solid var(--border);

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;

    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--nav-fg);
    cursor: pointer;
    padding: 10px;
    border-radius: 10px;
    transition: background 0.2s ease;
}

.nav-item img {
    width: 40px;
    height: 40px;
    border-radius: 12px;
}

.nav-item.active {
    background: var(--accent);
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */

#content {
    flex: 1;
    margin-left: 250px;
    padding: 25px;
    overflow-y: auto;
    background: var(--panel);
    transition: background 0.3s ease;
}

/* ============================================================
   MOBILE + PORTRAIT TABLET (BOTTOM FOOTER NAV)
   ============================================================ */

@media (max-width: 767px),
       (orientation: portrait) and (max-width: 1024px) {

    #app {
        flex-direction: column;
    }

    #nav {
        width: 100%;
        height: 65px;
        padding: 10px;

        flex-direction: row;
        justify-content: space-around;
        align-items: center;

        position: fixed;
        bottom: 0;
        top: auto;
        left: 0;

        border-right: none;
        border-top: 2px solid var(--border);
    }

    #content {
        margin-left: 0;
        padding: 15px;
        padding-bottom: 80px; /* prevent nav overlap */
    }

    .nav-item img {
        width: 30px;
        height: 30px;
    }
}

/* ============================================================
   TABLET LANDSCAPE (SLIM SIDEBAR)
   ============================================================ */

@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    #nav {
        width: 180px;
        padding: 15px;
    }

    #content {
        margin-left: 180px;
        padding: 20px;
    }
}

/* ============================================================
   CASTLE GRID + CARDS (RESPONSIVE)
   ============================================================ */

.castle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.castle-card {
    background: var(--panel-alt);
    border: 2px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.castle-card:hover {
    transform: scale(1.03);
}

.castle-img {
    width: 100%;
    height: 140px;
    background-size: cover;
    background-position: center;
}

.castle-info {
    padding: 10px;
    font-size: 14px;
}

/* ============================================================
   STAGGERED TEXT ANIMATION
   ============================================================ */

.stagger {
    opacity: 0;
    transform: translateY(10px);
    animation: fadeUp 0.6s ease forwards;
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.settings-page {
    max-width: 600px;
    margin: 0 auto;
}

.settings-section {
    background: var(--panel-alt);
    border: 2px solid var(--border);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.settings-btn {
    padding: 12px 20px;
    font-size: 16px;
    font-weight: bold;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.settings-select {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border-radius: 8px;
    border: 2px solid var(--border);
    background: var(--panel);
    color: var(--fg);
}
.help-page {
    max-width: 700px;
    margin: 0 auto;
}

.help-section {
    background: var(--panel-alt);
    border: 2px solid var(--border);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.help-section ul {
    padding-left: 20px;
}

.help-section li {
    margin-bottom: 8px;
}
.overview-page {
    max-width: 900px;
    margin: 0 auto;
}

.overview-section {
    background: var(--panel-alt);
    border: 2px solid var(--border);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.overview-card {
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.overview-card:hover {
    transform: scale(1.03);
}

.overview-icon {
    width: 50px;
    height: 50px;
    margin-bottom: 10px;
}
.chats-page {
    max-width: 900px;
    margin: 0 auto;
}

.chats-section {
    background: var(--panel-alt);
    border: 2px solid var(--border);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.chats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.chat-card {
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.chat-card:hover {
    transform: scale(1.03);
}

.chat-icon {
    width: 50px;
    height: 50px;
    margin-bottom: 10px;
}
/* CHAT PANEL */
.chat-panel {
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    max-width: 900px;
    margin: 0 auto;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.chat-status {
    font-size: 14px;
    color: var(--fg);
}

.status-dot {
    width: 10px;
    height: 10px;
    background: #4caf50;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

.chat-messages {
    height: 400px;
    overflow-y: auto;
    background: var(--panel-alt);
    border: 2px solid var(--border);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.chat-msg {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.chat-time {
    font-size: 12px;
    opacity: 0.7;
    margin-left: 8px;
}

.chat-text {
    margin-top: 5px;
}

.chat-input-area {
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid var(--border);
    background: var(--panel);
    color: var(--fg);
}

.chat-input-area button {
    padding: 12px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}
.chat-panel {
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    max-width: 900px;
    margin: 0 auto;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.chat-status {
    font-size: 14px;
    color: var(--fg);
}

.status-dot {
    width: 10px;
    height: 10px;
    background: #4caf50;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
}

.chat-messages {
    height: 400px;
    overflow-y: auto;
    background: var(--panel-alt);
    border: 2px solid var(--border);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.chat-msg {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.chat-time {
    font-size: 12px;
    opacity: 0.7;
    margin-left: 8px;
}

.chat-text {
    margin-top: 5px;
}

.chat-input-area {
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid var(--border);
    background: var(--panel);
    color: var(--fg);
}

.chat-input-area button {
    padding: 12px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}
.pm-user-select {
    margin-bottom: 15px;
}

.pm-user-select select {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid var(--border);
    background: var(--panel);
    color: var(--fg);
}

.power-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.power-card {
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}

.power-card.total {
    background: var(--accent);
    color: #fff;
}

.power-value {
    font-size: 24px;
    font-weight: bold;
    margin-top: 10px;
}

.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.overview-card {
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 20px;
}

.overview-card h3 {
    margin-top: 0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.big-number {
    font-size: 32px;
    font-weight: bold;
    margin: 10px 0;
}

.overview-card button {
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.castle-filters {
    margin-bottom: 20px;
    display: flex;
    justify-content: flex-start;
}

.castle-filters select {
    padding: 10px;
    font-size: 16px;
    border-radius: 8px;
    border: 2px solid var(--border);
    background: var(--panel);
    color: var(--fg);
}

