:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #131b2e;
    --glass-bg: rgba(30, 41, 59, 0.4);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.35);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --font-main: 'Cairo', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: hidden;
    padding: 2rem 1rem;
    position: relative;
}

/* Background blob decorations */
.glass-bg {
    position: absolute;
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, rgba(0,0,0,0) 70%);
    z-index: -1;
    pointer-events: none;
    animation: pulse 12s infinite alternate;
}

.glass-bg-2 {
    position: absolute;
    bottom: -10%;
    right: -10%;
    width: 45vw;
    height: 45vw;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, rgba(0,0,0,0) 70%);
    z-index: -1;
    pointer-events: none;
    animation: pulse 15s infinite alternate-reverse;
}

@keyframes pulse {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.1) translate(5%, 5%); }
}

.container {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 0.5rem;
}

.logo {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 4rem;
    height: 4rem;
    background: linear-gradient(135deg, var(--accent) 0%, #6366f1 100%);
    border-radius: 1.25rem;
    box-shadow: 0 0 25px var(--accent-glow);
    margin-bottom: 1.25rem;
}

.header-icon {
    font-size: 2rem;
    color: white;
}

.app-header h1 {
    font-size: 2.25rem;
    font-weight: 800;
    background: linear-gradient(to left, #fff, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.app-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 300;
}

/* Card glass structure */
.main-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 1.75rem;
    padding: 2.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

/* Search Form */
.search-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

.input-group label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-group label i {
    color: var(--accent);
}

.input-group input {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 0.9rem 1rem;
    color: white;
    font-family: var(--font-main);
    font-size: 1.05rem;
    width: 100%;
    outline: none;
    transition: var(--transition);
}

.input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.toggle-password-btn {
    position: absolute;
    left: 1rem;
    bottom: 0.75rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition);
}

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

.submit-btn {
    background: linear-gradient(135deg, var(--accent) 0%, #4f46e5 100%);
    border: none;
    border-radius: 0.75rem;
    padding: 1rem;
    color: white;
    font-family: var(--font-main);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px var(--accent-glow);
}

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

.error-banner {
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 0.75rem;
    padding: 1rem;
    color: #fca5a5;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Results section */
.results-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    animation: fadeIn 0.6s ease forwards;
}

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

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}

.results-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.print-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.print-btn:hover {
    background: white;
    color: var(--bg-primary);
}

/* Student metadata grid */
.student-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

.info-card {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.info-value {
    font-size: 1.05rem;
    font-weight: 700;
}

/* Semester Panel */
.semester-panel {
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid var(--glass-border);
    border-radius: 1.25rem;
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.semester-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.semester-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
}

.gpa-badges {
    display: flex;
    gap: 0.75rem;
}

.gpa-badge {
    background: var(--glass-border);
    border: 1px solid var(--glass-border);
    border-radius: 2rem;
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.gpa-badge span {
    color: var(--accent);
}

/* Grades Table */
.table-wrapper {
    overflow-x: auto;
    border-radius: 0.75rem;
    border: 1px solid var(--glass-border);
}

.grades-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
    font-size: 0.95rem;
}

.grades-table th {
    background: rgba(15, 23, 42, 0.7);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.grades-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-primary);
}

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

.grades-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Rating Badge styling */
.rating-tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 0.35rem;
    font-weight: 700;
    font-size: 0.8rem;
    text-align: center;
}

.rating-pass {
    background: var(--success-bg);
    color: var(--success);
}

.rating-fail {
    background: var(--danger-bg);
    color: var(--danger);
}

.rating-neutral {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

/* Notes callout */
.notes-banner {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 0.75rem;
    padding: 1rem;
    color: #fcd34d;
    font-size: 0.95rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    line-height: 1.5;
}

.notes-banner i {
    margin-top: 0.2rem;
}

/* Footer styling */
.app-footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 1rem;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    body {
        padding: 1rem 0.5rem;
    }
    
    .container {
        gap: 1.25rem;
    }
    
    .logo {
        width: 3.5rem;
        height: 3.5rem;
        border-radius: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .header-icon {
        font-size: 1.65rem;
    }
    
    .app-header h1 {
        font-size: 1.65rem;
    }
    
    .app-header p {
        font-size: 0.95rem;
    }
    
    .main-card {
        padding: 1.25rem;
        border-radius: 1.25rem;
        gap: 1.75rem;
    }
    
    .input-group label {
        font-size: 0.9rem;
    }
    
    .input-group input {
        padding: 0.75rem 0.85rem;
        font-size: 0.95rem;
    }
    
    .toggle-password-btn {
        bottom: 0.65rem;
    }
    
    .submit-btn {
        padding: 0.85rem;
        font-size: 1rem;
    }
    
    .results-header h2 {
        font-size: 1.2rem;
    }
    
    .student-info-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .info-card {
        padding: 0.75rem;
    }
    
    .info-value {
        font-size: 0.95rem;
    }
    
    .semester-panel {
        padding: 1rem;
        border-radius: 1rem;
        gap: 1rem;
    }
    
    .semester-title {
        font-size: 1.1rem;
    }
    
    .gpa-badges {
        width: 100%;
        justify-content: space-between;
    }
    
    .gpa-badge {
        padding: 0.25rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .grades-table {
        font-size: 0.8rem;
    }
    
    .grades-table th, .grades-table td {
        padding: 0.65rem 0.5rem;
    }
    
    .rating-tag {
        font-size: 0.75rem;
        padding: 0.15rem 0.4rem;
    }
    
    .notes-banner {
        font-size: 0.85rem;
        padding: 0.75rem;
    }
}

/* Print Styling */
@media print {
    body {
        background: white;
        color: black;
        padding: 0;
    }
    
    .glass-bg, .glass-bg-2, .app-header, .search-section, .app-footer, .print-btn {
        display: none !important;
    }
    
    .main-card {
        background: none !important;
        backdrop-filter: none !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    
    .info-card {
        background: none !important;
        border: 1px solid #ddd !important;
        color: black !important;
    }
    
    .info-value, .info-label {
        color: black !important;
    }
    
    .semester-panel {
        background: none !important;
        border: 1px solid #ccc !important;
        page-break-inside: avoid;
    }
    
    .grades-table th {
        background: #f1f1f1 !important;
        color: black !important;
        border-bottom: 2px solid #ccc !important;
    }
    
    .grades-table td {
        border-bottom: 1px solid #ddd !important;
        color: black !important;
    }
    
    .rating-pass {
        color: green !important;
        background: none !important;
    }
    
    .rating-fail {
        color: red !important;
        background: none !important;
    }
}
