:root {
    --bg-dark: #0a0a12;
    --bg-panel: #151520;
    --primary: #00ff9d;
    /* Neon Green */
    --secondary: #00d2ff;
    /* Neon Blue */
    --accent: #ff0055;
    /* Neon Red/Pink */
    --text-main: #ffffff;
    --text-dim: #8888aa;
    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Roboto', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--bg-panel);
    padding-bottom: 10px;
}

h1 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    letter-spacing: 2px;
}

.highlight {
    color: var(--primary);
}

/* Buttons */
button {
    cursor: pointer;
    font-family: var(--font-display);
    border: none;
    transition: all 0.2s ease;
}

.primary-btn {
    background: var(--primary);
    color: var(--bg-dark);
    padding: 10px 20px;
    font-weight: bold;
    clip-path: polygon(10% 0, 100% 0, 100% 70%, 90% 100%, 0 100%, 0 30%);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px var(--primary);
}

.secondary-btn {
    background: transparent;
    border: 1px solid var(--secondary);
    color: var(--secondary);
    padding: 8px 16px;
}

.secondary-btn:hover {
    background: rgba(0, 210, 255, 0.1);
}

.mega-btn {
    background: linear-gradient(135deg, var(--accent), #ff5e00);
    color: white;
    font-size: 2rem;
    padding: 20px 40px;
    width: 100%;
    max-width: 600px;
    font-weight: 900;
    letter-spacing: 3px;
    clip-path: polygon(5% 0, 100% 0, 100% 80%, 95% 100%, 0 100%, 0 20%);
    box-shadow: 0 0 20px rgba(255, 0, 85, 0.4);
}

.mega-btn:active {
    transform: scale(0.98);
}

/* Grid */
.player-grid {
    flex: 1;
    display: grid;
    gap: 20px;
    padding: 10px;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

.player-card {
    background: var(--bg-panel);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.player-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 255, 157, 0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.player-name {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--secondary);
}

.player-lvl {
    font-size: 0.9rem;
    color: var(--text-dim);
}

.xp-bar-container {
    width: 100%;
    height: 8px;
    background: #000;
    margin-bottom: 20px;
    border-radius: 4px;
}

.xp-bar-fill {
    height: 100%;
    background: var(--secondary);
    width: 0%;
    transition: width 0.5s ease;
    box-shadow: 0 0 5px var(--secondary);
}

.exercise-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.ex-name {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.ex-reps {
    font-size: 3rem;
    font-family: var(--font-display);
    color: var(--primary);
}

.ex-meta {
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--text-dim);
    display: flex;
    gap: 10px;
}

.tag {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.card-actions {
    margin-top: auto;
    display: flex;
    justify-content: flex-end;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.2rem;
    padding: 5px;
}

.icon-btn:hover {
    color: var(--text-main);
}

/* Controls Area */
.controls-area {
    display: flex;
    justify-content: center;
    padding-top: 20px;
}

.profile-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #222;
    margin-bottom: 10px;
    border: 1px solid #333;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-item:hover {
    background: #2a2a2a;
}

.profile-item.active {
    border-color: var(--primary);
    background: rgba(0, 255, 157, 0.05);
}

.profile-item .p-name {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--text-main);
}

.profile-item .p-status {
    font-size: 0.9rem;
    color: var(--text-dim);
}

.profile-item.active .p-status {
    color: var(--primary);
    font-weight: bold;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(5px);
}

.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-panel);
    width: 90%;
    max-width: 500px;
    border: 1px solid var(--secondary);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

/* Large Modal for Settings */
.modal-content.large-modal {
    max-width: 900px;
    height: 85vh;
}

.modal-header {
    padding: 15px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 15px;
    border-top: 1px solid #333;
    display: flex;
    justify-content: flex-end;
}

.close-btn,
.close-btn-profiles {
    background: none;
    color: var(--text-main);
    font-size: 1.5rem;
}

/* Settings Layout */
.settings-columns {
    display: flex;
    gap: 20px;
    height: 100%;
}

.settings-col {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
}

.toggle-group {
    display: flex;
    gap: 10px;
}

.toggle-btn {
    flex: 1;
    background: #222;
    color: #888;
    padding: 8px;
    border: 1px solid #444;
}

.toggle-btn.active {
    background: var(--primary);
    color: var(--bg-dark);
    border-color: var(--primary);
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-tag {
    background: #222;
    border: 1px solid #444;
    padding: 5px 10px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.filter-tag.selected {
    background: var(--secondary);
    color: var(--bg-dark);
    border-color: var(--secondary);
}

/* Exercise List Styling */
.search-input {
    width: 100%;
    padding: 10px;
    background: #222;
    border: 1px solid #444;
    color: white;
    margin-bottom: 10px;
    border-radius: 4px;
}

.exercise-list-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    padding: 5px;
    color: var(--text-dim);
    font-size: 0.8rem;
    border-bottom: 1px solid #333;
}

.scroll-list.expanded-list {
    flex: 1;
    max-height: none;
    overflow-y: auto;
    border: 1px solid #333;
    padding: 5px;
    background: #0f0f15;
}

.weight-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    align-items: center;
    padding: 8px 5px;
    border-bottom: 1px solid #222;
    font-size: 0.9rem;
}

.weight-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.weight-controls button {
    background: #333;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.weight-val {
    display: inline-block;
    width: 30px;
    text-align: center;
    font-family: monospace;
}

.mult-input {
    width: 50px;
    background: #222;
    border: 1px solid #444;
    color: var(--primary);
    padding: 2px 5px;
    border-radius: 4px;
    text-align: center;
}

.ex-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tooltip-container {
    position: relative;
    display: inline-block;
}

.tooltip-icon {
    background: #333;
    color: var(--text-dim);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    cursor: help;
    border: 1px solid #555;
}

.tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #000;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 10;
    bottom: 125%;
    /* Position above */
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    border: 1px solid var(--secondary);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    font-size: 0.8rem;
    pointer-events: none;
}

.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Level Up Special */
.levelup-content {
    text-align: center;
    border-color: var(--accent);
    box-shadow: 0 0 50px rgba(255, 0, 85, 0.2);
}

.levelup-content h2 {
    font-family: var(--font-display);
    color: var(--accent);
    font-size: 3rem;
    margin-bottom: 20px;
}

.levelup-details {
    font-size: 1.5rem;
    margin-bottom: 30px;
}

#lvl-up-new {
    color: var(--primary);
    font-weight: bold;
    font-size: 2rem;
}

/* Responsive Grid Logic */
.grid-1 {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.grid-2 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
}

.grid-3 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.grid-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

@media (max-width: 768px) {
    .settings-columns {
        flex-direction: column;
    }

    .modal-content.large-modal {
        height: 95vh;
        max-width: 95%;
    }
}