/* ============================================
   تنسيقات الصفحات الجديدة
   ============================================ */

/* عناوين الأقسام */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 20px;
}

.section-header h2 {
    font-family: 'Katibeh', cursive;
    font-size: 3em;
    color: var(--primary);
    margin: 0;
}

.section-description {
    font-size: 1.2em;
    color: #666;
    margin-top: 10px;
}

/* نموذج إنشاء الدوري */
.create-tournament-form {
    max-width: 800px;
    margin: 0 auto;
}

.form-section {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.form-section-title {
    font-family: 'Katibeh', cursive;
    font-size: 2em;
    color: var(--primary);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.step-number {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    font-weight: 900;
}

.required {
    color: #dc3545;
}

.help-text {
    font-size: 0.9em;
    color: #666;
    margin-top: 8px;
    line-height: 1.6;
}

/* راديو أزرار */
.radio-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.radio-option {
    position: relative;
    cursor: pointer;
}

.radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.radio-content {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    border: 2px solid #ddd;
    border-radius: 10px;
    transition: all 0.3s;
    background: white;
}

.radio-option input[type="radio"]:checked + .radio-content {
    border-color: var(--accent);
    background: rgba(212, 175, 55, 0.05);
}

.radio-icon {
    font-size: 2.5em;
}

.radio-content strong {
    display: block;
    margin-bottom: 5px;
    color: var(--primary);
}

.radio-content p {
    font-size: 0.9em;
    color: #666;
    margin: 0;
}

/* مراجعة */
.review-card {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 25px;
}

.review-item {
    display: flex;
    justify-content: space-between;
    padding: 15px 0;
    border-bottom: 1px solid #e0e0e0;
}

.review-item:last-child {
    border-bottom: none;
}

.review-item strong {
    color: var(--primary);
}

.participants-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.participant-tag {
    background: var(--accent);
    color: var(--dark);
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.95em;
}

.info-box {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    padding: 25px;
    border-radius: 15px;
    border-right: 4px solid #2196F3;
    margin-bottom: 25px;
}

.info-box h4 {
    color: #1976D2;
    margin-bottom: 15px;
}

.info-box ul {
    list-style: none;
    padding: 0;
}

.info-box li {
    padding: 8px 0;
    color: #555;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

/* صفحة الدوريات */
.tournament-selector {
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.tournament-selector label {
    font-weight: 600;
    color: var(--primary);
    font-size: 1.1em;
}

.tournament-selector select {
    flex: 1;
    max-width: 500px;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1.05em;
}

.tournament-details {
    margin-top: 30px;
}

.tournament-info-card {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(44,24,16,0.3);
}

.tournament-info-card h3 {
    font-family: 'Katibeh', cursive;
    font-size: 2.5em;
    margin-bottom: 15px;
}

.tournament-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.badge {
    background: rgba(255,255,255,0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.95em;
    font-weight: 600;
}

/* جدول الترتيب */
.standings-table {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.standings-table table {
    width: 100%;
    border-collapse: collapse;
}

.standings-table thead {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.standings-table th {
    padding: 18px;
    text-align: center;
    font-weight: 700;
    font-size: 1.1em;
}

.standings-table td {
    padding: 16px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}

.standings-table tbody tr:hover {
    background: rgba(212, 175, 55, 0.05);
}

/* الجولات */
.round-card {
    background: white;
    border-radius: 15px;
    margin-bottom: 25px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.round-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.round-header h4 {
    margin: 0;
    font-size: 1.5em;
}

.round-date {
    font-size: 0.9em;
    opacity: 0.9;
}

.reserve-note {
    background: #fff9e6;
    padding: 15px;
    text-align: center;
    color: #8b6914;
    font-weight: 600;
}

.matches-grid {
    padding: 20px;
    display: grid;
    gap: 15px;
}

.match-card {
    background: linear-gradient(135deg, var(--white-square), var(--black-square));
    padding: 20px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.match-teams {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.team-home, .team-away {
    font-weight: 600;
    font-size: 1.1em;
}

.match-vs {
    font-weight: 900;
    color: var(--dark);
}

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

.match-score {
    font-size: 1.8em;
    font-weight: 900;
    color: var(--primary);
}

.match-outcome {
    font-size: 1.2em;
    color: #666;
}

/* النتائج */
.results-input {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.result-input-card {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.result-input-card h5 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1.3em;
}

.board-result {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.players-vs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
    font-weight: 600;
}

/* الأخبار */
.news-form-card {
    background: white;
    padding: 35px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    margin-bottom: 40px;
}

.news-form-card h3 {
    font-family: 'Katibeh', cursive;
    font-size: 2em;
    color: var(--primary);
    margin-bottom: 25px;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
}

.news-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    transition: transform 0.3s;
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.news-image {
    width: 100%;
    height: 250px;
    background-size: cover;
    background-position: center;
    background-color: linear-gradient(135deg, var(--primary), var(--secondary));
}

.news-image-placeholder {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5em;
    color: var(--accent);
}

.news-content {
    padding: 25px;
}

.news-date {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.news-title {
    font-family: 'Katibeh', cursive;
    font-size: 1.8em;
    color: var(--primary);
    margin-bottom: 15px;
    line-height: 1.3;
}

.news-excerpt {
    color: #666;
    line-height: 1.8;
    margin-bottom: 20px;
}

.news-actions {
    display: flex;
    gap: 10px;
}

/* حالة فارغة */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-icon {
    font-size: 6em;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 2em;
    color: var(--primary);
    margin-bottom: 10px;
}

.empty-state p {
    color: #666;
    font-size: 1.2em;
    margin-bottom: 30px;
}

/* صفحة الملفات */
.storage-info-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.storage-info-card h3 {
    margin-bottom: 20px;
    font-size: 1.8em;
}

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

.storage-stat {
    background: rgba(255,255,255,0.1);
    padding: 15px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.9;
}

.stat-value {
    font-size: 1.5em;
    font-weight: 900;
}

.files-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.upload-form-card {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.upload-form-card h4 {
    color: var(--primary);
    margin-bottom: 20px;
}

/* الصور */
.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.image-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s;
}

.image-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.image-thumbnail {
    width: 100%;
    height: 200px;
    background-size: cover;
    background-position: center;
    background-color: #f0f0f0;
}

.image-info {
    padding: 15px;
}

.image-name {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-meta {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.6;
}

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

/* تصدير Excel */
.export-list {
    display: grid;
    gap: 15px;
}

.export-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.export-info h4 {
    color: var(--primary);
    margin-bottom: 5px;
}

.export-info p {
    color: #666;
    font-size: 0.9em;
}

/* النسخ الاحتياطي */
.backup-section {
    max-width: 700px;
}

.backup-actions {
    margin: 30px 0;
}

.backups-list {
    display: grid;
    gap: 10px;
}

.backup-card {
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.backup-info strong {
    display: block;
    color: var(--primary);
    margin-bottom: 3px;
}

.backup-info small {
    color: #666;
    font-size: 0.85em;
}

/* المستخدمين */
.users-list {
    display: grid;
    gap: 15px;
    margin-top: 20px;
}

.user-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info h4 {
    color: var(--primary);
    margin-bottom: 5px;
}

.user-role {
    display: inline-block;
    background: var(--accent);
    color: var(--dark);
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 600;
    margin: 5px 0;
}

.user-info small {
    display: block;
    color: #666;
    font-size: 0.85em;
    margin-top: 5px;
}

/* الفرق واللاعبين */
.tp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.card {
    background: #fff;
    padding: 14px;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
}

/* التصميم المتجاوب */
@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .form-section {
        padding: 25px 20px;
    }
    
    .radio-group {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .match-card {
        flex-direction: column;
        text-align: center;
    }
    
        .news-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Responsive Tables
   ============================================ */
@media (max-width: 768px) {
    .standings-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .standings-table table {
        min-width: 600px;
        font-size: 0.85em;
    }
    
    .standings-table th,
    .standings-table td {
        padding: 8px 4px;
    }
    
    /* Tournament selector */
    .tournament-selector {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tournament-selector select {
        width: 100%;
        padding: 12px;
        font-size: 1em;
    }
    
    /* Results input */
    .results-input select {
        width: 100%;
        padding: 12px;
    }
    
    /* Match cards */
    .tournament-details .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 5px;
    }
    
    .tournament-details .tab {
        white-space: nowrap;
        padding: 10px 15px;
        font-size: 0.9em;
    }
}

/* ============================================
   Responsive Modals
   ============================================ */
@media (max-width: 768px) {
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 10% auto !important;
        padding: 15px !important;
        max-height: 85vh !important;
    }
    
    #gameModal .modal-content {
        width: 95% !important;
        max-width: 95% !important;
    }
    
    #board {
        width: 100% !important;
        max-width: 320px !important;
        margin: 0 auto !important;
    }
    
    /* Form inputs in modals */
    .modal-content input,
    .modal-content select,
    .modal-content textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 10px !important;
    }
    
    .modal-content .btn {
        padding: 12px 20px;
        font-size: 1em;
    }
}

/* ============================================
   Fix horizontal overflow
   ============================================ */
@media (max-width: 768px) {
    * {
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    body {
        overflow-x: hidden;
    }
    
    .container {
        padding: 30px 15px;
        overflow-x: hidden;
    }
    
    /* Buttons */
    .btn {
        padding: 12px 25px;
        font-size: 1em;
        min-height: 44px;
    }
    
    .btn-small {
        padding: 8px 15px;
        font-size: 0.9em;
    }
    
    /* Form elements */
    input[type="text"],
    input[type="number"],
    input[type="email"],
    select,
    textarea {
        font-size: 16px !important;
        padding: 10px 12px !important;
        min-height: 44px;
    }
    
    /* Board inputs */
    .tournament-details input[type="text"],
    .tournament-details select {
        font-size: 14px !important;
        padding: 8px !important;
        min-width: 100px !important;
    }
    
    /* Watch buttons */
    .tournament-details button {
        min-height: 36px;
        padding: 6px 12px;
    }
    
    /* Section headers */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .section-header h2 {
        font-size: 2em;
    }
    
    /* Tournament cards */
    .tournament-info-card {
        padding: 15px;
    }
    
    .tournament-meta {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .badge {
        font-size: 0.8em;
        padding: 4px 8px;
    }
    
    /* Match details */
    .tournament-details > div[style*="background"] {
        padding: 10px 12px !important;
        margin-bottom: 8px !important;
    }
    
    /* Results tab */
    #resultsContainer > div {
        padding: 12px !important;
    }
    
    /* Teams and players page */
    .teams-grid,
    .players-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Touch-friendly improvements
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    a, button, select, input[type="checkbox"], input[type="radio"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .btn:hover {
        transform: none;
    }
    
    /* Clearer active states */
    .tab.active {
        border-bottom-width: 3px;
    }
}
