@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');

:root {
    --primary: #10b981;
    --primary-soft: rgba(16, 185, 129, 0.08);
    --secondary: #6366f1;
    --bg: #f8fafc;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #f1f5f9;
    --border-strong: #e2e8f0;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.03), 0 2px 4px -2px rgb(0 0 0 / 0.03);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.04), 0 4px 6px -4px rgb(0 0 0 / 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', sans-serif !important;
}

body {
    background-color: var(--bg);
    color: var(--text-main);
    direction: rtl;
    min-height: 100vh;
}

/* Auth Pages - Clean Light Look */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #f8fafc;
}

.login-card {
    background: var(--card-bg);
    padding: 3rem;
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-strong);
}

.login-card h1 {
    margin-bottom: 0.5rem;
    text-align: center;
    color: var(--text-main);
    font-size: 2.2rem;
    font-weight: 900;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1.5px solid var(--border-strong);
    border-radius: 10px;
    color: var(--text-main);
    outline: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

button {
    width: 100%;
    padding: 0.8rem;
    background: var(--primary);
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

button:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
}

/* Dashboard Layout */
.dashboard {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

aside {
    background: var(--sidebar-bg);
    border-left: 1px solid var(--border-strong);
    padding: 1.5rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* Enable scrolling */
}

/* Custom Scrollbar */
aside::-webkit-scrollbar {
    width: 6px;
}

aside::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 10px;
}

main {
    padding: 2rem 3rem;
    overflow-y: auto;
}

.nav-group {
    margin-bottom: 1.5rem;
}

.nav-group-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 800;
    padding: 0 0.5rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.nav-group-title::after {
    content: '▾';
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.nav-group.collapsed .nav-group-content {
    display: none;
}

.nav-group.collapsed .nav-group-title::after {
    transform: rotate(-90deg);
}

.nav-item {
    padding: 0.75rem 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: 10px;
    transition: all 0.2s;
    margin-bottom: 0.15rem;
    font-weight: 700;
    font-size: 0.9rem;
}

.nav-item:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.nav-item.active {
    background: var(--primary-soft);
    color: var(--primary);
}

.btn-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-size: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
}

.stat-card h3 {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.stat-card p {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main);
}

.table-container {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border-strong);
    overflow: hidden;
    box-shadow: var(--shadow);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #fafafa;
    text-align: right;
    padding: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 800;
    border-bottom: 1px solid var(--border-strong);
}

td {
    padding: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.95rem;
    color: var(--text-main);
}

tr:hover {
    background: #f9fafb;
}

.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 800;
    display: inline-block;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    width: auto;
}

.match-score {
    font-family: inherit;
    font-weight: 800;
    background: #f1f5f9;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    color: var(--text-main);
    font-size: 1rem;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-card {
    background: var(--card-bg);
    width: 100%;
    max-width: 500px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-strong);
    padding: 2rem;
    position: relative;
    animation: modalShow 0.3s ease-out;
}

@keyframes modalShow {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.modal-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.modal-close {
    background: #f1f5f9;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-muted);
}

.modal-close:hover {
    background: #e2e8f0;
}

@media (max-width: 1024px) {
    .dashboard {
        grid-template-columns: 1fr;
    }

    aside {
        display: none;
    }
}