/* FFXIV Squadron Calculator - Styles */
/* Color scheme matching xiv-tc-toolbox series */

:root {
    /* Background Colors - matching existing tools */
    --bg-primary: #333;
    --bg-secondary: #222;
    --bg-tertiary: #191919;
    --bg-card: #282828;
    --bg-card-hover: #363636;

    /* Text Colors */
    --text-primary: #eee;
    --text-secondary: #ccc;
    --text-muted: #888;

    /* Accent Colors */
    --accent: #5C6E8E;
    --accent-hover: #6d7f9f;
    --accent-gold: #917D54;
    --accent-gold-hover: #a68d5f;

    /* Stat Colors */
    --stat-physical: #e57373;
    --stat-mental: #64b5f6;
    --stat-tactical: #ffd54f;

    /* Border & Shadow */
    --border-color: #444;
    --border-light: #555;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-large: rgba(0, 0, 0, 0.5);

    /* Status Colors */
    --success: #5a9c69;
    --warning: #917D54;
    --error: #dc3545;

    /* Misc */
    --transition: 0.2s ease;
    --radius: 8px;
    --radius-lg: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Microsoft JhengHei', sans-serif;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* App Container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
}

/* ==================== Header ==================== */
.app-header {
    background: var(--bg-secondary);
    padding: 15px 20px 20px;
    border-bottom: 2px solid var(--border-color);
}

.header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.nav-right {
    display: flex;
    gap: 8px;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius);
    font-size: 0.85rem;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

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

.nav-btn.discord:hover {
    border-color: #5865F2;
    color: #5865F2;
}

.nav-btn.support:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.nav-icon {
    font-size: 0.9rem;
}

.app-header h1 {
    font-size: 1.6rem;
    color: var(--accent-gold);
    text-align: center;
    margin-bottom: 4px;
    font-weight: 600;
}

.app-header .subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

/* ==================== Main Content ==================== */
.main-content {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 0;
    min-height: calc(100vh - 180px);
}

/* ==================== Panels ==================== */
.panel {
    background: var(--bg-secondary);
    padding: 20px;
    border-right: 1px solid var(--border-color);
}

.panel:last-child {
    border-right: none;
}

.panel h2 {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel h2::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    background: var(--accent-gold);
    border-radius: 2px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.panel-header-actions {
    display: flex;
    gap: 8px;
}

.panel-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.panel-footer .btn {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
}

/* Mission Panel */
.mission-panel {
    background: var(--bg-tertiary);
    padding: 20px;
    overflow-y: auto;
}

/* Sub Panels */
.sub-panel {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
}

.sub-panel:last-child {
    margin-bottom: 0;
}

.sub-panel h2 {
    font-size: 0.95rem;
    margin-bottom: 12px;
    padding-bottom: 8px;
}

/* ==================== Buttons ==================== */
.btn {
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.btn-gold {
    background: var(--accent-gold);
    color: #fff;
    border-color: var(--accent-gold);
}

.btn-gold:hover:not(:disabled) {
    background: var(--accent-gold-hover);
    border-color: var(--accent-gold-hover);
}

.btn-large {
    width: 100%;
    padding: 12px 24px;
    font-size: 1rem;
    margin-top: 15px;
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.8rem;
}

.btn-icon {
    padding: 4px 8px;
    background: transparent;
    color: var(--text-muted);
    border: none;
}

.btn-icon:hover {
    color: var(--text-primary);
}

/* ==================== Member List ==================== */
.member-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
}

/* Member Card - Compact */
.member-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition);
    display: grid;
    grid-template-columns: 32px 1fr;
    grid-template-rows: auto auto;
    gap: 4px 8px;
    align-items: center;
}

.member-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-light);
}

.member-card.selected {
    border-color: var(--accent);
    background: rgba(92, 110, 142, 0.15);
}

.member-card .job-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    color: #fff;
}

