/* Campaign Manager - RETRO BBS THEME (v2 - Mobile Fix) */

/* ======================================== */
/* === 0. Imports & Variables === */
/* ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

:root {
    --font-header: 'Press Start 2P', cursive;
    --font-body: 'VT323', monospace;

    --color-pink: #ff0080;
    --color-cyan: #00ffff;
    --color-green: #00ff41;
    --color-yellow: #ffff00;
    --color-white: #f0f0f0;

    --color-bg-dark: #0a0a23;
    --color-bg-textarea: #111;
    --color-bg-gradient: linear-gradient(135deg, #0f1c3d, #0a0a23, #0a0a23);
    
    --color-text-body: var(--color-green);
    --color-border-main: var(--color-green);
    --color-shadow: rgba(0, 0, 0, 0.7);
}

/* ======================================== */
/* === 1. Reset & Base Styles === */
/* ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    color: var(--color-text-body);
    background: var(--color-bg-gradient);
    min-height: 100vh;
    line-height: 1.5;
    font-size: 20px;
    -webkit-font-smoothing: none;
    image-rendering: pixelated;
}

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 20px;
}

/* ======================================== */
/* === 2. Branding & Typography === */
/* ======================================== */

.header-logo, .hero-logo {
    max-width: 250px;
    height: auto;
    margin-bottom: 15px;
}

.hero-logo {
    display: block;
    margin: 0 auto 20px auto;
    max-width: 400px;
    border: 4px double var(--color-pink);
    padding: 10px;
    background: #000;
}

h2 {
    font-family: var(--font-header);
    font-size: 1.5rem;
    text-align: center;
    color: var(--color-cyan);
    letter-spacing: 1px;
    margin-bottom: 25px;
    text-shadow: 2px 2px 0px var(--color-pink);
}

h3 {
    font-family: var(--font-header);
    color: var(--color-yellow);
    margin-bottom: 15px;
    font-size: 1.1rem;
    border-bottom: 2px solid var(--color-yellow);
    padding-bottom: 8px;
}

.status {
    display: inline-block;
    padding: 4px 8px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 0;
    border: 1px solid currentColor;
}

.status-recruiting { color: #00ff41; background: rgba(0, 255, 65, 0.1); }
.status-active { color: #00ffff; background: rgba(0, 255, 255, 0.1); }
.status-on_hold { color: #ffff00; background: rgba(255, 255, 0, 0.1); }
.status-completed { color: #ff0080; background: rgba(255, 0, 128, 0.1); }

/* ==================================================== */
/* === 3. BBS Components (Buttons, Boxes) === */
/* ================================================== */

.btn {
    font-family: var(--font-header);
    font-size: 0.9rem;
    padding: 10px 20px;
    border: 2px solid;
    background: var(--color-text-body);
    color: var(--color-bg-dark);
    text-decoration: none;
    letter-spacing: 1px;
    cursor: pointer;
    text-align: center;
    border-radius: 0;
    box-shadow: 3px 3px 0px var(--color-shadow);
    text-transform: uppercase;
    transition: all 0.1s ease-out;
    -webkit-appearance: none;
}

.btn:hover, .btn:active {
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0px var(--color-shadow);
}

.btn-primary { border-color: var(--color-pink); background: var(--color-pink); }
.btn-secondary { border-color: var(--color-cyan); background: var(--color-cyan); }
.btn-danger { border-color: #ff4444; background: #ff4444;}
.btn-small { padding: 8px 15px; font-size: 0.8rem; }

.campaign-card, .character-card, .form-section, .character-section,
.auth-form, .stat-block, .resource-block, .character-header, .game-info {
    background: #000000;
    border: 4px double var(--color-border-main);
    padding: 20px;
    box-shadow: 6px 6px 0px var(--color-shadow);
}

.character-header { border-color: var(--color-pink); }

.resource-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 10px 0;
}
.btn-adjust {
    font-family: var(--font-header);
    background: none;
    border: 2px solid var(--color-cyan);
    color: var(--color-cyan);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 12px;
    margin: 0 15px;
}
.btn-adjust:hover {
    background: var(--color-cyan);
    color: var(--color-bg-dark);
}

/* ======================================== */
/* === 4. Forms & Inputs === */
/* ======================================== */

.form-group label {
    font-family: var(--font-header);
    font-size: 0.9rem;
    display: block;
    margin-bottom: 10px;
    color: var(--color-cyan);
}

.form-group input:not([type="checkbox"]):not([type="radio"]),
select, .form-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--color-border-main);
    background: #111;
    color: var(--color-text-body);
    font: inherit;
    font-size: 18px;
    border-radius: 0;
    -webkit-appearance: none;
    appearance: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.form-group select { background-image: none; padding-right: 10px; }

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--color-pink);
    background: #222;
}

/* Makes custom perk/quirk textareas taller */
.custom-ability-textarea {
    width: 100%;
    min-height: 80px; /* Adjust height as needed */
    resize: vertical;
    /* Inherit form styles */
    padding: 10px;
    border: 2px solid var(--color-border-main);
    background: var(--color-bg-textarea);
    color: var(--color-text-body);
    font: inherit;
    font-size: 16px;
    border-radius: 0;
}

/* ======================================== */
/* === 5. Page-Specific & Layout === */
/* ======================================== */

.dashboard-header, .hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 4px double var(--color-border-main);
}
.hero { flex-direction: column; border-bottom: none; }

