@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --info-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --warning-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    --danger-gradient: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);

    /* Dark Mode (Default) */
    --bg-dark: #0f0f23;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --gradient-bg-1: rgba(102, 126, 234, 0.15);
    --gradient-bg-2: rgba(118, 75, 162, 0.15);
    --gradient-bg-3: rgba(67, 233, 123, 0.1);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 40px rgba(102, 126, 234, 0.3);

    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Mode */
[data-theme="light"] {
    --bg-dark: #f5f7fa;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-card-hover: rgba(255, 255, 255, 1);
    --text-primary: #1a202c;
    --text-secondary: rgba(26, 32, 44, 0.7);
    --border-color: rgba(0, 0, 0, 0.08);
    --gradient-bg-1: rgba(102, 126, 234, 0.08);
    --gradient-bg-2: rgba(118, 75, 162, 0.08);
    --gradient-bg-3: rgba(67, 233, 123, 0.06);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 40px rgba(102, 126, 234, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated Background */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: var(--bg-dark);
    overflow: hidden;
}

.background-animation::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 20% 50%, var(--gradient-bg-1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, var(--gradient-bg-2) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, var(--gradient-bg-3) 0%, transparent 50%);
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    33% {
        transform: translate(-5%, -5%) rotate(120deg);
    }

    66% {
        transform: translate(5%, 5%) rotate(240deg);
    }
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease;
}

