:root {
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --secondary: #a855f7;
    --bg-dark: #030712;
    --card-glass: rgba(17, 24, 39, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --input-bg: rgba(0, 0, 0, 0.4);
    --success: #10b981;
    --error: #ef4444;
    --font-main: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
}

body {
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0, transparent 50%),
        radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.15) 0, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 2rem;
    overflow-x: hidden;
}

/* Animated Background Blobs */
.blob {
    position: fixed;
    width: 500px;
    height: 500px;
    filter: blur(100px);
    opacity: 0.4;
    z-index: -1;
    border-radius: 50%;
    animation: animateBlob 20s infinite alternate;
}

.blob-1 {
    background: var(--primary);
    top: -100px;
    left: -100px;
}

.blob-2 {
    background: var(--secondary);
    bottom: -150px;
    right: -100px;
    animation-delay: -10s;
}

@keyframes animateBlob {
    0% {
        transform: scale(1) translate(0, 0);
    }

    100% {
        transform: scale(1.2) translate(50px, 100px);
    }
}

/* Container & Glassmorphism */
.container {
    width: 100%;
    max-width: 850px;
    background: var(--card-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 32px;
    padding: 4rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    margin: 6rem 0 2rem;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 10;
}

header {
    text-align: center;
    margin-bottom: 3.5rem;
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.125rem;
    font-weight: 400;
}

/* Form Styling */
form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.full-width {
    grid-column: span 2;
}

label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-left: 0.25rem;
}

input,
select {
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1rem 1.25rem;
    color: white;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 0 4px var(--primary-glow);
    transform: translateY(-2px);
}

select option {
    background: #1f2937;
    color: white;
}

/* Buttons */
.submit-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 1.25rem;
    border-radius: 16px;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 15px -3px var(--primary-glow);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.submit-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px var(--primary-glow);
    filter: brightness(1.1);
}

/* Auth Overlay */
.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    background: var(--card-glass);
    border: 1px solid var(--card-border);
    padding: 3rem 2rem;
    border-radius: 32px;
    width: 90%;
    max-width: 450px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Profile Dropdown */
.user-badge {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 500;
}

.profile-btn {
    background: var(--card-glass);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    width: 56px;
    height: 56px;
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: white;
    font-weight: 800;
    font-size: 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.profile-dropdown {
    position: absolute;
    top: 4.5rem;
    right: 0;
    width: 320px;
    max-width: calc(100vw - 3rem);
    background: var(--card-glass);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    display: none;
    flex-direction: column;
    gap: 1.25rem;
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    animation: slideIn 0.3s ease-out;
}

.profile-dropdown.show {
    display: flex;
}

.admin-box {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-box h4 {
    color: var(--text-secondary);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
}

#result-container {
    margin-top: 3rem;
    padding: 2.5rem;
    border-radius: 24px;
    font-weight: 800;
    font-size: 1.5rem;
    display: none;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.result-success {
    background: rgba(16, 185, 129, 0.1);
    border: 2px solid var(--success);
    color: var(--success);
}

.result-error {
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid var(--error);
    color: var(--error);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.button-loading .spinner {
    display: block;
}

.button-loading .btn-text {
    display: none;
}

footer {
    padding: 3rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

footer b {
    color: var(--primary);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 1024px) {
    .container {
        max-width: 95%;
        padding: 3rem;
    }
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    form {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .full-width {
        grid-column: span 1;
    }

    .container {
        padding: 2rem;
        margin: 4rem 0.5rem 2rem;
        border-radius: 24px;
    }

    h1 {
        font-size: 2.25rem;
    }

    .user-badge {
        top: 1rem;
        right: 1rem;
    }

    header {
        margin-bottom: 2.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1.5rem;
        margin-top: 4rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 0.9rem;
    }

    .profile-dropdown {
        width: 280px;
    }
}

/* Ensure history specific layout handles mobile well */
.history-table-container::-webkit-scrollbar {
    height: 6px;
}

.history-table-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.history-table-container::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}