/**
 * Birthday Paradox Visualiser Styles
 */

.birthday-paradox {
    padding: 1.5rem 0 3rem;
}

/* Title Section */
.title-section {
    text-align: center;
    margin-bottom: 1.25rem;
}

.title-section h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.control-btn {
    padding: 0.625rem 1.25rem;
    background: var(--surface-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: var(--surface-hover);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn.primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.control-btn.primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.control-btn.reset {
    background: var(--surface-color);
    border-color: #ef4444;
    color: #ef4444;
}

.control-btn.reset:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Statistics Dashboard */
.stats-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

.stat-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 10px;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    word-break: break-word;
}

/* Explanation Box */
.explanation-box {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.explanation-toggle {
    width: 100%;
    padding: 1rem 1.25rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: background 0.2s ease;
}

.explanation-toggle:hover {
    background: var(--surface-hover);
}

.toggle-icon {
    font-size: 1.25rem;
}

.toggle-text {
    flex: 1;
    text-align: left;
}

.explanation-content {
    padding: 0 1.25rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.explanation-content.active {
    max-height: 500px;
    padding: 0 1.25rem 1.25rem;
}

.explanation-content p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Room Container */
.room-container {
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    min-height: 400px;
}

.room {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 50px));
    gap: 1rem;
    justify-content: center;
    align-items: start;
}

/* Person Avatar */
.person {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    animation: personAppear 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes personAppear {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.person:hover {
    transform: scale(1.1);
}

.person::before {
    content: attr(data-birthday);
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface-hover);
    color: var(--text-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.person:hover::before {
    opacity: 1;
}

/* Person with collision */
.person.collision {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: #10b981;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
    animation: collisionPulse 2s ease-in-out infinite;
}

@keyframes collisionPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 30px rgba(16, 185, 129, 0.8);
    }
}

/* Simulation Section */
.simulation-section {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.simulation-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.simulation-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.simulation-controls {
    margin-bottom: 1.5rem;
}

.simulation-settings {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.simulation-settings label {
    font-weight: 500;
    color: var(--text-primary);
}

.simulation-settings input[type="number"],
.simulation-settings select {
    padding: 0.5rem;
    background: var(--background-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    min-width: 80px;
}

.simulation-settings input[type="number"]:focus,
.simulation-settings select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.simulation-results {
    margin-top: 1.5rem;
}

.result-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.result-item {
    background: var(--background-color);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

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

.result-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.progress-visualization {
    margin-top: 1rem;
}

.progress-bar-container {
    width: 100%;
    height: 30px;
    background: var(--background-color);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 15px;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
}

.convergence-info {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: var(--background-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* About Section */
.about-section {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.about-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.about-section p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.about-section p:last-child {
    margin-bottom: 0;
}

.about-section em {
    color: var(--primary-light);
    font-style: italic;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .title-section h1 {
        font-size: 2rem;
    }
    
    .stats-dashboard {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .stat-icon {
        font-size: 1.5rem;
        width: 40px;
        height: 40px;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .room {
        grid-template-columns: repeat(auto-fill, minmax(45px, 45px));
        gap: 0.75rem;
    }
    
    .person {
        width: 45px;
        height: 45px;
        font-size: 1.25rem;
    }
    
    .simulation-settings {
        flex-direction: column;
        align-items: stretch;
    }
    
    .simulation-settings > * {
        width: 100%;
    }
    
    .result-summary {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .title-section h1 {
        font-size: 1.75rem;
    }
    
    .control-group {
        width: 100%;
        flex-direction: column;
    }
    
    .control-btn {
        width: 100%;
    }
    
    .stats-dashboard {
        grid-template-columns: 1fr;
    }
    
    .room-container {
        padding: 1rem;
    }
    
    .room {
        grid-template-columns: repeat(auto-fill, minmax(40px, 40px));
        gap: 0.5rem;
    }
    
    .person {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}
