/* ============================================
   Dashboard Section Wrapper
   ============================================ */
#dashboard-section {
    background: var(--bg-secondary);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    margin: var(--spacing-lg) 0;
}

@media (max-width: 768px) {
    #dashboard-section {
        padding: var(--spacing-sm);
        margin: var(--spacing-sm) 0;
    }
}

@media (min-width: 769px) {
    #dashboard-section {
        padding: var(--spacing-xl);
    }
}

/* ============================================
   Dashboard Header
   ============================================ */
.dashboard-header {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.dashboard-header>div:first-child {
    flex: 1;
}

.dashboard-header>div:last-child {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

@media (min-width: 769px) {
    .dashboard-header {
        flex-direction: row;
        align-items: center;
    }

    .dashboard-header>div:last-child {
        flex-direction: row;
    }
}

/* Sticky Header */
.dashboard-header-sticky {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--accent-primary);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    margin: calc(var(--spacing-sm) * -1) calc(var(--spacing-lg) * -1) var(--spacing-md) calc(var(--spacing-lg) * -1);
}

@media (min-width: 769px) {
    .dashboard-header-sticky {
        padding: var(--spacing-md) var(--spacing-xl);
    }
}

.dashboard-header-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.dashboard-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.dashboard-header-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.dashboard-header-name {
    font-size: 1.1em;
    font-weight: bold;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-header-department {
    font-size: 0.9em;
    color: var(--accent-primary);
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-header-description {
    font-size: 0.8em;
    color: var(--text-muted);
    font-style: italic;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.dashboard-header-tick {
    font-size: 0.9em;
    color: var(--accent-primary);
    font-weight: 600;
    white-space: nowrap;
    width: 100%;
    max-width: 200px;
    min-width: 150px;
}

.dashboard-header-tick-label {
    font-size: 0.75em;
    color: var(--text-muted);
    font-weight: normal;
}

/* Tick Progress Bar */
.tick-progress-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    width: 100%;
}

.tick-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
}

.tick-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: 3px;
    transition: width 0.5s ease;
    position: relative;
}

.tick-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.tick-progress-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.85em;
}

.tick-countdown {
    background: var(--bg-primary);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    font-size: 1em;
    font-weight: bold;
    color: var(--accent-primary);
    border: 2px solid var(--accent-primary);
    text-align: center;
    width: 100%;
}

@media (min-width: 769px) {
    .tick-countdown {
        width: auto;
    }
}

/* ============================================
   Company Status (Desktop & Header)
   ============================================ */
.dashboard-header-company-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    margin-bottom: 4px;
}

.company-status-header {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85em;
    white-space: nowrap;
}

.company-status-label {
    font-weight: 600;
    color: var(--text-primary);
}

.company-status-separator {
    color: var(--text-muted);
}

.company-status-value {
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

.company-status-value.status-functional {
    color: #4caf50;
}

.company-status-value.status-tense {
    color: #ffc107;
}

.company-status-value.status-dysfunctional {
    color: #ff9800;
}

.company-status-value.status-incapable {
    color: #f44336;
}

.company-status-value.status-reorganization {
    color: #212121;
}

.company-status-description {
    font-size: 0.75em;
    color: var(--text-muted);
    font-style: italic;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.company-status-loading {
    font-size: 0.85em;
    color: var(--text-muted);
}



/* ============================================
   Collapsible Section Cards
   ============================================ */
.dashboard-section-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    margin: var(--spacing-lg) 0;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all 0.3s ease;
}

.dashboard-section-card:hover {
    box-shadow: var(--shadow-md);
}

.dashboard-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    cursor: pointer;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--accent-primary);
    transition: background 0.2s ease;
    min-height: var(--touch-min);
}

.dashboard-section-header:hover {
    background: var(--bg-tertiary);
}

.dashboard-section-header h3 {
    margin: 0;
    color: var(--text-primary);
    flex: 1;
}

