/* ============================================
   TennisTOUR - Modern UI/UX Stylesheet
   ============================================ */

/* CSS Variables for Design System */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary-color: #10b981;
    --secondary-dark: #059669;
    --danger-color: #ef4444;
    --danger-dark: #dc2626;
    --warning-color: #f59e0b;
    --success-color: #10b981;
    --info-color: #3b82f6;
    
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    
    --border-color: #e2e8f0;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* Reset & Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    margin: 0;
    padding: 0;
    direction: rtl;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

/* Header Styles - ATP Tour Inspired */
header.app-header,
header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: var(--border-radius-lg);
    padding: 35px 45px;
    margin-bottom: 35px;
    box-shadow: var(--shadow-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 25px;
    border-bottom: 4px solid var(--primary-color);
    position: relative;
    overflow: hidden;
}

header.app-header::before,
header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.logo-link:hover {
    transform: scale(1.02);
}

.app-logo {
    font-size: 2.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.app-title {
    color: white;
    font-size: 2.5rem;
    font-weight: 900;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    letter-spacing: -0.5px;
}

.app-tagline {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    margin: 0;
    font-weight: 400;
    letter-spacing: 0.2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.15);
    padding: 14px 24px;
    border-radius: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-greeting {
    color: white;
    font-weight: 600;
    font-size: 1.05rem;
}

.user-greeting strong {
    color: white;
    font-weight: 700;
}

.badge {
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-admin {
    background: rgba(16, 185, 129, 0.3);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.btn-sm {
    padding: 12px 24px;
    font-size: 0.95rem;
}

header h1 {
    color: white;
    margin: 0;
    font-size: 2.25rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.5px;
    position: relative;
    z-index: 1;
}

.subtitle {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.05rem;
    margin: 8px 0 0 0;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

/* Main Content */
main {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    min-height: 400px;
}

/* Card Component - Enhanced */
.card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.card:hover::before {
    transform: scaleX(1);
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-light);
}

.card h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.75rem;
}

.card p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 25px;
}

/* Button Styles - Professional ATP Tour Style */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-primary,
.btn {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover,
.btn:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: var(--secondary-dark);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-dark);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: #d97706;
    color: white;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin: 20px 0;
}

.tournament-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.tournament-table thead {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.tournament-table th {
    padding: 18px 24px;
    text-align: right;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.tournament-table td {
    padding: 18px 24px;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-fast);
    vertical-align: middle;
}

.tournament-table tbody tr {
    transition: var(--transition-fast);
    border-left: 3px solid transparent;
}

.tournament-table tbody tr:hover {
    background: linear-gradient(90deg, #f8fafc 0%, #f1f5f9 100%);
    border-left-color: var(--primary-color);
    transform: translateX(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.tournament-table tbody tr:last-child td {
    border-bottom: none;
}

/* Form Styles */
form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: block;
    font-size: 0.95rem;
}

input[type="text"],
input[type="date"],
input[type="number"],
input[type="email"],
input[type="tel"],
textarea,
select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition-fast);
    background: white;
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

input:hover,
textarea:hover,
select:hover {
    border-color: var(--primary-light);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1), 0 2px 8px rgba(37, 99, 235, 0.15);
    background: #fafbff;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-light);
    opacity: 0.7;
}

/* Form Field Container */
.form-field {
    position: relative;
    margin-bottom: 24px;
}

.form-field label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-field label::before {
    content: '';
    width: 4px;
    height: 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border-radius: 2px;
    display: inline-block;
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 24px;
    padding: 0;
    max-width: 550px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
}

/* Modal responsive */
@media (max-width: 768px) {
    .modal.show {
        padding: 0;
        align-items: flex-end;
    }
    
    .modal-content {
        max-height: 95vh;
        border-radius: 24px 24px 0 0;
        max-width: 100%;
    }
    
    .modal-header {
        padding: 25px 20px 20px;
    }
    
    .modal-header h2 {
        font-size: 1.5rem;
    }
    
    .modal-body {
        padding: 25px 20px;
    }
    
    .modal-footer {
        padding: 20px;
        flex-direction: column-reverse;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

@media (max-height: 700px) {
    .modal-content {
        max-height: 98vh;
    }
    
    .modal-header {
        padding: 20px 25px 15px;
    }
    
    .modal-header h2 {
        font-size: 1.4rem;
    }
    
    .modal-body {
        padding: 20px 25px;
    }
    
    .modal-footer {
        padding: 15px 25px 20px;
    }
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light), var(--secondary-color));
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.close {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 24px;
    font-weight: 300;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    z-index: 10;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.close:hover {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
    transform: rotate(90deg) scale(1.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.modal-header {
    padding: 35px 40px 25px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(16, 185, 129, 0.05) 100%);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-content h2 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.875rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.5px;
}

.modal-body {
    padding: 35px 40px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    max-height: calc(90vh - 200px);
}

/* Scrollbar styling for modal-body */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--secondary-color));
}

/* Firefox scrollbar */
.modal-body {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) #f1f1f1;
}

