/* ============================================
   IGNOU Gradecard Analyzer - Styles
   Modern Dark Theme with Glassmorphism
   ============================================ */

/* CSS Variables */
:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --accent: #22d3ee;
    --accent-light: #67e8f9;

    --success: #10b981;
    --success-light: #34d399;
    --warning: #f59e0b;
    --warning-light: #fbbf24;
    --danger: #ef4444;
    --danger-light: #f87171;

    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.05);
    --border-glass: rgba(255, 255, 255, 0.1);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --gradient-accent: linear-gradient(135deg, #22d3ee 0%, #06b6d4 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.3);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(34, 211, 238, 0.05) 0%, transparent 70%);
    z-index: -1;
    animation: bgPulse 15s ease-in-out infinite;
}

@keyframes bgPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.header {
    padding: 24px 0;
    border-bottom: 1px solid var(--border-glass);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.8);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: var(--shadow-glow);
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Input Section */
.input-section {
    padding: 48px 0;
}

.input-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 32px;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
}

.input-card h2 {
    font-size: 1.25rem;
    margin-bottom: 24px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 16px;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    padding: 14px 18px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

/* Dropdown options need proper colors */
.form-group select {
    background-color: #1e293b;
    cursor: pointer;
}

.form-group select option {
    background-color: #1e293b;
    color: #f1f5f9;
    padding: 12px;
}

.form-group select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Stats Overview */
.stats-section {
    padding: 32px 0;
    display: none;
}

.stats-section.visible {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 24px;
    backdrop-filter: blur(20px);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
}

.stat-card.highlight {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-value.success {
    color: var(--success);
}

.stat-value.warning {
    color: var(--warning);
}

.stat-value.danger {
    color: var(--danger);
}

/* Progress Bar */
.progress-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 32px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.progress-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.progress-percentage {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-light);
}

.progress-bar {
    height: 12px;
    background: var(--bg-glass);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width 1s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* Division Badge */
.division-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.875rem;
}

.division-badge.distinction {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1f2937;
}

.division-badge.first {
    background: var(--gradient-success);
    color: white;
}

.division-badge.second {
    background: linear-gradient(135deg, #22d3ee, #06b6d4);
    color: #1f2937;
}

.division-badge.third {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.division-badge.fail {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

/* Results Section */
.results-section {
    padding: 32px 0;
    display: none;
}

.results-section.visible {
    display: block;
    animation: fadeIn 0.5s ease 0.2s both;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.semester-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.semester-tab {
    padding: 8px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.semester-tab:hover,
.semester-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Course Cards */
.courses-grid {
    display: grid;
    gap: 16px;
}

.course-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 24px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
    transition: all 0.3s ease;
}

.course-card:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}

.course-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.course-code {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-light);
    font-family: 'JetBrains Mono', monospace;
}

.course-name {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

.course-meta {
    display: flex;
    gap: 16px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.course-scores {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.final-score {
    font-size: 1.5rem;
    font-weight: 700;
}

.score-breakdown {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.status-passed {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-light);
    border: 1px solid var(--success);
}

.status-failed {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-light);
    border: 1px solid var(--danger);
}

.status-pending {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning-light);
    border: 1px solid var(--warning);
}

.status-neutral {
    background: var(--bg-glass);
    color: var(--text-muted);
    border: 1px solid var(--border-glass);
}

/* Tooltip */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Footer */
.footer {
    padding: 32px 0;
    border-top: 1px solid var(--border-glass);
    margin-top: 48px;
}

.disclaimer {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-md);
    padding: 16px;
    font-size: 0.875rem;
    color: var(--warning-light);
    text-align: center;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 0.875rem;
    flex-wrap: wrap;
    gap: 16px;
}

/* Error Message */
.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    border-radius: var(--radius-md);
    padding: 16px;
    color: var(--danger-light);
    display: none;
    margin-top: 16px;
}

.error-message.visible {
    display: flex;
    align-items: center;
    gap: 12px;
    animation: shake 0.5s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-5px);
    }

    40%,
    80% {
        transform: translateX(5px);
    }
}

/* Print Styles */
@media print {
    body::before {
        display: none;
    }

    .header,
    .input-section,
    .btn,
    .semester-tabs {
        display: none;
    }

    .stats-section,
    .results-section {
        display: block !important;
    }

    .course-card {
        break-inside: avoid;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .course-card {
        grid-template-columns: 1fr;
    }

    .course-scores {
        align-items: flex-start;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .logo-text h1 {
        font-size: 1.25rem;
    }
}
