/* style.css - The Master Stylesheet */

:root {
    /* Color Palette - Change these to re-theme the app */
    --bg-dark: #121212;
    --bg-card: #1e1e1e;
    --bg-input: #333333;
    
    --text-main: #ffffff;
    --text-muted: #aaaaaa;
    
    --primary: #03dac6;    /* Teal (Actions) */
    --secondary: #6200ea;  /* Purple (Party/Stats) */
    --accent: #ffb74d;     /* Orange (Wallet/Gold) */
    --success: #00e676;    /* Green (XP/Success) */
    --danger: #ff5252;     /* Red (Boss/Logout) */
    --warning: #f1c40f;    /* Yellow (Ultimate) */
    
    /* Spacing Constants */
    --pad-sm: 8px;
    --pad-md: 12px;
    --pad-lg: 15px;
    --radius: 8px;
}

/* --- BASE RESET --- */
body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 15px;
    padding-bottom: 40px; /* Space for scrolling on mobile */
}

a { text-decoration: none; color: inherit; }
h1, h2, h3 { margin-top: 0; line-height: 1.2; }

/* --- LAYOUT & CONTAINERS --- */
.card {
    background: var(--bg-card);
    padding: var(--pad-lg);
    border-radius: var(--radius);
    margin-bottom: 15px;
    border: 1px solid #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.flex-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

/* --- TYPOGRAPHY --- */
.label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.val {
    font-size: 1.2rem;
    font-weight: bold;
    display: block;
}

.text-center { text-align: center; }
.text-right { text-align: right; }

/* --- FORMS & INPUTS --- */
input, select, textarea {
    width: 100%;
    padding: var(--pad-md);
    background: var(--bg-input);
    border: 1px solid #444;
    color: var(--text-main);
    border-radius: var(--radius);
    margin-bottom: 10px;
    box-sizing: border-box; /* Prevents width overflow */
    font-size: 1rem;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}

/* --- BUTTONS --- */
button, .btn {
    cursor: pointer;
    border: none;
    font-weight: bold;
    font-size: 1rem;
    border-radius: var(--radius);
    transition: transform 0.1s, opacity 0.2s;
}

button:active, .btn:active { transform: scale(0.98); }

/* Standard Block Button */
.big-btn {
    display: block;
    width: 100%;
    padding: var(--pad-md);
    text-align: center;
    background: var(--primary);
    color: #000;
    margin-bottom: 10px;
    box-sizing: border-box;
}

/* Button Variants */
.btn-success { background: var(--success); color: #000; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-primary { background: var(--primary); color: #000; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-dark { background: #333; color: #fff; }

/* Bottom Row (Half Width Buttons) */
.bottom-row { display: flex; gap: 10px; margin-top: 20px; }
.bottom-btn {
    flex: 1;
    padding: var(--pad-md);
    text-align: center;
    border-radius: var(--radius);
    font-weight: bold;
    font-size: 0.9rem;
    color: white;
}

/* --- COMPONENTS: STATS HEADER --- */
.stats-card {
    background: linear-gradient(135deg, var(--secondary) 0%, #3700b3 100%);
    padding: var(--pad-lg);
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 4px 10px rgba(98, 0, 234, 0.3);
    border: none;
}
.level-badge { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; opacity: 0.8; }
.level-number { font-size: 2rem; font-weight: bold; margin: 2px 0 5px 0; }

/* --- COMPONENTS: PROGRESS BARS --- */
.bar-container {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    height: 8px;
    margin-top: 8px;
    overflow: hidden;
}
.xp-bar { background: var(--success); height: 100%; transition: width 0.5s; }
.hp-bar-fill { background: linear-gradient(90deg, var(--danger), #c0392b); height: 100%; transition: width 0.5s; }

/* --- COMPONENTS: EXERCISE CARDS --- */
.ex-card {
    background: var(--bg-card);
    padding: var(--pad-md);
    border-radius: var(--radius);
    margin-bottom: 10px;
    border-left: 4px solid var(--secondary);
}
.card-cardio { border-left-color: var(--accent); }
.ex-title { font-weight: bold; display: block; margin-bottom: 8px; }

/* --- COMPONENTS: MESSAGES --- */
.msg { padding: var(--pad-md); border-radius: var(--radius); margin-bottom: 15px; text-align: center; font-weight: bold; }
.msg-success { background: rgba(0, 230, 118, 0.15); border: 1px solid var(--success); color: var(--success); }
.msg-error { background: rgba(255, 82, 82, 0.15); border: 1px solid var(--danger); color: var(--danger); }

/* --- UTILITIES --- */
.back-link { display: block; margin-top: 25px; color: var(--text-muted); text-align: center; font-size: 0.9rem; }
.gm-link { text-align: center; margin: 15px 0 5px 0; font-size: 0.8rem; color: #555; display: block; }

/* --- COMPONENT: ICON GRID (For Boss Creator) --- */
.icon-grid {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap; /* Wraps on small screens */
    justify-content: center;
}

.icon-option {
    font-size: 2rem;
    background: var(--bg-input);
    padding: 10px;
    border-radius: var(--radius);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
}

/* Hide the actual radio circle */
.icon-option input { 
    display: none; 
}

/* Highlight selected */
.icon-option.selected {
    border-color: var(--primary);
    background: var(--bg-card);
    box-shadow: 0 0 10px rgba(3, 218, 198, 0.3);
}

.input-group-row {
    display: flex;
    gap: 10px;
}

/* --- COMPONENT: BOSS BATTLE --- */

/* The Boss Card Container */
.boss-card {
    background: var(--bg-card);
    padding: var(--pad-lg);
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid #333;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    text-align: center;
}

.boss-avatar {
    font-size: 4rem;
    display: block;
    margin-bottom: 10px;
    line-height: 1;
}

.boss-name {
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0;
    color: var(--danger);
}

.reward-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 5px;
}

/* Health Bar */
.hp-wrapper {
    background: #000;
    height: 25px;
    border-radius: 15px;
    overflow: hidden;
    margin: 15px auto;
    border: 2px solid #333;
    position: relative;
    max-width: 100%;
}

.hp-fill {
    background: linear-gradient(90deg, var(--danger), #c0392b);
    height: 100%;
    transition: width 0.3s ease-out;
    width: 0%; /* Default, will be set by PHP inline style */
}

.hp-text {
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    line-height: 25px;
    font-size: 0.8rem;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
    color: #fff;
    text-align: center;
    z-index: 2;
}

/* AP Display */
.ap-display {
    font-size: 1.2rem;
    margin: 20px auto;
    background: #2c2c2c;
    display: block;
    padding: 8px 20px;
    border-radius: 20px;
    text-align: center;
    width: fit-content;
    border: 1px solid #444;
}

.ap-val {
    color: var(--primary);
    font-weight: bold;
}

/* Skills Grid */
.skills-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
}

.skill-btn {
    background: var(--bg-input);
    border: 2px solid #333;
    color: #fff;
    padding: 15px 10px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.skill-btn:hover {
    background: #383838;
    border-color: #555;
}

.skill-btn:active {
    transform: scale(0.98);
}

.s-name {
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 5px;
    display: block;
}

.s-cost { color: var(--primary); font-size: 0.8rem; }
.s-dmg { color: var(--danger); font-size: 0.8rem; }

/* Ultimate Button (Spans 2 columns) */
.ult-btn {
    border-color: var(--warning);
    background: rgba(241, 196, 15, 0.1);
    grid-column: span 2;
}

.ult-btn:hover { 
    background: rgba(241, 196, 15, 0.2); 
}

/* Message Box Support */
.msg-box {
    background: #333;
    color: var(--primary);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: bold;
    border: 1px solid var(--primary);
    text-align: center;
}

/* --- COMPONENT: LOG WORKOUT --- */

/* Header Area with Day Selector */
.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

/* The "Edit Routine" Link */
.edit-link {
    display: block;
    text-align: right;
    color: var(--primary);
    font-size: 0.9rem;
    margin-bottom: 20px;
    text-decoration: none;
    font-weight: bold;
}

/* --- COMPONENT: STEP TRACKER WIDGET --- */
.steps-box {
    background: #2c2c2c;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid #444;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
}

.step-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* The Progress Bar Container */
.progress-bg {
    background: #000;
    height: 10px;
    border-radius: 5px;
    margin-top: 10px;
    overflow: hidden;
    border: 1px solid #333;
}

/* The Moving Fill */
.progress-fill {
    background: linear-gradient(90deg, var(--success), #00b0ff);
    height: 100%;
    transition: width 0.5s ease-out;
    width: 0%; /* Default */
}

/* Status Text Below Bar */
.step-msg {
    text-align: center; 
    font-size: 0.8rem; 
    margin-top: 8px;
}
.step-msg.remain { color: var(--accent); }
.step-msg.done { color: var(--success); font-weight: bold; }

/* Input Group adjustments for Log Page */
.input-group {
    display: flex;
    gap: 10px;
}

/* --- COMPONENT: ROUTINE BUILDER (edit_routine.php) --- */

/* Day Navigation Scroll Bar */
.day-nav {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 10px; /* Space for scrollbar */
    scrollbar-width: thin; /* Firefox */
}

/* Individual Day Buttons */
.day-btn {
    background: var(--bg-input);
    color: var(--text-muted);
    padding: 10px 20px;
    border-radius: 20px; /* Pill shape */
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid transparent;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.day-btn:hover {
    background: #444;
}

/* Active Day Button */
.day-btn.active {
    background: var(--primary);
    color: #000;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(3, 218, 198, 0.4);
}

/* Exercise List Container */
.ex-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Individual Exercise Item */
.ex-item {
    background: var(--bg-card);
    padding: var(--pad-md);
    margin-bottom: 10px;
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between; /* Pushes delete button to far right */
    align-items: center;
    border-left: 4px solid var(--secondary);
    border: 1px solid #333; /* Subtle border */
    border-left-width: 4px; /* Maintain the accent color width */
}

/* Type Tag (e.g., "Cardio") */
.type-tag {
    font-size: 0.7rem;
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    color: var(--text-muted);
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* The Delete Button (X) */
.btn-del {
    background: var(--danger);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    line-height: 1;
    margin-left: 10px;
}

.btn-del:hover {
    background: #d32f2f;
}

/* "Add New" Form Container */
.add-box {
    background: #2c2c2c;
    padding: 20px;
    border-radius: 12px;
    margin-top: 25px;
    border: 1px solid #444;
}

/* Step Goal Settings Box at top */
.settings-box {
    background: #2c2c2c; 
    padding: 15px; 
    border-radius: 10px; 
    margin-bottom: 20px; 
    border: 1px solid var(--primary);
}
.card-iso { 
    border-left-color: #d500f9; 
}
.card-bw { border-left-color: #00bcd4; } /* Cyan for Bodyweight */