.modal-footer {
    padding: 25px 40px 35px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    display: flex;
    gap: 12px;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.modal-footer .btn {
    flex: 1;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.modal-footer .btn-success {
    background: linear-gradient(135deg, var(--success-color), var(--secondary-dark));
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.modal-footer .btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.modal-footer .btn-secondary {
    background: white;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}

.modal-footer .btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-light);
}

/* Footer */
footer {
    text-align: center;
    padding: 30px;
    color: white;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius-lg);
    margin-top: 30px;
    backdrop-filter: blur(10px);
}

/* Tab Styles */
.tabs {
    display: flex;
    gap: 10px;
    border-bottom: 3px solid var(--border-color);
    margin-bottom: 30px;
    overflow-x: auto;
    flex-wrap: wrap;
}

.tab {
    padding: 14px 24px;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition-fast);
    border-bottom: 3px solid transparent;
    margin-bottom: -3px;
    white-space: nowrap;
    position: relative;
}

.tab:hover {
    color: var(--primary-color);
    background: var(--bg-secondary);
}

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: var(--bg-secondary);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

/* Group Table Styles */
.group-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.group-table th,
.group-table td {
    border: 1px solid var(--border-color);
    padding: 12px;
    text-align: center;
    vertical-align: middle;
}

.group-table th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.group-table tr:nth-child(even) {
    background: var(--bg-secondary);
}

.group-table tr:hover {
    background: #e0e7ff;
}

/* Match Input Styles */
.match-inputs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 8px 0;
    flex-wrap: wrap;
}

.match-inputs input[type="text"] {
    width: 60px;
    text-align: center;
    padding: 8px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-weight: 600;
}

.match-inputs input[type="text"]:focus {
    border-color: var(--primary-color);
}

.score-display {
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.score-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.score-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.score-form input {
    width: 80px;
}

/* Button Variants */
.edit-btn {
    background: var(--info-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    transition: var(--transition-fast);
}

.edit-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.reset-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    transition: var(--transition-fast);
}

.reset-btn:hover {
    background: var(--danger-dark);
    transform: translateY(-1px);
}

/* Winner Options */
.winner-options {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    border: 2px solid var(--border-color);
    min-width: 150px;
}

.winner-options label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: var(--transition-fast);
    border-radius: var(--border-radius-sm);
    border: 2px solid transparent;
    width: 100%;
    margin: 0;
}

.winner-options label:hover {
    background: #dbeafe;
    border-color: var(--primary-color);
}

.winner-options input[type="radio"] {
    width: auto;
    margin: 0;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 100px;
}

.action-buttons button[type="submit"] {
    background-color: var(--success-color);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 10px 16px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition-fast);
}

.action-buttons button[type="submit"]:hover {
    background-color: var(--secondary-dark);
    transform: translateY(-1px);
}

.action-buttons button[formaction],
.action-buttons .btn-reset-match {
    background-color: var(--danger-color);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 10px 16px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition-fast);
}

.action-buttons button[formaction]:hover,
.action-buttons .btn-reset-match:hover {
    background-color: var(--danger-dark);
    transform: translateY(-1px);
}

/* Stat Cell */
.stat-cell {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* Create Knockout Button */
#create-knockout-btn {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    margin-top: 20px;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

#create-knockout-btn:hover {
    background: var(--secondary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .page-layout {
        flex-direction: column;
    }
    
    .sidebar-nav {
        width: 100%;
        position: relative;
    }
    
    .sidebar-sticky {
        position: relative;
        top: 0;
    }
    
    .nav-menu {
        flex-direction: row;
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    
    .nav-item {
        white-space: nowrap;
        min-width: fit-content;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header {
        flex-direction: column;
  text-align: center;
        padding: 20px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .content-section {
        padding: 25px;
    }
    
    .section-header h2 {
        font-size: 1.5rem;
    }
    
    .card {
        padding: 25px;
    }
    
    .tournament-table {
        font-size: 0.875rem;
    }
    
    .tournament-table th,
    .tournament-table td {
        padding: 10px 12px;
    }
    
    .modal-content {
        padding: 20px;
        width: 95%;
    }
    
    .nav-item {
        padding: 10px 14px;
        font-size: 0.9rem;
    }
}

/* Score Form Improvements */
.score-form {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  justify-content: center;
  width: 100%;
}

.score-form button {
    padding: 6px 12px;
    font-size: 0.875rem;
    white-space: nowrap;
}

.score-input {
    width: 90px !important;
    min-width: 90px;
    padding: 8px 10px !important;
    font-size: 0.95rem !important;
    text-align: center;
    border: 2px solid var(--primary-color) !important;
}

.score-input:focus {
    width: 100px !important;
    min-width: 100px;
}

.score-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 120px;
}

/* Knockout Bracket Styles - ATP Tour Style */
#bracket-container {
    margin: 30px 0;
    padding: 40px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    overflow-x: auto;
    overflow-y: visible;
}

#bracket-container svg {
    display: block;
    margin: 0 auto;
    background: transparent;
    border-radius: 12px;
    padding: 20px;
}

#bracket-container svg rect[fill="#ffffff"],
#bracket-container svg rect[fill="#dcfce7"] {
    transition: all 0.2s ease;
    cursor: pointer;
}