.logo {
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    box-shadow: var(--shadow-glow);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* School Info Display */
.school-info {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    animation: fadeInUp 0.6s ease;
}

.school-info h3 {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.info-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Form Styles */
.form-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.8s ease;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-group select option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

/* Button Styles */
.btn {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn span {
    position: relative;
    z-index: 1;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.btn-group {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Category Grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.category-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease backwards;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--card-color), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.category-card:hover::before {
    transform: translateX(100%);
}

.category-card:hover {
    transform: translateY(-8px);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-lg);
    border-color: var(--card-color);
}

.category-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.category-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.category-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Subcategory List */
.subcategory-list {
    display: grid;
    gap: 1rem;
    margin-top: 2rem;
}

.subcategory-item {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    animation: fadeInUp 0.6s ease backwards;
}

.subcategory-item:hover {
    background: var(--bg-card-hover);
    transform: translateX(8px);
    border-color: #667eea;
    box-shadow: var(--shadow-md);
}

.subcategory-item.selected {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.subcategory-item h4 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.subcategory-item p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Success Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 3rem;
    max-width: 500px;
    text-align: center;
    animation: scaleIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: var(--success-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    animation: successPulse 0.6s ease;
}

@keyframes successPulse {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.modal-content h2 {
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Stagger animation for grid items */
.category-card:nth-child(1),
.subcategory-item:nth-child(1) {
    animation-delay: 0.1s;
}

.category-card:nth-child(2),
.subcategory-item:nth-child(2) {
    animation-delay: 0.2s;
}

.category-card:nth-child(3),
.subcategory-item:nth-child(3) {
    animation-delay: 0.3s;
}

.category-card:nth-child(4),
.subcategory-item:nth-child(4) {
    animation-delay: 0.4s;
}

.category-card:nth-child(5),
.subcategory-item:nth-child(5) {
    animation-delay: 0.5s;
}

.category-card:nth-child(6),
.subcategory-item:nth-child(6) {
    animation-delay: 0.6s;
}

.category-card:nth-child(7),
.subcategory-item:nth-child(7) {
    animation-delay: 0.7s;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem;
    }

    .header h1 {
        font-size: 2rem;
    }

    .header p {
        font-size: 1rem;
    }

    .form-card {
        padding: 1.5rem;
    }

    .category-grid {
        grid-template-columns: 1fr;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading State */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* NPSN Auto-Fill Styles */
.npsn-status {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.npsn-status.loading {
    width: 50px;
    display: flex;
    gap: 5px;
    align-items: center;
    justify-content: center;
}

.npsn-status.loading::before,
.npsn-status.loading::after {
    content: '';
    display: block;
    width: 7px;
    height: 7px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    animation: bounceDot 1.4s ease-in-out infinite;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.npsn-status.loading::before {
    animation-delay: 0s;
}

.npsn-status.loading::after {
    animation-delay: 0.28s;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

@keyframes bounceDot {

    0%,
    80%,
    100% {
        transform: translateY(0) scale(1);
        opacity: 0.6;
    }

    40% {
        transform: translateY(-14px) scale(1.4);
        opacity: 1;
        box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
    }
}

.npsn-status.success::after {
    content: '✓';
    color: #43e97b;
    font-size: 1.2rem;
    font-weight: bold;
    animation: successPop 0.3s ease;
}

.npsn-status.error::after {
    content: '✕';
    color: #ff6b6b;
    font-size: 1.2rem;
    font-weight: bold;
    animation: errorShake 0.5s ease;
}

@keyframes successPop {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes errorShake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* NPSN Message */
.npsn-message {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    display: none;
    animation: slideDown 0.3s ease;
}

.npsn-message.show {
    display: block;
}

.npsn-message.success {
    background: rgba(67, 233, 123, 0.1);
    border: 1px solid rgba(67, 233, 123, 0.3);
    color: #43e97b;
}

.npsn-message.error {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    color: #ff6b6b;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Auto-Fill Field Styles */
.auto-fill-field {
    background: rgba(255, 255, 255, 0.03) !important;
    cursor: not-allowed;
    color: var(--text-secondary);
}

.auto-fill-field.filled {
    background: rgba(67, 233, 123, 0.08) !important;
    border-color: rgba(67, 233, 123, 0.3) !important;
    color: var(--text-primary) !important;
    animation: fillGlow 0.5s ease;
}

@keyframes fillGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(67, 233, 123, 0.4);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(67, 233, 123, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(67, 233, 123, 0);
    }
}

/* Auto-Fill Badge */
.auto-fill-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: rgba(67, 233, 123, 0.15);
    border: 1px solid rgba(67, 233, 123, 0.3);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #43e97b;
    animation: badgePulse 2s ease infinite;
}

@keyframes badgePulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Disabled Button State */
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary:disabled:hover {
    transform: none !important;
    box-shadow: var(--shadow-md) !important;
}


/* Progress Steps */
.progress-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
    animation: fadeInDown 0.6s ease;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    transition: var(--transition);
}

.step.active .step-number {
    background: var(--primary-gradient);
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
}

.step.completed .step-number {
    background: var(--success-gradient);
    border-color: #43e97b;
}

.step-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: none;
}

.step.active .step-label,
.step.completed .step-label {
    color: var(--text-primary);
}

.step-divider {
    width: 60px;
    height: 2px;
    background: var(--border-color);
    transition: var(--transition);
}

.step.completed+.step-divider {
    background: var(--success-gradient);
}

@media (min-width: 768px) {
    .step-label {
        display: block;
    }

    .step-divider {
        width: 100px;
    }
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 999;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    animation: fadeInDown 0.8s ease;
}

/* Admin page specific - move theme toggle to avoid logout button */
body:has(.main-content) .theme-toggle {
    top: 2rem;
    right: 180px;
}

.theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: #667eea;
}

.theme-toggle:active {
    transform: translateY(0);
}

.theme-icon {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.theme-icon.sun {
    display: none;
}

[data-theme="light"] .theme-icon.moon {
    display: none;
}

[data-theme="light"] .theme-icon.sun {
    display: flex;
    animation: rotate360 0.6s ease;
}

.theme-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    display: none;
}

@keyframes rotate360 {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@media (min-width: 640px) {
    .theme-label {
        display: block;
    }
}

@media (max-width: 768px) {
    .theme-toggle {
        top: 1rem;
        right: 1rem;
        padding: 0.6rem 1rem;
    }
}