:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --secondary: #0ea5e9;
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --danger: #ef4444;
    --success: #22c55e;
    --whatsapp: #25D366;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

html[dir="ltr"] body {
    font-family: 'Outfit', 'Cairo', sans-serif;
}

/* Language Toggle */
.lang-toggle-container {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}
.lang-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.lang-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
}

html[dir="rtl"] .flip-icon {
    transform: scaleX(-1);
}

/* Animated Background */
.background-animation {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(79, 70, 229, 0.15), transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(14, 165, 233, 0.1), transparent 40%);
    z-index: -1;
    animation: drift 20s linear infinite alternate;
}

@keyframes drift {
    0% { transform: rotate(0deg) translate(0, 0); }
    100% { transform: rotate(5deg) translate(2%, 2%); }
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.app-header {
    text-align: center;
    margin-bottom: 3rem;
}

.app-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, #93c5fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.app-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

/* Glassmorphism */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.form-section {
    margin-bottom: 3rem;
}

.form-section h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

/* Inputs */
.input-group {
    margin-bottom: 1.25rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    right: 1rem;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.input-wrapper input,
.input-wrapper select {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.85rem 3rem 0.85rem 1rem;
    color: var(--text-main);
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
}

html[dir="ltr"] .input-wrapper input,
html[dir="ltr"] .input-wrapper select {
    padding: 0.85rem 1rem 0.85rem 3rem;
}

html[dir="ltr"] .input-wrapper i {
    right: auto;
    left: 1rem;
}

.input-wrapper input:focus,
.input-wrapper select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.input-wrapper select {
    appearance: none;
    cursor: pointer;
}

.primary-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 0.75rem;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.4);
}

.primary-btn:active {
    transform: translateY(0);
}

.primary-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
    pointer-events: none;
}

.primary-btn.loading i {
    animation: spin 1s linear infinite;
}

/* Message */
.message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
    text-align: center;
    font-weight: 600;
}
.message.hidden { display: none; }
.message.success { background: rgba(34, 197, 94, 0.2); color: var(--success); border: 1px solid var(--success); }
.message.error { background: rgba(239, 68, 68, 0.2); color: var(--danger); border: 1px solid var(--danger); }

/* Students Section */
.section-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.filter-container {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: 0.9rem;
}

.filter-chip:hover, .filter-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Grid & Cards */
.students-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.student-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.student-card:hover {
    transform: translateY(-5px);
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(255, 255, 255, 0.2);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.student-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
}

.track-badge {
    background: rgba(79, 70, 229, 0.2);
    color: #a5b4fc;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 800;
}

.student-detail {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.student-detail i {
    font-size: 1.2rem;
}

.whatsapp-link {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(37, 211, 102, 0.1);
    color: var(--whatsapp);
    padding: 0.75rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 1px solid rgba(37, 211, 102, 0.2);
}

.whatsapp-link:hover {
    background: var(--whatsapp);
    color: white;
}

.loading-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}
.loading-state .spinner {
    font-size: 2.5rem;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
    color: var(--primary);
}
.loading-state.hidden {
    display: none;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}
.modal.hidden { display: none; }
.modal-content {
    background: var(--bg-color);
    padding: 2rem;
    border-radius: 1rem;
    width: 90%;
    max-width: 500px;
}
.modal-content input {
    width: 100%;
    padding: 0.8rem;
    margin: 1rem 0;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    background: rgba(255,255,255,0.05);
    color: white;
}