#bracket-container svg rect[fill="#ffffff"]:hover,
#bracket-container svg rect[fill="#dcfce7"]:hover {
    filter: brightness(0.98);
    stroke-width: 2;
}

#bracket-container svg line {
    stroke-width: 2;
    stroke: #cbd5e1;
    transition: stroke 0.2s ease;
}

#bracket-container svg text {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    pointer-events: none;
    user-select: none;
}

/* Group Table Styles */
.group-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin: 20px 0;
    min-width: 600px; /* Minimum width for table */
    font-size: 0.9rem; /* Slightly smaller font to fit more content */
}

.group-table thead th:first-child {
    position: sticky;
    right: 0;
    z-index: 20;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
}

.group-table thead th {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    font-weight: 600;
    padding: 14px;
    text-align: center;
    white-space: nowrap;
}

.group-table tbody td {
    padding: 12px;
    text-align: center;
    border: 1px solid var(--border-color);
    min-width: 140px;
}

.group-table tbody th {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 12px;
    text-align: right;
    font-weight: 600;
    border: 1px solid var(--border-color);
    white-space: nowrap;
    position: sticky;
    right: 0;
    z-index: 10;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

/* Wrapper for group tables to enable horizontal scrolling */
.table-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    width: 100%;
    margin: 20px 0;
    -webkit-overflow-scrolling: touch;
}

.table-wrapper::-webkit-scrollbar {
    height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Better spacing for sections */
section.tab-content {
    padding: 20px 0;
}

section.tab-content h2 {
    color: var(--primary-color);
    margin-bottom: 25px;
    font-size: 1.75rem;
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 10px;
}

section.tab-content h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

/* Page Layout with Sidebar */
.page-layout {
  display: flex;
    gap: 30px;
    align-items: flex-start;
    margin-top: 20px;
}

/* Sidebar Navigation */
.sidebar-nav {
    width: 280px;
    flex-shrink: 0;
}

.sidebar-sticky {
    position: sticky;
    top: 20px;
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 25px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.sidebar-sticky h3 {
    margin: 0 0 20px 0;
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 700;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.nav-menu {
  display: flex;
  flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition-fast);
    border: 2px solid transparent;
    background: var(--bg-secondary);
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateX(-4px);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(16, 185, 129, 0.1));
    color: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.nav-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.nav-text {
    flex: 1;
}

/* Welcome Section */
.welcome-section {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.welcome-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: var(--border-radius-lg);
    padding: 80px 70px;
    text-align: center;
    box-shadow: var(--shadow-xl);
    border: 2px solid var(--border-color);
    position: relative;
    overflow: hidden;
    margin-bottom: 40px;
}

.welcome-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.05) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.welcome-icon {
    font-size: 5rem;
    margin-bottom: 25px;
    display: inline-block;
    animation: bounce 2s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.welcome-card h2 {
    color: var(--primary-color);
    margin: 0 0 25px 0;
    font-size: 2.75rem;
    font-weight: 900;
    position: relative;
    z-index: 1;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(37, 99, 235, 0.1);
    line-height: 1.2;
}

.welcome-card p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    line-height: 1.8;
    max-width: 750px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    font-weight: 500;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.feature-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: var(--border-radius-lg);
    padding: 50px 45px;
    text-align: center;
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    min-height: 260px;
    justify-content: center;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.feature-card:hover::before {
    transform: scaleX(1);
}

.feature-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
}

.feature-icon {
    font-size: 4.5rem;
    margin-bottom: 12px;
    transition: transform 0.3s ease;
    display: block;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.feature-card:hover .feature-icon {
    transform: scale(1.15) rotate(5deg);
}

.feature-card h3 {
    margin: 0;
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--primary-color);
    transition: all 0.3s ease;
    letter-spacing: -0.3px;
    line-height: 1.3;
}

.feature-card:hover h3 {
    color: var(--primary-dark);
    transform: scale(1.05);
}

.feature-card p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.7;
    font-weight: 500;
}

