@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;600;700&display=swap');

:root {
    --bg-main: #09090b; /* zinc-950 */
    --bg-card: #18181b; /* zinc-900 */
    --bg-input: #27272a; /* zinc-800 */
    --bg-table-head: rgba(39, 39, 42, 0.5); /* zinc-800/50 */
    --bg-hover: rgba(39, 39, 42, 0.3); /* zinc-800/30 */
    --bg-card-glass: rgba(24, 24, 27, 0.5);
    
    --text-primary: #f4f4f5; /* zinc-100 */
    --text-secondary: #a1a1aa; /* zinc-400 */
    --text-muted: #71717a; /* zinc-500 */
    
    --border-color: #27272a; /* zinc-800 */
    --border-input: #3f3f46; /* zinc-700 */
    
    --accent-main: #059669; /* emerald-600 */
    --accent-hover: #10b981; /* emerald-500 */
    --accent-light: rgba(16, 185, 129, 0.5); /* emerald-500/50 */
    --error-color: #ef4444; /* red-500 */
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Tajawal', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    direction: rtl;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    height: 5rem;
    padding: 0 3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-card-glass);
    backdrop-filter: blur(4px);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-box {
    width: 2.5rem;
    height: 2.5rem;
    background-color: var(--accent-main);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 15px -3px rgba(6, 78, 59, 0.2);
    color: white;
}

h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-primary);
}

.subtitle-header {
    font-size: 0.75rem;
    color: var(--accent-hover);
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin: 0;
    margin-top: 0.125rem;
}

.header-nav {
    display: flex;
    gap: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.header-nav span {
    cursor: pointer;
    transition: color 0.2s;
}

.header-nav span:hover {
    color: var(--text-primary);
}

.header-nav span.active {
    color: var(--accent-hover);
    border-bottom: 2px solid var(--accent-hover);
    padding-bottom: 0.25rem;
}

.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 3rem;
    width: 100%;
    max-width: 1024px;
    margin: 0 auto;
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 2rem;
}

.btn-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    width: 100%;
}

.btn {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 2rem;
    border-radius: 1.5rem;
    transition: all 0.2s;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.btn:hover {
    border-color: var(--accent-light);
}

.btn-text {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-title {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
}

.btn-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.btn-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    border: 1px solid var(--border-input);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: white;
}

.btn:hover .btn-icon {
    background-color: var(--accent-main);
    border-color: var(--accent-main);
}

/* Search Area Layout */
.search-area-wrapper {
    background-color: rgba(24, 24, 27, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem;
}

.search-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.search-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
}

.search-header p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

.search-box {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.search-input-wrapper {
    position: relative;
}

.search-input {
    width: 100%;
    min-width: 320px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: border-color 0.2s;
    outline: none;
}

.search-input:focus {
    border-color: var(--accent-hover);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.btn-primary {
    background-color: var(--accent-main);
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

.btn-secondary {
    display: inline-block;
    align-self: flex-start;
    margin-top: 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.btn-secondary:hover {
    color: var(--text-primary);
}

.result-container {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Results Card Layout */
.results-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
    width: 100%;
}

.student-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    animation: slideUpFade 0.4s ease-out forwards;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.student-header {
    background-color: var(--bg-card-glass);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.student-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.student-avatar {
    width: 3rem;
    height: 3rem;
    background-color: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-hover);
}

.student-name {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.student-number {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    letter-spacing: 0.05em;
}

.subjects-section-title {
    padding: 1rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    background-color: var(--bg-card-glass);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.subjects-section-title::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--accent-main);
}

.non-added-section .subjects-section-title::before {
    background-color: var(--text-muted);
}

.non-added-section .subject-score {
    color: var(--text-secondary);
}

.subjects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1px;
    background-color: var(--border-color);
}

.subject-card {
    background-color: var(--bg-main);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-align: center;
    transition: background-color 0.2s;
}

.subject-card:hover {
    background-color: var(--bg-card);
}

.subject-name {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.subject-score {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.message {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.message.error {
    color: var(--error-color);
}

/* Loading Spinner */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 3rem;
    color: var(--text-secondary);
}

.spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-main);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

footer {
    height: 3rem;
    padding: 0 3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.footer-status {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background-color: var(--accent-hover);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

@media (max-width: 768px) {
    header {
        padding: 0 1.5rem;
    }
    .header-nav {
        display: none;
    }
    .container {
        padding: 1.5rem;
    }
    .search-header-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .search-box {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    .search-input {
        min-width: unset;
    }
    footer {
        padding: 0 1.5rem;
        flex-direction: column;
        justify-content: center;
        gap: 0.5rem;
        height: auto;
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
}
