/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --accent-primary: #e94560;
    --accent-secondary: #00d9ff;
    --text-primary: #ffffff;
    --text-secondary: #b8b8b8;
    --text-muted: #6b6b6b;
    --border-color: #2a2a4a;
    --success: #4ade80;
    --warning: #fbbf24;
    --error: #ef4444;
    --panel-bg: rgba(22, 33, 62, 0.95);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* Necrons Theme - Green/Black/Silver */
[data-theme="necrons"] {
    --bg-primary: #0a0a0a;
    --bg-secondary: #0d1a0d;
    --bg-tertiary: #1a2e1a;
    --accent-primary: #00ff88;
    --accent-secondary: #c0c0c0;
    --text-primary: #e0ffe0;
    --text-secondary: #a0c8a0;
    --text-muted: #4a6a4a;
    --border-color: #1a3a1a;
    --panel-bg: rgba(13, 26, 13, 0.95);
}

/* Space Marines Theme - Blue/Gold */
[data-theme="space-marines"] {
    --bg-primary: #0a1628;
    --bg-secondary: #102040;
    --bg-tertiary: #1a3060;
    --accent-primary: #ffd700;
    --accent-secondary: #4a90d9;
    --text-primary: #ffffff;
    --text-secondary: #b8c8d8;
    --text-muted: #5a6a7a;
    --border-color: #2a3a5a;
    --panel-bg: rgba(16, 32, 64, 0.95);
}

/* Chaos Theme - Red/Black */
[data-theme="chaos"] {
    --bg-primary: #1a0a0a;
    --bg-secondary: #2a0a0a;
    --bg-tertiary: #3a1a1a;
    --accent-primary: #ff2020;
    --accent-secondary: #ff8040;
    --text-primary: #ffe0e0;
    --text-secondary: #c8a0a0;
    --text-muted: #6a4a4a;
    --border-color: #3a1a1a;
    --panel-bg: rgba(42, 10, 10, 0.95);
}

/* Orks Theme - Green/Brown */
[data-theme="orks"] {
    --bg-primary: #1a1a0a;
    --bg-secondary: #2a2a10;
    --bg-tertiary: #3a3a1a;
    --accent-primary: #88cc00;
    --accent-secondary: #cc8800;
    --text-primary: #f0f0d0;
    --text-secondary: #b8b898;
    --text-muted: #6a6a4a;
    --border-color: #3a3a2a;
    --panel-bg: rgba(42, 42, 16, 0.95);
}

/* Aeldari Theme - White/Blue */
[data-theme="aeldari"] {
    --bg-primary: #101828;
    --bg-secondary: #182840;
    --bg-tertiary: #203858;
    --accent-primary: #e0f0ff;
    --accent-secondary: #60a0ff;
    --text-primary: #ffffff;
    --text-secondary: #c0d0e0;
    --text-muted: #6080a0;
    --border-color: #304060;
    --panel-bg: rgba(24, 40, 64, 0.95);
}

/* Tyranids Theme - Purple/Bone */
[data-theme="tyranids"] {
    --bg-primary: #1a0a20;
    --bg-secondary: #2a1030;
    --bg-tertiary: #3a1a40;
    --accent-primary: #cc66ff;
    --accent-secondary: #e8d8b8;
    --text-primary: #f0e0ff;
    --text-secondary: #c8b0d8;
    --text-muted: #6a4a7a;
    --border-color: #3a2a4a;
    --panel-bg: rgba(42, 16, 48, 0.95);
}

/* Tau Theme - Orange/White */
[data-theme="tau"] {
    --bg-primary: #1a1410;
    --bg-secondary: #2a2018;
    --bg-tertiary: #3a2820;
    --accent-primary: #ff8020;
    --accent-secondary: #f0f0f0;
    --text-primary: #fff8f0;
    --text-secondary: #d8c8b8;
    --text-muted: #7a6a5a;
    --border-color: #3a3028;
    --panel-bg: rgba(42, 32, 24, 0.95);
}

/* Imperial Guard Theme - Olive/Tan */
[data-theme="imperial-guard"] {
    --bg-primary: #141a10;
    --bg-secondary: #1e2818;
    --bg-tertiary: #283820;
    --accent-primary: #c8b060;
    --accent-secondary: #88a060;
    --text-primary: #f0f0e0;
    --text-secondary: #c0c0a0;
    --text-muted: #606850;
    --border-color: #303828;
    --panel-bg: rgba(30, 40, 24, 0.95);
}