.dashboard-section-toggle {
    font-size: 1.2em;
    color: var(--accent-primary);
    transition: transform 0.3s ease;
    min-width: var(--touch-min);
    min-height: var(--touch-min);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashboard-section-card.collapsed .dashboard-section-toggle {
    transform: rotate(-90deg);
}

.dashboard-section-content {
    padding: var(--spacing-lg);
    max-height: 10000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    opacity: 1;
}

.dashboard-section-card.collapsed .dashboard-section-content {
    max-height: 0;
    opacity: 0;
    padding: 0 var(--spacing-lg);
}

@media (max-width: 768px) {
    .dashboard-section-card {
        margin: var(--spacing-sm) 0;
    }

    .dashboard-section-header {
        padding: var(--spacing-sm);
    }

    .dashboard-section-content {
        padding: var(--spacing-sm);
    }
}

/* ============================================
   Effects Bar (Common & Collapsible)
   ============================================ */
.effects-bar-collapsible {
    background: var(--bg-primary);
    border-bottom: 1px solid #444;
    margin: 0 calc(var(--spacing-lg) * -1) var(--spacing-md) calc(var(--spacing-lg) * -1);
    transition: all 0.3s ease;
    overflow: hidden;
}

.effects-bar-collapsible.collapsed {
    max-height: 0;
    border-bottom: none;
    margin-bottom: 0;
}

/* Auf Mobile standardmäßig ausgeblendet */
@media (max-width: 768px) {
    .effects-bar-collapsible.collapsed {
        max-height: 28px; /* Nur Header sichtbar - kompakter */
        border-bottom: 1px solid #444;
        margin-bottom: var(--spacing-xs);
    }
    
    .effects-bar-collapsible:not(.collapsed) {
        max-height: 300px;
        border-bottom: 1px solid #444;
        margin-bottom: var(--spacing-md);
    }
    
    /* Badge immer sichtbar auf Mobile */
    .effects-bar-collapsible.collapsed .effects-bar-toggle-header {
        display: flex;
        padding: 2px var(--spacing-xs);
        min-height: 24px;
    }
    
    .effects-bar-collapsible.collapsed .effects-bar-toggle-arrow {
        display: block;
    }
}

.effects-bar-toggle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px var(--spacing-sm);
    cursor: pointer;
    user-select: none;
    min-height: 24px;
    background: var(--bg-tertiary);
    transition: background 0.2s ease;
    position: relative;
}

.effects-bar-toggle-header:hover {
    background: rgba(108, 92, 231, 0.1);
}

.effects-bar-toggle-label {
    font-size: 0.7em;
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.effects-bar-toggle-arrow {
    font-size: 0.65em;
    color: var(--accent-primary);
    transition: transform 0.3s ease;
    min-width: 16px;
    text-align: center;
}

.effects-bar-collapsible.collapsed .effects-bar-toggle-arrow {
    transform: rotate(-90deg);
}

.effects-bar-collapsible-content {
    padding: 4px var(--spacing-sm);
    max-height: 200px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 769px) {
    .effects-bar-collapsible-content {
        max-height: 300px;
    }
}

.effects-bar-collapsible.collapsed .effects-bar-collapsible-content {
    display: none;
}

/* Effects Bar Styling */
.effects-bar-wrapper {
    position: fixed;
    z-index: 100;
}

/* Hide Sticky Wrapper if Collapsible is present */
.dashboard-section:has(.effects-bar-collapsible)~* .effects-bar-wrapper {
    display: none;
}

.effects-bar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 4px 6px;
    border-radius: 0;
    flex-wrap: wrap;
    border: none;
    box-shadow: none;
    transition: box-shadow 0.3s ease;
    cursor: move;
    user-select: none;
    max-width: calc(100vw - var(--spacing-md) * 2);
    min-width: 120px;
}

.effects-bar.dragging {
    cursor: grabbing;
    box-shadow: 0 4px 16px rgba(108, 92, 231, 0.4);
    transition: none;
}

.effects-bar-content {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    flex: 1;
    transition: all 0.3s ease;
}

.effect-icon {
    position: relative;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    cursor: help;
    transition: transform 0.2s;
    font-size: 10px;
    min-width: 14px;
    min-height: 14px;
    flex-shrink: 0;
    background: transparent;
    border: none;
}

.effect-icon:hover {
    transform: scale(1.2);
}

.effect-icon.buff {
    background: transparent;
    border: none;
}

.effect-icon.debuff {
    background: transparent;
    border: none;
}

.effects-count-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--accent-primary);
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 0.65em;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    z-index: 102;
    border: 2px solid var(--bg-primary);
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
}

/* Badge im Dashboard-Header */
.effects-bar-toggle-header .effects-count-badge {
    position: relative;
    top: 0;
    right: 0;
    margin-left: 4px;
    z-index: 1;
    padding: 1px 5px;
    font-size: 0.6em;
    min-width: 16px;
    border-radius: 8px;
}

.effects-count-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.6);
}

.effects-count-badge:active {
    transform: scale(0.95);
}

