@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Tajawal:wght@400;500;700&display=swap');

:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --danger: #ef4444;
    --bg-dark: #0f172a;
    --card-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --success: #10b981;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', 'Tajawal', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body.rtl {
    direction: rtl;
    font-family: 'Tajawal', 'Inter', sans-serif;
}

.app-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 30px;
}

.lang-switcher {
    display: flex;
    gap: 10px;
    margin-left: 15px;
}

body.rtl .lang-switcher {
    margin-left: 0;
    margin-right: 15px;
}

.btn-lang {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-lang:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

nav a {
    color: var(--text-dim);
    text-decoration: none;
    margin-left: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

body.rtl nav a {
    margin-left: 0;
    margin-right: 20px;
}

nav a.active,
nav a:hover {
    color: var(--text-main);
}

.hero {
    margin-bottom: 30px;
}

.hero h1 {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.hero p {
    color: var(--text-dim);
}

.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
}

.search-container {
    position: relative;
    margin-bottom: 20px;
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 12px 16px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

input:focus {
    border-color: var(--primary);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1e293b;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    margin-top: 5px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
}

.search-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--glass-border);
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.selection-status {
    animation: fadeIn 0.3s ease-out;
}

.player-info-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.player-info-row img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    background: #334155;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.action-buttons .btn {
    flex: 1;
}

.btn {
    padding: 12px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

.btn:active {
    transform: scale(0.98);
}

.btn.primary {
    background-color: var(--primary);
    color: white;
}

.btn.danger {
    background-color: var(--danger);
    color: white;
}

.btn.secondary {
    background-color: #334155;
    color: white;
}

.attendance-list {
    margin-top: 40px;
}

.attendance-list h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
}

/* RTL Adjustments */
body.rtl .attendance-list h2 {
    text-align: right;
}

body.rtl .attendee-card {
    position: relative;
}

body.rtl .attendee-card span[style*="left"] {
    left: auto !important;
    right: 8px !important;
}

body.rtl .attendee-card span[style*="right"] {
    right: auto !important;
    left: 5px !important;
}

body.rtl .player-info-row {
    flex-direction: row;
}

body.rtl .player-table th,
body.rtl .player-table td {
    text-align: right;
}

.attendees-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.attendee-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
}

.attendee-card img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-bottom: 10px;
}

.attendee-card h4 {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attendee-card p {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.hidden {
    display: none !important;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    border: 1px solid var(--primary);
    padding: 12px 24px;
    border-radius: 30px;
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

footer {
    margin-top: auto;
    padding: 40px 0 20px;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.8rem;
}

/* Admin Styles */
.admin-login {
    max-width: 400px;
    margin: 40px auto;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: var(--text-dim);
}

.player-manager {
    margin-top: 20px;
}

.player-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.player-table th,
.player-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.player-table th {
    font-size: 0.8rem;
    color: var(--text-dim);
    text-transform: uppercase;
}

/* Team Styles */
.teams-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.team-box {
    border: 1px solid var(--primary);
}

.team-header {
    background: rgba(99, 102, 241, 0.2);
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
}

/* Footer Styles */
.app-footer {
    margin-top: 60px;
    padding: 30px 20px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.2));
}

.app-footer p {
    margin: 0;
    opacity: 0.7;
    font-size: 0.9rem;
    font-weight: 300;
    letter-spacing: 0.5px;
    color: var(--text-dim);
}