/* Job Icon Colors */
.job-icon.tank { background: linear-gradient(135deg, #3a6ea5, #2c5282); }
.job-icon.dps { background: linear-gradient(135deg, #a13d3d, #8b2c2c); }
.job-icon.healer { background: linear-gradient(135deg, #3d8b3d, #2d6b2d); }
.job-icon.ranged { background: linear-gradient(135deg, #a17a3d, #8b6930); }

/* Member Avatar (recruit image) */
.member-card .member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--border-color);
    grid-row: span 2;
}

.member-card .member-avatar.tank { border-color: #3a6ea5; }
.member-card .member-avatar.dps { border-color: #a13d3d; }
.member-card .member-avatar.healer { border-color: #3d8b3d; }
.member-card .member-avatar.ranged { border-color: #a17a3d; }

.member-card .member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.member-info {
    display: contents;
}

.member-info .name {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-info .job-level {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.member-chemistry {
    font-size: 0.6rem;
    color: var(--accent);
    background: rgba(52, 152, 219, 0.15);
    padding: 1px 4px;
    border-radius: 3px;
    display: inline-block;
    margin-top: 2px;
    cursor: help;
}

.member-stats {
    display: flex;
    gap: 3px;
    grid-column: 1 / -1;
    margin-top: 2px;
}

.stat-badge {
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
    min-width: 28px;
    text-align: center;
}

.stat-badge.physical {
    background: rgba(229, 115, 115, 0.2);
    color: var(--stat-physical);
}

.stat-badge.mental {
    background: rgba(100, 181, 246, 0.2);
    color: var(--stat-mental);
}

.stat-badge.tactical {
    background: rgba(255, 213, 79, 0.2);
    color: var(--stat-tactical);
}

.member-actions {
    display: flex;
    gap: 3px;
    grid-column: 1 / -1;
    justify-content: flex-end;
}

.member-actions button {
    padding: 2px 6px;
    font-size: 0.65rem;
}

/* ==================== Stat Requirements ==================== */
.stat-requirements {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 15px;
}

.stat-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-input-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stat-input-group input {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1rem;
    text-align: center;
    transition: var(--transition);
}

.stat-input-group input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-secondary);
}

/* Stat Icons */
.stat-icon {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.stat-icon.physical { background: var(--stat-physical); }
.stat-icon.mental { background: var(--stat-mental); }
.stat-icon.tactical { background: var(--stat-tactical); }

/* ==================== Mission Selection ==================== */
.mission-selection {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.mission-select-group,
.mission-variant-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mission-select-group label,
.mission-variant-group label {
    color: var(--text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    min-width: 80px;
}

.mission-selection select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: var(--transition);
}

.mission-selection select:focus {
    outline: none;
    border-color: var(--accent);
}

.mission-variant-group {
    padding-left: 10px;
    border-left: 2px solid var(--accent);
}

/* ==================== Results ==================== */
.results-container {
    min-height: 150px;
}

.placeholder-text {
    color: var(--text-muted);
    text-align: center;
    padding: 30px 15px;
    font-size: 0.9rem;
}

/* Result Cards */
.result-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
}

.result-card.best {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 1px var(--accent-gold);
}

.result-card.best::before {
    content: '最佳';
    display: inline-block;
    background: var(--accent-gold);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.result-header h3 {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
}

.result-badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.result-badge.success {
    background: rgba(90, 156, 105, 0.2);
    color: var(--success);
}

.result-badge.needs-training {
    background: rgba(145, 125, 84, 0.2);
    color: var(--warning);
}

.result-members {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.result-member-card {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.result-member-card.job-changed {
    border: 1px dashed var(--warning);
}

.result-member-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--border-color);
}

.result-member-avatar.tank { border-color: #3a6ea5; }
.result-member-avatar.dps { border-color: #a13d3d; }
.result-member-avatar.healer { border-color: #3d8b3d; }
.result-member-avatar.ranged { border-color: #a17a3d; }

.result-member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-member-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.result-member-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.result-member-job {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.result-stat {
    text-align: center;
}

.result-stat .label {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 2px;
}

.result-stat .value {
    font-size: 1rem;
    font-weight: 600;
}

.result-stat .value.physical { color: var(--stat-physical); }
.result-stat .value.mental { color: var(--stat-mental); }
.result-stat .value.tactical { color: var(--stat-tactical); }

.result-stat .diff {
    font-size: 0.7rem;
}

.result-stat .diff.positive { color: var(--success); }
.result-stat .diff.negative { color: var(--error); }

.result-training {
    margin-top: 10px;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.result-training h4 {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.training-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.8rem;
}

.training-step .step-num {
    background: var(--accent);
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: bold;
}

/* Result Chemistry Display */
.result-chemistry {
    margin-top: 10px;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border-left: 3px solid var(--accent);
}

.result-chemistry h4 {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.chemistry-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chemistry-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    flex-wrap: wrap;
}

.chemistry-member {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 80px;
}

.chemistry-condition {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.chemistry-effect {
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.75rem;
}

.chemistry-effect.physical {
    background: rgba(231, 76, 60, 0.15);
    color: var(--stat-physical);
}

.chemistry-effect.mental {
    background: rgba(52, 152, 219, 0.15);
    color: var(--stat-mental);
}

.chemistry-effect.tactical {
    background: rgba(46, 204, 113, 0.15);
    color: var(--stat-tactical);
}

.chemistry-scope {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.chemistry-total {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-color);
    font-size: 0.8rem;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.chemistry-total span {
    font-weight: 500;
}

.chemistry-total .physical { color: var(--stat-physical); }
.chemistry-total .mental { color: var(--stat-mental); }
.chemistry-total .tactical { color: var(--stat-tactical); }

/* ==================== Training Panel ==================== */
.panel-header-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header-toggle h2 {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.training-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.training-content.expanded {
    max-height: 500px;
}

.training-types {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 10px;
}

.training-type-btn {
    padding: 8px 6px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.75rem;
}

.training-type-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.training-type-btn.selected {
    border-color: var(--accent);
    background: rgba(92, 110, 142, 0.2);
    color: var(--text-primary);
}

.training-preview {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.training-preview h3 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.preview-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.preview-stat {
    text-align: center;
}

.preview-stat .label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.preview-stat .change {
    font-size: 1rem;
    font-weight: 600;
}

.preview-stat .change.positive { color: var(--success); }
.preview-stat .change.negative { color: var(--error); }

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 20px;
    width: 95%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px var(--shadow-large);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    color: var(--accent-gold);
    font-size: 1.1rem;
    margin: 0;
    padding: 0;
    border: none;
}

.modal-header h2::before {
    display: none;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    transition: var(--transition);
}

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

/* ==================== Forms ==================== */
.form-group {
    margin-bottom: 12px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

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

.stats-group .stats-inputs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.stat-input {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-tertiary);
    padding: 8px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.stat-input input {
    border: none;
    padding: 4px;
    width: 100%;
    background: transparent;
    text-align: center;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

/* ==================== Squad Rank Setting ==================== */
.squad-rank-setting {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
}

.squad-rank-setting label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
}

.squad-rank-setting select {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.85rem;
}

/* Training Pool */
.training-pool-setting {
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
}

.training-pool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.training-pool-header label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.pool-total {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.pool-total.over {
    color: var(--danger);
}

.pool-total.valid {
    color: var(--success);
}

.training-pool-inputs {
    display: flex;
    gap: 8px;
}

.pool-input {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
}

.pool-input input {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.85rem;
    text-align: center;
}

/* ==================== Recruit Filter Pills ==================== */
.recruit-filter-section {
    margin-bottom: 12px;
}

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.filter-pill {
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 15px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.filter-pill:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.filter-pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.filter-pill.tank { border-left: 2px solid #3d5a80; }
.filter-pill.healer { border-left: 2px solid #5a9c69; }
.filter-pill.dps { border-left: 2px solid #c94040; }

/* ==================== Recruit Grid ==================== */
.recruit-grid-container {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    margin-bottom: 12px;
}

.recruit-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    padding: 10px;
}

.recruit-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px;
    border-radius: var(--radius);
    background: var(--bg-secondary);
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
}

.recruit-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.recruit-card.selected {
    border-color: var(--accent-gold);
    background: var(--bg-card-hover);
}

.recruit-card.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.recruit-card-img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    background: var(--bg-tertiary);
}

.recruit-card.selected .recruit-card-img {
    border-color: var(--accent-gold);
}

.recruit-card-name {
    margin-top: 4px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recruit-card-job {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ==================== Selected Recruit Preview ==================== */
.selected-recruit-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 2px solid var(--accent-gold);
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.selected-recruit-preview img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-gold);
}

.selected-recruit-info {
    flex: 1;
}

.selected-recruit-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.selected-recruit-details {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ==================== Recruit Info (legacy) ==================== */
.recruit-info {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
}

.recruit-detail {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.85rem;
}

.recruit-detail .label {
    color: var(--text-muted);
}

/* Responsive grid */
@media (max-width: 600px) {
    .recruit-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 400px) {
    .recruit-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ==================== Stats Input ==================== */
.stats-input .stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.stats-input .stats-header label {
    margin-bottom: 0;
}

.stats-input .stats-inputs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.stat-input-item {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 8px;
    border: 1px solid var(--border-color);
}

.stat-input-item label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-input-item input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
}

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

.stat-input-item:nth-child(1) input { color: var(--stat-physical); }
.stat-input-item:nth-child(2) input { color: var(--stat-mental); }
.stat-input-item:nth-child(3) input { color: var(--stat-tactical); }

/* ==================== Chemistry (吉兆) Input ==================== */
.chemistry-input {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.chemistry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.chemistry-header > label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0;
}

.chemistry-toggle {
    font-size: 0.85rem;
}

.chemistry-toggle span {
    color: var(--text-muted);
}

.chemistry-settings {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: 12px;
    border: 1px solid var(--border-color);
}

.chemistry-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.chemistry-row:last-of-type {
    margin-bottom: 0;
}

.chemistry-row label {
    min-width: 50px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0;
}

.chemistry-row select {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.85rem;
}

.chemistry-row select:focus {
    outline: none;
    border-color: var(--accent);
}

.chemistry-preview {
    margin-top: 10px;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    font-size: 0.9rem;
    color: var(--accent);
    text-align: center;
    font-weight: 500;
    border: 1px dashed var(--accent);
}

.chemistry-preview:empty {
    display: none;
}

/* ==================== Calculation Options ==================== */
.calc-options {
    margin: 15px 0;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.checkbox-label span {
    color: var(--text-secondary);
}

/* Job Select in Modal */
#jobSelectGroup select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* Job Changed Indicator */
.job-changed-indicator {
    color: var(--warning);
    font-weight: bold;
    margin-left: 2px;
}

/* Result Job Changes */
.result-job-changes {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.result-job-changes h4 {
    font-size: 0.85rem;
    color: var(--warning);
    margin-bottom: 8px;
}

.job-change-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.job-change-item .member-name {
    color: var(--text-primary);
}

.job-change-item .job-arrow {
    color: var(--warning);
}

/* ==================== Footer ==================== */
.app-footer {
    text-align: center;
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.app-footer a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

.app-footer a:hover {
    color: var(--accent-hover);
}

.app-footer .license-note {
    font-size: 0.7rem;
    margin-top: 5px;
    opacity: 0.8;
}

/* ==================== Scrollbar ==================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

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

/* ==================== Utilities ==================== */
.empty-state {
    text-align: center;
    padding: 30px 15px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.loading::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== Recruits List Table ==================== */
.modal-large {
    max-width: 900px;
    width: 95%;
}

.recruits-filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.recruits-filter-bar select {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.recruits-table-container {
    max-height: 60vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.recruits-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.recruits-table thead {
    position: sticky;
    top: 0;
    background: var(--bg-tertiary);
    z-index: 1;
}

.recruits-table th,
.recruits-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.recruits-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recruits-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.recruit-img-cell {
    width: 50px;
}

.recruit-table-img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.recruit-name {
    font-weight: 600;
    color: var(--text-primary);
}

.recruit-name-en {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.job-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.job-badge.tank {
    background: rgba(58, 110, 165, 0.3);
    color: #6aa8e0;
}

.job-badge.dps {
    background: rgba(161, 61, 61, 0.3);
    color: #e07a7a;
}

.job-badge.healer {
    background: rgba(61, 139, 61, 0.3);
    color: #7acc7a;
}

.job-badge.ranged {
    background: rgba(161, 122, 61, 0.3);
    color: #d4a85a;
}

.challenge-log-cell {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ==================== Responsive ==================== */
@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .panel {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .member-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .header-nav {
        flex-direction: column;
        gap: 10px;
    }

    .nav-right {
        width: 100%;
        justify-content: center;
    }

    .nav-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .app-header h1 {
        font-size: 1.3rem;
    }

    .stat-requirements {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .training-types {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-group .stats-inputs {
        grid-template-columns: 1fr;
    }

    .training-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Training Modal Styles
   ======================================== */

/* Training icon in result steps */
.training-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

/* Training hint text */
.training-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 16px;
    text-align: center;
}

/* Training selection grid */
.training-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.training-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}

.training-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.training-btn-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
}

.training-btn-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.training-btn-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.training-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.training-btn.disabled:hover {
    transform: none;
    border-color: var(--border-color);
    background: var(--bg-card);
}

.training-btn-disabled-reason {
    font-size: 0.7rem;
    color: var(--danger);
    margin-top: 4px;
}

/* Training confirm modal */
.modal-small .modal-content {
    max-width: 400px;
}

.training-confirm-content {
    padding: 8px 0;
}

.training-confirm-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.training-confirm-icon img {
    width: 64px;
    height: 64px;
    border-radius: 8px;
}

.training-confirm-info h3 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.training-confirm-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.training-confirm-members {
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.training-confirm-members p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.training-confirm-members ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.training-confirm-members li {
    background: var(--bg-card);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-primary);
}

/* Training pool change preview */
.training-confirm-changes {
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
}

.training-confirm-changes p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.pool-change-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pool-change-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.pool-change-item .stat-icon {
    width: 16px;
    height: 16px;
}

.pool-change-item .change-diff {
    margin-left: auto;
    font-weight: 600;
}

.pool-change-item .change-diff.positive {
    color: var(--success);
}

.pool-change-item .change-diff.negative {
    color: var(--error);
}
