/* --- Modals --- */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: var(--bg-surface);
    margin: auto;
    padding: 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 450px;
    position: relative;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 42, 42, 0.1);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal.show .modal-content {
    transform: translateY(0);
}

.close-btn {
    color: var(--text-muted);
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover,
.close-btn:focus {
    color: var(--primary-red);
    text-decoration: none;
}

.modal-content h2 {
    color: var(--text-primary);
    margin-bottom: 25px;
    text-align: center;
    font-size: 1.8rem;
}

/* Auth Forms */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

.form-group input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    color: white;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 10px rgba(255, 42, 42, 0.2);
}

.btn-block {
    width: 100%;
    padding: 12px;
    font-size: 1.1rem;
    margin-top: 10px;
}

.auth-switch {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 15px;
}

.auth-switch a {
    color: var(--primary-red);
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* About Modal Specific */
.about-content {
    max-width: 550px;
    /* Slightly wider for text */
}

.about-text {
    color: #e0e0e0;
    line-height: 1.7;
    margin-bottom: 25px;
}

.about-text p {
    margin-bottom: 15px;
    font-size: 1.05rem;
}

.about-highlights {
    background: rgba(255, 42, 42, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.highlight-item {
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.highlight-item i {
    color: var(--primary-red);
    font-size: 1.2rem;
    width: 25px;
    text-align: center;
}

/* Tournaments Modal Specific */
.tournaments-content {
    max-width: 900px;
    /* Much wider for video grid */
    max-height: 90vh;
    /* Don't exceed screen height */
    overflow-y: auto;
    /* Allow scrolling within the modal if too many videos */
}

.tournaments-desc {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 1.05rem;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
}

.video-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 15px;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.video-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-red);
    box-shadow: 0 5px 15px rgba(255, 42, 42, 0.15);
}

.video-card h4 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Responsive YouTube Embed Container */
.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    /* 16:9 Aspect Ratio */
    background: #000;
    border-radius: 6px;
    overflow: hidden;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Scrollbar for tournaments modal */
.tournaments-content::-webkit-scrollbar {
    width: 8px;
}

.tournaments-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.tournaments-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.tournaments-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-red);
}

@media (max-width: 768px) {
    .video-grid {
        grid-template-columns: 1fr;
    }
}