/* Season Planning V1 - Styles */

/* Compact Carbon Budget Header (in header-row-2) */
.budget-header-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface, #f8f9fa);
    border-radius: 6px;
    border: 1px solid var(--border, #e0e0e0);
    font-size: 13px;
    min-height: 44px;
    box-sizing: border-box;
}

.budget-icon {
    font-size: 16px;
}

.budget-text {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-weight: 600;
    color: var(--text-primary, #333);
    white-space: nowrap;
    flex-shrink: 0;
}

.budget-used-header {
    font-size: 14px;
    font-weight: 700;
}

.budget-total-header {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary, #666);
}

.budget-progress-mini {
    flex: 1;
    height: 6px;
    background: var(--bg-light, #f0f0f0);
    border-radius: 3px;
    overflow: hidden;
    min-width: 60px;
}

.budget-progress-fill-mini {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #45a049 100%);
    border-radius: 3px;
    transition: width 0.3s ease, background 0.3s ease;
}

.budget-progress-fill-mini.warning {
    background: linear-gradient(90deg, #FF9800 0%, #F57C00 100%);
}

.budget-progress-fill-mini.exceeded {
    background: linear-gradient(90deg, #f44336 0%, #d32f2f 100%);
}

.budget-edit-btn-mini {
    background: none;
    border: 1px solid var(--border, #ddd);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary, #666);
    transition: all 0.2s;
    line-height: 1;
}

.budget-edit-btn-mini:hover {
    background: var(--hover-bg, #f5f5f5);
    border-color: var(--text-secondary, #aaa);
}

/* OLD Carbon Budget Section (deprecated - now in header) */
.carbon-budget-section {
    margin: 16px 0;
    padding: 12px 16px;
    background: var(--surface, #f8f9fa);
    border-radius: 8px;
    border: 1px solid var(--border, #e0e0e0);
}

.carbon-budget-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    color: var(--text-primary, #333);
}

.carbon-budget-toggle:hover {
    opacity: 0.8;
}

.carbon-budget-toggle .toggle-icon {
    font-size: 12px;
    width: 16px;
    text-align: center;
}

.carbon-budget-toggle .budget-header {
    font-size: 14px;
    font-weight: 600;
}

.carbon-budget-toggle .budget-summary {
    font-weight: 500;
    opacity: 0.75;
    margin-left: 4px;
}

.carbon-budget-content {
    display: none;
    margin-top: 12px;
}

.carbon-budget-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.budget-progress-wrapper {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border, #e0e0e0);
}

.budget-labels {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}

.budget-used {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary, #333);
}

.budget-total {
    font-size: 14px;
    color: var(--text-secondary, #666);
}

.budget-progress-bar {
    height: 12px;
    background: var(--bg-light, #f0f0f0);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.budget-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #45a049 100%);
    border-radius: 6px;
    transition: width 0.3s ease, background 0.3s ease;
}

.budget-progress-fill.warning {
    background: linear-gradient(90deg, #FF9800 0%, #F57C00 100%);
}

.budget-progress-fill.exceeded {
    background: linear-gradient(90deg, #f44336 0%, #d32f2f 100%);
}

.budget-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.budget-remaining {
    font-size: 13px;
    color: var(--text-secondary, #666);
}

.budget-edit-btn {
    background: none;
    border: 1px solid var(--border, #ddd);
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary, #666);
    transition: all 0.2s;
}

.budget-edit-btn:hover {
    background: var(--hover-bg, #f5f5f5);
    border-color: var(--text-secondary, #aaa);
}

.budget-alert {
    padding: 10px 12px;
    background: #fff3e0;
    border: 1px solid #ffb74d;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.budget-alert.exceeded {
    background: #ffebee;
    border-color: #ef5350;
}

.budget-alert .alert-icon {
    font-size: 18px;
}

.budget-alert .alert-text {
    font-size: 13px;
    color: var(--text-primary, #333);
    font-weight: 500;
}

.budget-note {
    text-align: center;
    color: var(--text-secondary, #999);
    font-size: 11px;
    font-style: italic;
}

/* Season Goals Section */
.season-goals-section {
    margin: 16px 0;
    padding: 12px 16px;
    background: var(--surface, #f8f9fa);
    border-radius: 8px;
    border: 1px solid var(--border, #e0e0e0);
}

.season-goals-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    color: var(--text-primary, #333);
}

.season-goals-toggle:hover {
    opacity: 0.8;
}

.season-goals-toggle .toggle-icon {
    font-size: 12px;
    width: 16px;
    text-align: center;
}

.season-goals-toggle .goals-header {
    font-size: 14px;
    font-weight: 600;
}

.season-goals-content {
    display: none;
    margin-top: 12px;
}

.season-goals-empty {
    padding: 12px;
    color: var(--text-secondary, #666);
    font-size: 13px;
    text-align: center;
    font-style: italic;
}

.season-goals-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Goal Cards */
.goal-card {
    padding: 10px 12px;
    background: white;
    border-radius: 6px;
    border: 1px solid var(--border, #e0e0e0);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.goal-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.goal-badge {
    font-size: 18px;
}

.goal-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary, #333);
}

.goal-card-details {
    font-size: 12px;
    color: var(--text-secondary, #666);
    margin-left: 26px;
}

/* Inline Goal Badge (on race cards) */
.goal-badge-inline {
    display: inline-block;
    font-size: 18px;
    margin-right: 6px;
    vertical-align: middle;
}

/* Three-Dot Menu */
.race-card-menu-container {
    position: relative;
    display: inline-block;
}

.race-card-menu-btn {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    padding: 4px 8px;
    cursor: pointer;
    color: var(--text-secondary, #666);
    border-radius: 4px;
    transition: background 0.2s;
}

.race-card-menu-btn:hover {
    background: var(--hover-bg, #f0f0f0);
    color: var(--text-primary, #333);
}

.race-card-menu-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: white;
    border: 1px solid var(--border, #e0e0e0);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 150px;
    z-index: 100;
    display: none;
}

.race-card-menu-dropdown.show {
    display: block;
}

.race-card-menu-dropdown .menu-item {
    display: block;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    text-align: left;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary, #333);
    cursor: pointer;
    transition: background 0.2s;
}

.race-card-menu-dropdown .menu-item:first-child {
    border-radius: 6px 6px 0 0;
}

.race-card-menu-dropdown .menu-item:last-child {
    border-radius: 0 0 6px 6px;
}

.race-card-menu-dropdown .menu-item:hover {
    background: var(--hover-bg, #f5f5f5);
}

.race-card-menu-dropdown .menu-item:focus {
    outline: none;
    background: var(--hover-bg, #f5f5f5);
}

/* Success Toast */
@keyframes slideUp {
    from {
        transform: translate(-50%, 20px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translate(-50%, 0);
        opacity: 1;
    }
    to {
        transform: translate(-50%, 20px);
        opacity: 0;
    }
}

.success-toast {
    animation: slideUp 0.3s ease-out;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .carbon-budget-section,
    .season-goals-section {
        margin: 12px 8px;
        padding: 12px;
    }
    
    .goal-card {
        padding: 8px 10px;
    }
    
    .race-card-menu-dropdown {
        min-width: 140px;
        font-size: 13px;
    }
    
    .budget-summary {
        display: block;
        margin-top: 2px;
        font-size: 12px;
        font-weight: 500;
        opacity: 0.8;
    }
    
    .budget-header-compact {
        font-size: 12px;
        gap: 6px;
        padding: 6px 10px;
    }
    
    .budget-icon {
        font-size: 14px;
    }
    
    .budget-used-header {
        font-size: 13px;
    }
    
    .budget-total-header {
        font-size: 12px;
    }
}

/* Compact Filter Row (Status Dropdown + Past Races Inline) */
.myraces-filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
    flex-wrap: wrap;
}

.status-filter-select {
    flex: 1;
    min-width: 150px;
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--border, #ddd);
    border-radius: 6px;
    background: white;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary, #333);
    cursor: pointer;
    transition: border-color 0.2s;
}

.status-filter-select:hover {
    border-color: var(--text-secondary, #aaa);
}

.status-filter-select:focus {
    outline: none;
    border-color: var(--accent, #2196f3);
}

.past-races-toggle-label-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary, #666);
    white-space: nowrap;
    user-select: none;
}

.past-races-toggle-label-inline:hover {
    color: var(--text-primary, #333);
}

.past-races-toggle-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    margin: 0;
}

.past-races-toggle-text {
    font-weight: 500;}

/* ============================================================
   Story 2: Conflict Detection — Summary Banner
   ============================================================ */

.conflict-summary-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 6px;
    font-size: 13px;
    color: #5d4037;
    min-height: 40px;
    box-sizing: border-box;
}

.conflict-summary-icon {
    font-size: 15px;
    flex-shrink: 0;
}

.conflict-summary-text {
    flex: 1;
    font-weight: 500;
}

.conflict-summary-view-btn {
    background: none;
    border: 1px solid #f9a825;
    color: #e65100;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.conflict-summary-view-btn:hover {
    background: #fff3cd;
    border-color: #e65100;
}

/* ============================================================
   Story 2: Conflict Detection — Inline Card Badges
   ============================================================ */

.race-card-conflicts {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 0 2px 0;
}

/* Base badge — neutral, informational */
.conflict-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    cursor: default;
    white-space: nowrap;
    line-height: 1.3;
}

/* Info level — blue-grey tint */
.conflict-badge--info {
    background: #e8f4fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

/* Warning level — amber tint (budget exceeded, very close races) */
.conflict-badge--warning {
    background: #fff8e1;
    color: #e65100;
    border: 1px solid #ffe082;
}

/* ============================================================
   Story 2: Conflict Detection — Summary Modal
   ============================================================ */

.conflict-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    padding: 20px;
}

.conflict-modal {
    background: var(--bg-primary, #fff);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.22);
    max-width: 440px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
}

.conflict-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary, #333);
}

.conflict-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-secondary, #888);
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s;
}

.conflict-modal-close:hover {
    background: var(--hover-bg, #f5f5f5);
}

.conflict-modal-list {
    list-style: none;
    padding: 0;
    margin: 0 0 14px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.conflict-modal-list li {
    padding: 8px 12px;
    background: var(--surface, #f8f9fa);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-primary, #333);
    border-left: 3px solid #ffe082;
    line-height: 1.4;
}

.conflict-modal-note {
    font-size: 11px;
    color: var(--text-secondary, #888);
    font-style: italic;
    margin: 0;
    padding-top: 8px;
    border-top: 1px solid var(--border, #eee);
}
