:root {
    /* Color Palette - Premium Blue & Purple Theme */
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --secondary: #ec4899;
    --accent: #10b981;
    --bg-color: #f8fafc;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --white: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --transition: all 0.3s ease;
}

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

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

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

.shape {
    position: absolute;
    filter: blur(80px);
    opacity: 0.5;
    border-radius: 50%;
    animation: float 20s infinite alternate ease-in-out;
}

.shape-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--primary-light) 0%, transparent 70%);
}

.shape-2 {
    bottom: -10%;
    right: -10%;
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, var(--secondary) 0%, transparent 70%);
    animation-delay: -5s;
}

.shape-3 {
    top: 40%;
    left: 60%;
    width: 30vw;
    height: 30vw;
    background: radial-gradient(circle, #0ea5e9 0%, transparent 70%);
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(5%, 5%) scale(1.05); }
    100% { transform: translate(-5%, -5%) scale(0.95); }
}

/* Layout */
.container {
    width: 100%;
    max-width: 800px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 1.5rem;
    overflow: hidden;
    transition: var(--transition);
}

.glass-panel:hover {
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.1);
    transform: translateY(-2px);
}

/* Header Section */
.app-header {
    text-align: center;
    padding: 2rem 0;
    animation: fadeInDown 0.8s ease-out;
}

.logo-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 24px;
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.4);
    margin-bottom: 1.5rem;
    transform: rotate(-10deg);
    transition: var(--transition);
}

.logo-container:hover {
    transform: rotate(0deg) scale(1.05);
}

.excel-icon {
    font-size: 3rem;
    color: var(--white);
}

.app-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

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

/* Cards Common Elements */
.card {
    padding: 2rem;
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
}

.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.2s; }
.card:nth-child(4) { animation-delay: 0.3s; }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.card-header h2 {
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary-dark);
}

.card-header h2 i {
    color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
    padding: 0.5rem;
    border-radius: 0.5rem;
}

/* Status Badge */
.status-badge {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    border-radius: 2rem;
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-badge.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent);
}

.spin {
    display: inline-block;
    animation: spin 1s linear infinite;
}

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

/* Forms */
.form-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

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

.form-group label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
}

.select-wrapper {
    position: relative;
    width: 100%;
}

.select-wrapper select {
    width: 100%;
    padding: 1rem;
    border: 2px solid transparent;
    border-radius: 0.75rem;
    background-color: var(--white);
    font-size: 1rem;
    color: var(--text-main);
    appearance: none;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.select-wrapper select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.select-wrapper select:disabled {
    background-color: #f1f5f9;
    cursor: not-allowed;
    color: var(--text-muted);
}

.custom-arrow {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
    transition: var(--transition);
}

.select-wrapper select:focus + .custom-arrow {
    transform: translateY(-50%) rotate(180deg);
    color: var(--primary);
}

/* Instruction Section */
.instruction-content {
    font-size: 1rem;
    color: var(--text-main);
}

.instruction-content p {
    margin-bottom: 1rem;
}

.task-list {
    margin-left: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.task-list li {
    padding-left: 0.5rem;
}

.task-list li::marker {
    color: var(--primary);
    font-weight: 700;
}

.alert-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 0.75rem;
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid #f59e0b;
    color: #b45309;
    font-weight: 500;
}

.alert-box i {
    font-size: 1.5rem;
}

/* Example Table */
.example-container {
    background: rgba(255, 255, 255, 0.5);
    border: 1px dashed var(--primary-light);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.example-container h3 {
    font-size: 1.1rem;
    color: var(--primary-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-responsive {
    overflow-x: auto;
    border-radius: 0.5rem;
    border: 1px solid rgba(0,0,0,0.05);
}

.example-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: var(--white);
    min-width: 600px;
}

.example-table th, 
.example-table td {
    padding: 0.75rem 1rem;
    text-align: center;
    border: 1px solid rgba(0,0,0,0.05);
}

.example-table th {
    background-color: #f1f5f9;
    color: var(--text-main);
    font-weight: 600;
}

.example-table tbody tr:hover {
    background-color: #f8fafc;
}

.table-footer {
    background-color: #f1f5f9;
    font-weight: 600;
}

/* Interactive Quiz Table */
.interactive-quiz-table th {
    font-size: 0.85rem;
}

.highlight-header {
    background-color: #dbeafe !important;
    color: var(--primary-dark) !important;
}

.input-cell {
    padding: 0.25rem 0.5rem !important;
}

.formula-input {
    width: 100%;
    min-width: 80px;
    padding: 0.5rem;
    border: 2px solid transparent;
    border-radius: 0.5rem;
    font-family: monospace;
    font-size: 0.9rem;
    background-color: #f8fafc;
    color: var(--primary-dark);
    font-weight: 600;
    transition: var(--transition);
}

.formula-input:focus {
    outline: none;
    border-color: var(--primary-light);
    background-color: var(--white);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.blank-cell {
    background: repeating-linear-gradient(
        45deg,
        #f1f5f9,
        #f1f5f9 10px,
        #e2e8f0 10px,
        #e2e8f0 20px
    );
}

.formula-input.correct {
    background-color: #dcfce7;
    color: #166534;
    border-color: #22c55e;
}

.formula-input.incorrect {
    background-color: #fee2e2;
    color: #991b1b;
    border-color: #ef4444;
}

/* Submission input */
.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.2rem;
}

.input-with-icon input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 2px solid transparent;
    border-radius: 0.75rem;
    background-color: var(--white);
    font-size: 1rem;
    color: var(--text-main);
    transition: var(--transition);
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.input-with-icon input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.input-with-icon input:focus + i {
    color: var(--primary);
}

.helper-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Button */
.btn-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--white);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
    overflow: hidden;
    position: relative;
}

.btn-submit::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: var(--transition);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
}

.btn-submit:hover::after {
    left: 100%;
    transition: left 0.6s ease-out;
}

.btn-submit i {
    font-size: 1.2rem;
    transition: var(--transition);
}

.btn-submit:hover i {
    transform: translateX(4px);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: translateY(0);
}

.btn-primary {
    background-color: var(--primary);
    color: var(--white);
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: var(--transition);
}
.btn-primary:hover {
    background-color: var(--primary-dark);
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 2rem 0 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Loaders & Overlays */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.overlay.hidden, .modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner-container {
    text-align: center;
}

.lds-ripple {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 80px;
}
.lds-ripple div {
    position: absolute;
    border: 4px solid var(--primary);
    opacity: 1;
    border-radius: 50%;
    animation: lds-ripple 1s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}
.lds-ripple div:nth-child(2) {
    animation-delay: -0.5s;
}
@keyframes lds-ripple {
    0% { top: 36px; left: 36px; width: 0; height: 0; opacity: 0; }
    4.9% { top: 36px; left: 36px; width: 0; height: 0; opacity: 0; }
    5% { top: 36px; left: 36px; width: 0; height: 0; opacity: 1; }
    100% { top: 0px; left: 0px; width: 72px; height: 72px; opacity: 0; }
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.modal-content {
    background: var(--white);
    padding: 3rem;
    text-align: center;
    max-width: 400px;
    width: 90%;
    border-radius: 1.5rem;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal:not(.hidden) .modal-content {
    transform: scale(1);
}

.success-icon {
    font-size: 5rem;
    color: var(--accent);
    margin-bottom: 1rem;
    animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-content h2 {
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.modal-content p {
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* Animations */
@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); }
    to { opacity: 1; transform: scale(1); }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        gap: 1.5rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .app-header h1 {
        font-size: 1.8rem;
    }
}
