:root {
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --bg-dark: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --card-hover: rgba(51, 65, 85, 0.5);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
}

/* Background Animations */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    filter: blur(80px);
    border-radius: 50%;
    opacity: 0.5;
    animation: move-blobs 20s infinite alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: #4f46e5;
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 350px;
    height: 350px;
    background: #9333ea;
    bottom: -50px;
    right: -50px;
    animation-delay: -5s;
}

.blob-3 {
    width: 300px;
    height: 300px;
    background: #db2777;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
}

@keyframes move-blobs {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(100px, 50px) scale(1.2);
    }
}

/* Main Container */
.app-container {
    width: 100%;
    max-width: 600px;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Glass Header */
.glass-header {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.title {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(to right, #a78bfa, #f472b6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 300;
    margin-bottom: 2rem;
    animation: text-blink 1.5s infinite alternate;
}

@keyframes text-blink {
    from {
        opacity: 1;
        color: var(--text-muted);
    }

    to {
        opacity: 0.6;
        color: var(--primary);
    }
}

/* Search Box */
.search-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

#searchInput {
    flex: 1;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--glass-border);
    padding: 1rem 1rem 1rem 3rem;
    border-radius: 16px;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    animation: blink-shadow 2.5s infinite alternate;
}

.btn-icon-refresh {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--primary);
    width: 46px;
    height: 46px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.btn-icon-refresh:hover {
    background: var(--card-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

.btn-icon-refresh.spinning {
    animation: spin-refresh 1s linear infinite;
    pointer-events: none;
    opacity: 0.7;
}

@keyframes spin-refresh {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes blink-shadow {
    0% {
        box-shadow: 0 0 0px rgba(139, 92, 246, 0);
        border-color: var(--glass-border);
    }

    50% {
        box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
        border-color: var(--primary);
    }

    100% {
        box-shadow: 0 0 0px rgba(139, 92, 246, 0);
        border-color: var(--glass-border);
    }
}

#searchInput:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2);
    background: rgba(15, 23, 42, 0.8);
}

/* Results Container */
.results-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Student Card */
.student-card {
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    padding: 1.25rem 1.5rem;
    border-radius: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.student-card:hover {
    transform: translateY(-4px);
    background: var(--card-hover);
    border-color: var(--primary);
}

.student-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.student-class {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 400;
}

/* Register Button */
.btn-register {
    background: var(--primary);
    color: white;
    text-decoration: none;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-register:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.btn-register svg {
    transition: transform 0.2s ease;
}

.btn-register:hover svg {
    transform: translateX(3px);
}

/* Loading State */
.loading-state,
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(139, 92, 246, 0.1);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: rotate 1s linear infinite;
}

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

    to {
        transform: rotate(360deg);
    }
}

.animate-in {
    animation: slide-up 0.4s ease-out forwards;
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.footer {
    text-align: center;
    margin-top: auto;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Mobile Optimizations */
@media (max-width: 480px) {
    .app-container {
        padding: 1.5rem 1rem;
        gap: 1.5rem;
    }

    .glass-header {
        padding: 1.25rem 1rem;
    }

    .title {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.85rem;
        margin-bottom: 1.5rem;
    }

    .search-wrapper {
        gap: 0.5rem;
    }

    #searchInput {
        padding: 0.8rem 0.8rem 0.8rem 2.5rem;
        font-size: 0.9rem;
    }

    .search-icon {
        left: 0.75rem;
    }

    .btn-icon-refresh {
        width: 42px;
        height: 42px;
    }

    .student-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1.25rem;
    }

    .btn-register {
        width: 100%;
        justify-content: center;
        padding: 0.65rem;
    }
}

/* Extra small screens (iPhone SE/5/etc) */
@media (max-width: 360px) {
    .glass-header {
        padding: 1rem 0.75rem;
    }

    .title {
        font-size: 1.3rem;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1.5rem;
}

.modal-content {
    max-width: 450px;
    width: 100%;
    padding: 2.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.modal-message {
    color: var(--text-muted);
    font-size: 1rem;
}

.modal-student-info {
    background: rgba(15, 23, 42, 0.5);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.modal-info-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
}

.modal-info-class {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 1rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 0.95rem;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Mobile optimizations for modal */
@media (max-width: 480px) {
    .modal-actions {
        flex-direction: column-reverse;
    }
}

/* Manual Register Button (in empty state) */
.btn-manual-register {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1.5rem;
    padding: 0.85rem 1.75rem;
    background: linear-gradient(135deg, var(--primary), #db2777);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Outfit', sans-serif;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.35);
}

.btn-manual-register:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.5);
}

.btn-manual-register svg {
    flex-shrink: 0;
}

/* Manual Modal Icon */
.manual-modal-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(219,39,119,0.2));
    border: 1px solid rgba(139,92,246,0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    color: var(--primary);
}

/* Manual Form */
.manual-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: left;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    padding: 0.85rem 1rem;
    border-radius: 12px;
    color: var(--text-main);
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    outline: none;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.form-group input::placeholder {
    text-transform: none;
    font-weight: 400;
    color: rgba(148, 163, 184, 0.5);
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
    background: rgba(15, 23, 42, 0.9);
}

.manual-error {
    font-size: 0.85rem;
    color: #f87171;
    min-height: 1.2rem;
    text-align: center;
}