/* Mobile Effects Bar */
@media (max-width: 768px) {
    .effects-bar {
        padding: 4px 6px;
        max-height: 24px;
        overflow: visible;
        min-width: 120px;
    }

    .effect-icon {
        width: 14px;
        height: 14px;
        font-size: 10px;
        min-width: 14px;
        min-height: 14px;
    }

    .effects-count-badge {
        font-size: 0.7em;
        top: -6px;
        right: -6px;
        min-width: 20px;
        padding: 2px 6px;
    }
}

/* ============================================
   Company Status Footer (Mobile)
   ============================================ */
.company-status-footer-mobile {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 2px solid var(--accent-primary);
    padding: var(--spacing-sm) var(--spacing-md);
    z-index: 1000;
    display: none;
    box-sizing: border-box;
    width: 100%;
}



@media (min-width: 769px) {
    .company-status-footer-mobile {
        display: none !important;
    }
}

.company-status-footer {
    display: flex !important;
    align-items: center;
    justify-content: space-between !important;
    gap: 8px;
    cursor: pointer;
    padding: 4px 0;
    border-radius: 4px;
    transition: background 0.2s;
    width: 100% !important;
}

.company-status-footer:hover {
    background: rgba(108, 92, 231, 0.1);
}

.company-status-footer-label {
    font-size: 0.9em;
    color: var(--text-secondary);
    flex-shrink: 0;
    white-space: nowrap;
    display: block;
}

.company-status-footer-value {
    font-weight: 600;
    font-size: 0.9em;
    flex-shrink: 1;
    text-align: center;
    white-space: nowrap;
    display: block;
    flex-grow: 1;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
}

.company-status-footer-value.status-functional {
    background-color: rgba(76, 175, 80, 0.2);
    color: #4caf50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.company-status-footer-value.status-tense {
    background-color: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.company-status-footer-value.status-dysfunctional {
    background-color: rgba(255, 152, 0, 0.2);
    color: #ff9800;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.company-status-footer-value.status-incapable {
    background-color: rgba(244, 67, 54, 0.2);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.company-status-footer-value.status-reorganization {
    background-color: rgba(33, 33, 33, 0.5);
    color: #aaa;
    border: 1px solid rgba(85, 85, 85, 0.3);
}

/* ============================================
   Season Progress Footer
   ============================================ */
.season-progress-footer {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 6px !important;
    background: rgba(0, 0, 0, 0.2) !important;
    z-index: 9999 !important;
    overflow: visible !important;
    cursor: pointer;
    display: none;
    /* Changed from block !important */
    margin: 0 !important;
    padding: 0 !important;
}

/* ============================================
   Reroll Button
   ============================================ */
.reroll-actions-btn {
    background: var(--bg-tertiary);
    border: 2px dashed var(--accent-primary);
    border-radius: 12px;
    padding: var(--spacing-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    min-height: 60px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-sm);
    flex: 0 1 calc(50% - (var(--spacing-md) / 2));
    max-width: calc(50% - (var(--spacing-md) / 2));
    margin-top: 0;
    color: var(--accent-primary);
    font-weight: bold;
    font-size: 0.95em;
    text-align: center;
}

.reroll-actions-btn:hover {
    background: rgba(108, 92, 231, 0.1);
    transform: translateY(-4px);
    border-style: solid;
    box-shadow: 0 8px 20px rgba(108, 92, 231, 0.2);
}

.reroll-actions-btn:active {
    transform: translateY(-2px);
}

.reroll-actions-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}

.reroll-actions-btn::before {
    display: none;
    /* Hide the ripple effect from global button style if needed */
}

/* Mobile adjustments for reroll card */
@media (max-width: 768px) {
    .reroll-actions-btn {
        flex: 0 1 calc(50% - 5px);
        max-width: calc(50% - 5px);
        min-height: 70px;
        font-size: 0.9em;
        padding: var(--spacing-xs);
    }
}

.season-progress-bar {
    height: 100% !important;
    min-width: 3px !important;
    background: linear-gradient(to right,
            #4CAF50 0%,
            #4CAF50 30%,
            #FFC107 30%,
            #FFC107 50%,
            #FF9800 50%,
            #FF9800 70%,
            #F44336 70%,
            #F44336 90%,
            #212121 90%,
            #212121 100%) !important;
    transition: width 0.5s ease-out;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
    border-radius: 0 2px 2px 0;
    margin: 0 !important;
    padding: 0 !important;
}