.dashboard-header .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.campaigns-grid, .characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.profile-forms-grid, .abilities-display-grid, .stats-grid, .resources-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

/* Button groups on desktop */
.character-actions, .dashboard-actions, .form-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

#dice-log, .current-abilities-list {
    min-height: 100px;
    max-height: 400px;
    overflow-y: auto;
    padding: 15px;
    background: #000;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* ======================================== */
/* === 8. Perk Detail Styling === */
/* ======================================== */

.ability-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ability-item > span {
    flex-grow: 1;         /* Allows the text to take available space */
    flex-shrink: 1;       /* Allows the text to shrink as needed */
    white-space: normal;  /* This is the key property to allow text wrapping */
    margin-right: 10px;   /* A little more space for readability */
    min-width: 0;         /* Helps flexbox calculate wrapping correctly */
}

.perk-detail-input {
    flex-grow: 1; /* Allows the input to fill the available space */
    font-family: var(--font-body);
    font-size: 16px !important;
    padding: 6px !important;
    background: #222 !important;
    border: 1px solid var(--color-cyan) !important;
    color: var(--color-cyan) !important;
    min-width: 50px; /* Prevents it from becoming too small */
}

.remove-ability {
    background: none;
    border: none;
    color: var(--color-pink);
    font-size: 20px;
    cursor: pointer;
    padding: 0 5px;
    text-shadow: none;
}

.perk-detail-display {
    color: var(--color-yellow);
    padding-left: 20px;
    font-size: 0.9em;
    margin-top: -5px;
    margin-bottom: 10px;
}

/* ======================================== */
/* === 6. Mobile Responsive === */
/* ======================================== */

@media (max-width: 768px) {
    body { font-size: 18px; }

    .header-logo, .hero-logo { max-width: 200px; }
    .hero-logo { max-width: 90%; }
    h2 { font-size: 1.2rem; }

    .dashboard-header { flex-direction: column; gap: 20px; }
    .dashboard-header .user-info {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }

    .campaigns-grid, .characters-grid, .profile-forms-grid,
    .abilities-display-grid, .stats-grid, .resources-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .form-group input, .form-group select, .form-group textarea {
        font-size: 16px; /* Prevents iOS auto-zoom */
    }

    /* --- THIS IS THE CRITICAL FIX --- */
    /* Select all button containers */
    .auth-buttons, .character-actions, .form-actions,
    .section-actions, .dashboard-actions, .delete-section form {
        display: flex;
        flex-direction: column; /* Stack buttons vertically */
        align-items: stretch;   /* Make them all the same width */
        gap: 15px;
        width: 100%;
        margin-top: 20px;
    }

    /* Select the buttons themselves inside those containers */
    .auth-buttons > *, .character-actions > *, .form-actions > *,
    .section-actions > *, .dashboard-actions > *, .delete-section .btn {
        margin: 0; /* Reset any default margins */
    }
}