/* Drukhari Theme - Purple/Black */
[data-theme="drukhari"] {
    --bg-primary: #0a0a14;
    --bg-secondary: #141428;
    --bg-tertiary: #1e1e3c;
    --accent-primary: #9040ff;
    --accent-secondary: #40ffff;
    --text-primary: #e8e0ff;
    --text-secondary: #b0a8c8;
    --text-muted: #5a5070;
    --border-color: #2a2a4a;
    --panel-bg: rgba(20, 20, 40, 0.95);
}

/* Adeptus Mechanicus Theme - Red/Metallic */
[data-theme="admech"] {
    --bg-primary: #141010;
    --bg-secondary: #201818;
    --bg-tertiary: #2c2020;
    --accent-primary: #cc2020;
    --accent-secondary: #c0a080;
    --text-primary: #f0e8e0;
    --text-secondary: #c0b0a0;
    --text-muted: #686058;
    --border-color: #383028;
    --panel-bg: rgba(32, 24, 24, 0.95);
}

body {
    font-family: 'Roboto', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Header */
.app-header {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--accent-primary);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1920px;
    margin: 0 auto;
}

.logo {
    font-family: 'Oswald', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.header-actions {
    display: flex;
    align-items: stretch;
    gap: 0.75rem;
    position: relative;
    z-index: 101;
}

.header-actions .dropdown {
    display: flex;
}

.header-actions .dropdown .hamburger-btn {
    height: 100%;
}



/* Buttons */
.btn {
    font-family: 'Oswald', sans-serif;
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent-primary);
    color: var(--text-primary);
}

.btn-primary:hover {
    background: #ff6b82;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--accent-secondary);
    color: var(--bg-primary);
}

.btn-small {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--success);
    color: var(--bg-primary);
}

.btn-warning {
    background: var(--warning);
    color: var(--bg-primary);
}

.btn-warning:hover {
    background: #f59e0b;
}

/* Main Layout */
.main-content {
    display: grid;
    grid-template-columns: 320px 1fr 350px;
    gap: 1rem;
    padding: 1rem;
    max-width: 1920px;
    margin: 0 auto;
    height: calc(100vh - 70px);
}

/* Panels */
.panel {
    background: var(--panel-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-header {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
}

/* Search and Filters */
.search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-secondary);
}