/* Main Content Area */
.main-content {
    flex: 1;
    min-width: 0;
}

/* Content Sections */
.content-section {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    margin-bottom: 40px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    scroll-margin-top: 120px;
}

.section-header {
    margin-bottom: 30px;
}

.section-header h2 {
    margin: 0 0 15px 0;
    color: var(--primary-color);
    font-size: 1.875rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-divider {
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light), var(--secondary-color));
    border-radius: 2px;
    width: 100%;
    max-width: 200px;
}

.section-body {
    margin-top: 30px;
}

/* Login Page Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: var(--bg-gradient);
    background-attachment: fixed;
}

.login-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: var(--border-radius-lg);
    padding: 50px 45px;
    box-shadow: var(--shadow-xl);
    border: 2px solid var(--border-color);
    width: 100%;
    max-width: 480px;
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light), var(--secondary-color));
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
    display: inline-block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.login-header h2 {
    color: var(--primary-color);
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.3px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.login-form .form-field {
    margin-bottom: 28px;
}

.login-form .form-field label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 16px 20px;
    font-size: 1.05rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: var(--transition-fast);
    background: white;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1), 0 2px 8px rgba(37, 99, 235, 0.15);
    background: #fafbff;
}

.login-btn {
    width: 100%;
    padding: 16px 28px;
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 10px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.error-message {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    padding: 16px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 28px;
    border: 2px solid #fecaca;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}

.login-footer {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.login-footer p {
    margin: 0;
    font-weight: 500;
}

/* Drag & Drop Styles for Groups */
.draggable-player {
    user-select: none;
    transition: all 0.2s ease;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.draggable-player:hover {
    background: rgba(37, 99, 235, 0.1);
    transform: scale(1.05);
}

.draggable-player[draggable="true"] {
    cursor: grab !important;
}

.draggable-player[draggable="true"]:active {
    cursor: grabbing !important;
}

.draggable-player[draggable="false"] {
    cursor: default !important;
}

.group-container {
    transition: all 0.3s ease;
    border-radius: var(--border-radius);
    padding: 10px;
    margin-bottom: 30px;
}

.group-container.drag-over {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%);
    border: 3px dashed var(--primary-color);
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.3);
    transform: scale(1.02);
}

.group-container[data-droppable="true"] {
    min-height: 100px;
}

/* Footer Styles */
footer {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    border-radius: var(--border-radius-lg);
    padding: 30px 40px;
    margin-top: 40px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    border-top: 4px solid var(--primary-color);
}

footer p {
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 40px;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border-radius: var(--border-radius-lg);
    border: 2px dashed var(--border-color);
}

.empty-state h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 15px 0;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin: 0 0 25px 0;
}

/* Badge Styles */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-info {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
}

.badge-success {
    background: linear-gradient(135deg, var(--success-color), var(--secondary-dark));
    color: white;
}

.badge-danger {
    background: linear-gradient(135deg, var(--danger-color), var(--danger-dark));
    color: white;
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* ============================================
   עץ טורניר - אנימציות
   ============================================ */

/* אנימציה להופעת הברקט */
@keyframes fadeInBracket {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* אנימציה להופעת משחקים */
@keyframes slideInMatch {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* אנימציה להופעת קווים מחברים */
@keyframes drawLine {
    from {
        stroke-dasharray: 1000;
        stroke-dashoffset: 1000;
    }
    to {
        stroke-dasharray: 1000;
        stroke-dashoffset: 0;
    }
}

/* אנימציה עדינה להדגשת מנצח */
@keyframes highlightWinner {
    0%, 100% {
        opacity: 1;
        stroke-opacity: 1;
    }
    50% {
        opacity: 0.95;
        stroke-opacity: 0.8;
    }
}

/* סגנונות לברקט SVG */
.bracket-svg {
    animation: fadeInBracket 0.8s ease-in-out;
}

.bracket-svg rect {
    transition: all 0.3s ease;
}

.bracket-svg rect:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.bracket-svg line {
    animation: drawLine 1s ease-in-out;
    transition: stroke-width 0.2s ease;
}

.bracket-svg line:hover {
    stroke-width: 3;
}

/* אנימציה למנצחים */
.bracket-svg rect[fill="#dcfce7"] {
    animation: highlightWinner 2s ease-in-out infinite;
}

/* שיפורים נוספים לברקט */
#bracket-container {
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.bracket-svg .player-box:hover {
    filter: brightness(0.95);
    transform: translateX(-2px);
}

/* עיצוב מקצועי לקווים */
.bracket-svg line {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}