.filter-bar {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.filter-select {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.85rem;
}

/* Unit List */
.unit-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.unit-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.unit-card:hover {
    border-color: var(--accent-secondary);
    transform: translateX(3px);
}

.unit-card.selected {
    border-color: var(--accent-primary);
    background: rgba(233, 69, 96, 0.1);
}

.unit-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.unit-name {
    font-family: 'Oswald', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}

.unit-points {
    font-size: 0.85rem;
    color: var(--accent-secondary);
    font-weight: 500;
}

.unit-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.keyword-tag {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    text-transform: uppercase;
}

.keyword-tag.character {
    background: rgba(233, 69, 96, 0.3);
    color: var(--accent-primary);
}

.keyword-tag.battleline {
    background: rgba(74, 222, 128, 0.2);
    color: var(--success);
}

/* Army List Panel */
.army-list-panel {
    display: flex;
    flex-direction: column;
}

.army-header {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.army-name-row {
    margin-bottom: 0.75rem;
}

.army-name-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-family: 'Oswald', sans-serif;
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: 1px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.army-name-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.army-name-input::placeholder {
    color: var(--text-muted);
}

.army-info {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.faction-select,
.detachment-select {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.faction-select:disabled,
.detachment-select:disabled {
    opacity: 0.5;
}

.points-display {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.battle-size select {
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.points-counter {
    font-family: 'Oswald', sans-serif;
    font-size: 1.25rem;
    min-width: 150px;
    text-align: center;
}

.points-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
}

.points-progress {
    height: 100%;
    background: var(--success);
    transition: all 0.3s ease;
    width: 0%;
}

.points-progress.warning {
    background: var(--warning);
}

.points-progress.over {
    background: var(--error);
}

/* Detachment Rule Banner */
.detachment-rule-banner {
    margin: 0 1rem;
    background: linear-gradient(135deg, rgba(0, 200, 150, 0.1), rgba(0, 150, 200, 0.1));
    border: 1px solid rgba(0, 200, 150, 0.3);
    border-radius: 6px;
    overflow: hidden;
}

.detachment-rule-banner.hidden {
    display: none;
}

.detachment-rule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    cursor: pointer;
    user-select: none;
}

.detachment-rule-header:hover {
    background: rgba(0, 200, 150, 0.1);
}

.detachment-rule-title {
    font-family: 'Oswald', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: #00c896;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detachment-rule-toggle {
    color: #00c896;
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.detachment-rule-banner.expanded .detachment-rule-toggle {
    transform: rotate(180deg);
}

.detachment-rule-body {
    display: none;
    padding: 0 1rem 0.8rem;
}

.detachment-rule-banner.expanded .detachment-rule-body {
    display: block;
}

.detachment-rule-body p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-line;
}

/* Army List */
.army-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.empty-army-message {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.army-unit {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.army-unit.is-warlord {
    border-color: #ffd700;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

.army-unit.is-warlord .army-unit-header {
    background: linear-gradient(135deg, var(--bg-secondary), rgba(255, 215, 0, 0.1));
}

.army-unit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    cursor: pointer;
}

.army-unit-header:hover {
    background: var(--bg-tertiary);
}

.army-unit-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.army-unit-name {
    font-family: 'Oswald', sans-serif;
    font-size: 1rem;
}

.army-unit-models {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.army-unit-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.army-unit-points {
    font-family: 'Oswald', sans-serif;
    font-size: 1rem;
    color: var(--accent-secondary);
    min-width: 60px;
    text-align: right;
}

.army-unit-body {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    display: none;
}

.army-unit.expanded .army-unit-body {
    display: block;
}

.wargear-list {
    list-style: none;
}

.wargear-item {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.25rem 0;
}

/* Validation Panel */
.validation-panel {
    background: rgba(239, 68, 68, 0.1);
    border-top: 2px solid var(--error);
    padding: 1rem;
}

.validation-panel h3 {
    font-family: 'Oswald', sans-serif;
    font-size: 0.9rem;
    color: var(--error);
    margin-bottom: 0.5rem;
}

.validation-panel ul {
    list-style: none;
}

.validation-panel li {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.25rem 0;
    padding-left: 1rem;
    position: relative;
}

.validation-panel li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--error);
}

/* Unit Details Panel */
.unit-details {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.no-selection {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.datasheet {
    background: var(--bg-primary);
    border-radius: 6px;
    overflow: hidden;
}

.datasheet-header {
    background: linear-gradient(135deg, var(--accent-primary), var(--bg-tertiary));
    padding: 1rem;
}

.datasheet-name {
    font-family: 'Oswald', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
}

.datasheet-subtitle {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 0.25rem;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.stats-table th,
.stats-table td {
    padding: 0.5rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.stats-table th {
    background: var(--bg-tertiary);
    font-family: 'Oswald', sans-serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--accent-secondary);
}

.stats-table td {
    font-size: 0.9rem;
    font-weight: 500;
}

.datasheet-section {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

.datasheet-section h4 {
    font-family: 'Oswald', sans-serif;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--accent-secondary);
    margin-bottom: 0.5rem;
}

.weapon-table {
    width: 100%;
    font-size: 0.8rem;
    border-collapse: collapse;
}

.weapon-table th,
.weapon-table td {
    padding: 0.4rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.weapon-table th {
    color: var(--text-muted);
    font-weight: 400;
}

.weapon-name {
    color: var(--accent-primary);
}

.ability-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.ability-name {
    font-weight: 500;
    color: var(--accent-secondary);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-content.modal-large {
    max-width: 700px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.2rem;
    text-transform: uppercase;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--accent-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1rem 1.5rem;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-secondary);
}

/* Wargear Options */
.wargear-option {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.wargear-option h4 {
    font-family: 'Oswald', sans-serif;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.wargear-choice {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
}

.wargear-choice input {
    accent-color: var(--accent-primary);
}

.wargear-choice label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
}

/* Model Count Selector */
.model-count-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.model-count-selector label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.model-count-selector input {
    width: 80px;
    padding: 0.4rem;
    text-align: center;
}

/* My Armies List */
.armies-list {
    max-height: 400px;
    overflow-y: auto;
}

.army-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.army-card:hover {
    border-color: var(--accent-secondary);
}

.army-card.current {
    border-color: var(--accent-primary);
    background: rgba(233, 69, 96, 0.1);
}

.army-card-info {
    flex: 1;
}

.army-card-name {
    font-family: 'Oswald', sans-serif;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.army-card-details {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.army-card-details span {
    margin-right: 1rem;
}

.army-card-points {
    color: var(--accent-secondary);
    font-weight: 500;
}

.army-card-actions {
    display: flex;
    gap: 0.5rem;
}

.no-armies-message {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.no-armies-message p {
    margin: 0.5rem 0;
}

.current-army-badge {
    display: inline-block;
    background: var(--accent-primary);
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    margin-left: 0.5rem;
    text-transform: uppercase;
}

/* Dropdown Menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-width: 180px;
    z-index: 1000;
    box-shadow: var(--shadow);
    margin-top: 4px;
    pointer-events: none;
}

.dropdown-menu.show {
    display: block;
    pointer-events: auto;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: var(--bg-tertiary);
}

/* Hamburger Menu */
.hamburger-btn {
    font-size: 1.1rem;
    padding: 0.5rem 1.25rem;
    min-width: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.hamburger-menu {
    min-width: 220px;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

.dropdown-submenu {
    position: relative;
}

.submenu-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.submenu {
    display: none;
    position: absolute;
    right: 100%;
    top: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-width: 200px;
    z-index: 1001;
    box-shadow: var(--shadow);
}

.dropdown-submenu:hover > .submenu,
.submenu.show {
    display: block;
}

/* Import Modal Styles */
.import-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.import-tab {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.import-tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.import-tab.active {
    color: var(--accent-primary);
    background: rgba(233, 69, 96, 0.1);
}

.import-content {
    padding: 1rem 0;
}

.import-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.file-input {
    display: none;
}

.file-label {
    display: inline-block;
    padding: 1rem 2rem;
    background: var(--bg-primary);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    width: 100%;
    transition: all 0.2s;
}

.file-label:hover {
    border-color: var(--accent-secondary);
    background: rgba(0, 217, 255, 0.05);
}

.file-name {
    margin-top: 0.5rem;
    color: var(--accent-secondary);
    font-size: 0.85rem;
}

.full-width-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.full-width-input:focus {
    outline: none;
    border-color: var(--accent-secondary);
}

.import-textarea {
    width: 100%;
    min-height: 200px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.85rem;
    resize: vertical;
}

.import-textarea:focus {
    outline: none;
    border-color: var(--accent-secondary);
}

.import-preview {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.import-preview h4 {
    font-family: 'Oswald', sans-serif;
    font-size: 0.9rem;
    color: var(--accent-secondary);
    margin-bottom: 0.5rem;
}

/* Share Modal Styles */
.share-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.share-link-container {
    display: flex;
    gap: 0.5rem;
}

.share-link-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.85rem;
}

.share-note {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    box-shadow: var(--shadow);
    z-index: 2000;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-color: var(--success);
    background: rgba(74, 222, 128, 0.1);
}

.toast.error {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Leader Attachment Styles */
.army-unit.has-leader {
    border-left: 3px solid #9333ea;
}

.army-unit.has-leader .army-unit-header {
    background: linear-gradient(90deg, rgba(147, 51, 234, 0.1) 0%, var(--bg-secondary) 50%);
}

.attached-leader {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.btn-success {
    background: var(--success);
    color: var(--bg-primary);
}

.btn-success:hover {
    background: #22c55e;
    transform: translateY(-1px);
}

.attach-dropdown {
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 280px 1fr 300px;
    }
}

/* Mobile Tab Bar */
.mobile-tab-bar {
    display: none;
}

@media (max-width: 768px) {
    .mobile-tab-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 200;
        background: var(--bg-secondary);
        border-top: 2px solid var(--accent-primary);
        padding: 0;
        height: 56px;
    }

    .mobile-tab {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.35rem;
        background: none;
        border: none;
        color: var(--text-muted);
        font-family: 'Oswald', sans-serif;
        font-size: 0.85rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        cursor: pointer;
        padding: 0.5rem;
        min-height: 56px;
        transition: color 0.2s, background 0.2s;
    }

    .mobile-tab.active {
        color: var(--accent-primary);
        background: rgba(233, 69, 96, 0.1);
        border-top: 2px solid var(--accent-primary);
    }

    .mobile-tab:not(.active):hover {
        color: var(--text-secondary);
        background: rgba(255, 255, 255, 0.03);
    }

    .main-content {
        grid-template-columns: 1fr;
        height: auto;
        min-height: calc(100vh - 56px);
        gap: 0;
        padding: 0;
    }

    .main-content > .panel {
        display: none;
        height: calc(100vh - 56px);
        max-height: none;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .main-content > .panel.active-panel {
        display: flex;
    }

    .app-header {
        padding: 0.5rem 1rem;
        position: relative !important;
        top: auto !important;
    }

    .logo {
        font-size: 1.2rem;
        letter-spacing: 1px;
    }

    .btn {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .submenu {
        position: static;
        border: none;
        box-shadow: none;
        min-width: unset;
        padding-left: 1rem;
        background: var(--bg-primary);
    }

    .modal-content {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
        border: none;
    }

    .modal-content.modal-large {
        max-width: none;
    }

    .army-info {
        flex-direction: column;
    }

    .points-display {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .points-counter {
        min-width: unset;
        text-align: left;
    }

    .weapon-table,
    .stats-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .weapon-table table,
    .stats-table table {
        min-width: 100%;
    }

    .unit-card {
        padding: 1rem;
    }

    .army-unit-header {
        min-height: 48px;
        padding: 0.75rem 0.75rem;
    }

    .army-unit-actions .btn,
    .army-unit-actions button {
        min-height: 44px;
        min-width: 44px;
        padding: 0.4rem 0.6rem;
    }

    .btn-small {
        min-height: 44px;
        min-width: 44px;
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    .header-actions {
        gap: 0.5rem;
    }

    .dropdown-item {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding: 0.6rem 1rem;
    }

    .filter-select,
    .search-input {
        min-height: 44px;
        font-size: 1rem;
    }

    .faction-select,
    .detachment-select,
    .battle-size select {
        min-height: 44px;
    }

    .form-group input,
    .form-group select {
        min-height: 44px;
    }

    .toast {
        bottom: 66px;
        right: 10px;
        left: 10px;
    }

    body.play-mode .mobile-tab-bar {
        display: none;
    }

    body.play-mode .main-content {
        height: calc(100vh - 70px);
    }

    body.play-mode .main-content > .panel {
        display: flex;
        height: calc(100vh - 70px);
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 0.4rem 0.5rem;
    }

    .logo {
        font-size: 1rem;
    }

    #btn-my-armies .btn-text {
        display: none;
    }

    #btn-my-armies {
        font-size: 0;
    }

    #btn-my-armies::before {
        content: '📋';
        font-size: 1.1rem;
    }

    .army-name-input {
        font-size: 1rem;
    }

    .modal-header {
        padding: 0.75rem 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        padding: 0.75rem 1rem;
    }
}

/* Weapon Info Popup */
.weapon-info-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

.weapon-info-popup {
    background: var(--bg-secondary);
    border: 2px solid var(--accent-primary);
    border-radius: 8px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: popupSlideIn 0.2s ease-out;
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.weapon-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    border-radius: 6px 6px 0 0;
}

.weapon-info-header h3 {
    margin: 0;
    color: var(--accent-secondary);
    font-size: 1.1rem;
}

.weapon-info-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.weapon-info-close:hover {
    color: var(--accent-primary);
}

.weapon-info-content {
    padding: 1rem 1.25rem;
}

.weapon-info-content .weapon-table {
    width: 100%;
    margin-bottom: 0.75rem;
}

.weapon-info-content .weapon-table th,
.weapon-info-content .weapon-table td {
    text-align: center;
    padding: 0.5rem;
}

.weapon-abilities {
    color: var(--accent-secondary);
    font-size: 0.9rem;
    padding: 0.5rem;
    background: rgba(0, 217, 255, 0.1);
    border-radius: 4px;
    margin-top: 0.5rem;
}

.weapon-abilities-section {
    margin-top: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.weapon-abilities-section h4 {
    color: var(--accent-secondary);
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ability-item {
    background: rgba(0, 217, 255, 0.08);
    border-left: 3px solid var(--accent-secondary);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 0 4px 4px 0;
}

.ability-item:last-child {
    margin-bottom: 0;
}

.ability-name {
    color: var(--accent-secondary);
    font-size: 0.9rem;
    display: block;
    margin-bottom: 0.25rem;
}

.ability-desc {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.5;
    margin: 0;
}

.weapon-info-popup {
    max-height: 80vh;
    overflow-y: auto;
}

/* Weapon abilities in unit details */
.weapon-abilities-cell {
    padding: 0.5rem 0.75rem !important;
    background: rgba(0, 0, 0, 0.15);
}

.weapon-ability-item {
    background: rgba(0, 217, 255, 0.08);
    border-left: 3px solid var(--accent-secondary);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 0 4px 4px 0;
}

.weapon-ability-item:last-child {
    margin-bottom: 0;
}

.weapon-ability-name {
    color: var(--accent-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.weapon-ability-name::-webkit-details-marker {
    display: none;
}

.weapon-ability-name::before {
    content: '▶';
    font-size: 0.6rem;
    transition: transform 0.2s ease;
}

.weapon-ability-item[open] .weapon-ability-name::before {
    transform: rotate(90deg);
}

.weapon-ability-desc {
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.4;
    display: block;
    margin-top: 0.5rem;
    padding-left: 1rem;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Collapsible attached unit sections */
.attached-unit-details summary {
    user-select: none;
}

.attached-unit-details summary::-webkit-details-marker {
    display: none;
}

.attached-unit-details summary > span:first-child {
    display: inline-block;
    transition: transform 0.2s ease;
}

.attached-unit-details:not([open]) summary > span:first-child {
    transform: rotate(-90deg);
}

.attached-unit-details[open] summary > span:first-child {
    transform: rotate(0deg);
}

.attached-unit-details > div {
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
    }
}

/* Play Mode Styles */
body.play-mode .unit-browser {
    display: none !important;
}

body.play-mode .unit-details-panel {
    display: none !important;
}

body.play-mode .main-content {
    grid-template-columns: 1fr;
    height: auto;
}

body.play-mode .army-list-panel {
    max-width: 100%;
}

body.play-mode .app-header {
    position: static;
}

body.play-mode .army-header {
    padding: 0.25rem 1rem;
}

body.play-mode .army-name-row {
    margin-bottom: 0;
}

body.play-mode .army-name-input {
    font-size: 0.85rem;
    padding: 0.15rem 0.5rem;
    pointer-events: none;
    opacity: 0.7;
}

body.play-mode .army-info {
    display: none;
}

body.play-mode .battle-size {
    display: none;
}

body.play-mode .points-display {
    display: none;
}

body.play-mode .btn-add-unit,
body.play-mode .btn-remove-unit,
body.play-mode .btn-duplicate-unit,
body.play-mode .btn-configure-unit,
body.play-mode .army-unit-actions,
body.play-mode .btn-attach,
body.play-mode .btn-detach,
body.play-mode .attachment-section {
    display: none !important;
}

body.play-mode #btn-my-armies {
    display: none;
}

#menu-play-mode {
    color: var(--accent-secondary);
    font-weight: 500;
}

body.play-mode .validation-panel {
    display: none !important;
}

/* Play mode army unit - cleaner look */
body.play-mode .army-unit {
    cursor: pointer;
}

body.play-mode .army-unit:hover {
    border-color: var(--accent-secondary);
}

body.play-mode .play-mode-unit .army-unit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
}

body.play-mode .play-mode-expand-icon {
    color: var(--accent-secondary);
    margin-right: 0.5rem;
    font-size: 0.75rem;
}

body.play-mode .play-mode-unit.expanded {
    border-color: var(--accent-secondary);
}

body.play-mode .play-mode-unit .army-unit-points-display {
    display: flex;
    align-items: center;
}

body.play-mode .play-mode-inline-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

body.play-mode .play-mode-unit.expanded .play-mode-inline-details {
    max-height: 2000px;
}

/* Play mode collapsible stats sections */
.play-mode-inline-details details summary {
    list-style: none;
}

.play-mode-inline-details details summary::-webkit-details-marker {
    display: none;
}

.play-mode-inline-details details summary span:first-child {
    display: inline-block;
    transition: transform 0.2s ease;
}

.play-mode-inline-details details[open] summary span:first-child {
    transform: rotate(90deg);
}

/* Responsive play mode */
@media (max-width: 1024px) {
    body.play-mode .main-content {
        grid-template-columns: 1fr;
    }
}

/* Stratagems Modal */
.stratagems-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stratagem-card {
    border: 2px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--panel-bg);
}

.stratagem-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--accent);
    color: white;
}

.stratagem-name {
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stratagem-cost {
    font-weight: 700;
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.stratagem-type {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.1);
}

.stratagem-body {
    padding: 1rem;
}

.stratagem-field {
    margin-bottom: 0.75rem;
}

.stratagem-field:last-child {
    margin-bottom: 0;
}

.stratagem-label {
    display: block;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.25rem;
}

.stratagem-value {
    display: block;
    line-height: 1.5;
}

/* Stratagem type colors */
.stratagem-battle-tactic .stratagem-header {
    background: #c0392b;
}

.stratagem-battle-tactic .stratagem-label {
    color: #c0392b;
}

.stratagem-epic-deed .stratagem-header {
    background: #8e44ad;
}

.stratagem-epic-deed .stratagem-label {
    color: #8e44ad;
}

.stratagem-strategic-ploy .stratagem-header {
    background: #2980b9;
}

.stratagem-strategic-ploy .stratagem-label {
    color: #2980b9;
}

.stratagem-wargear .stratagem-header {
    background: #27ae60;
}

.stratagem-wargear .stratagem-label {
    color: #27ae60;
}

/* Auth styles */
.auth-error {
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid #e74c3c;
    color: #e74c3c;
    padding: 0.75rem;
    border-radius: 4px;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent-primary);
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.9rem;
}

.btn-link:hover {
    color: var(--accent-secondary);
}

/* Attachment highlight classes */
.attachment-highlight-leader {
    background: rgba(233, 69, 96, 0.1);
    border-left: 3px solid var(--accent-primary);
}

.attachment-highlight-cryptek {
    background: rgba(138, 43, 226, 0.1);
    border-left: 3px solid #8a2be2;
}

.attachment-highlight-bodyguard {
    background: rgba(50, 205, 50, 0.1);
    border-left: 3px solid #32cd32;
}

.attachment-highlight-detachment {
    background: rgba(0, 188, 212, 0.1);
    border-left: 3px solid #00bcd4;
}

.attachment-text-leader {
    color: var(--accent-primary);
}

.attachment-text-cryptek {
    color: #8a2be2;
}

.attachment-text-bodyguard {
    color: #32cd32;
}

.attachment-text-detachment {
    color: #00bcd4;
}

/* Ability styling with attachment sources */
.ability-highlight {
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.ability-highlight-compact {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
}

/* Play Mode Stats Block */
.play-mode-stats-block {
    margin-bottom: 0.75rem;
}

.play-mode-stats-label {
    font-size: 0.75rem;
    color: var(--label-color, var(--text-muted));
    margin-bottom: 0.25rem;
}

/* Play Mode Inline Details Container */
.play-mode-inline-details {
    padding: 1rem;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    animation: slideDown 0.2s ease;
}

/* Section headings for weapon tables */
.section-heading {
    color: var(--accent-secondary);
    margin: 0.5rem 0 0.25rem;
}

/* Weapon source badge (leader/cryptek/bodyguard attribution) */
.weapon-source-badge {
    color: var(--source-color);
    font-size: 0.8em;
}

/* Faction keyword tag variant */
.keyword-tag-faction {
    background: rgba(233, 69, 96, 0.3);
}

/* Attached unit details sections */
.attached-details-summary {
    background: var(--bg-secondary);
    border-left: 3px solid var(--attach-color);
    padding: 0.5rem 0.5rem 0.5rem 0.75rem;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.attached-details-summary::-webkit-details-marker {
    display: none;
}

.attached-details-content {
    padding: 0.5rem;
    border-left: 3px solid var(--attach-color);
    margin-left: 0.5rem;
}

/* Invuln/FNP detail spacing */
.defensive-rule-detail {
    margin-top: 0.5rem;
}

/* Wargear options list */
.wargear-options-list {
    list-style: disc;
    padding-left: 1.5rem;
}

.wargear-options-list li {
    margin-bottom: 0.25rem;
}

/* Unit keywords container */
.unit-keywords-left {
    justify-content: flex-start;
    gap: 0.5rem;
}
