:root {
    /* Color Palette */
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --accent: #10b981;
    --danger: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    /* Glassmorphism */
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    /* Layout */
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.icesi-logo {
    height: 60px; /* slightly larger for the welcome screen */
    width: auto;
    object-fit: contain;
}

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

body {
    background-color: var(--bg-darker);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: scroll;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Background Blobs for premium effect */
.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    animation: float 10s infinite ease-in-out alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: rgba(79, 70, 229, 0.3);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: rgba(16, 185, 129, 0.2);
    bottom: -50px;
    right: -50px;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, 50px) scale(1.1); }
}

/* Layout Screens */
#app {
    width: 100%;
    max-width: 1400px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
    opacity: 0;
    width: 100%;
    height: 100vh;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: opacity 0.5s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
}

#dashboard.screen.active {
    display: block; /* Different layout for dashboard */
    height: auto;
    min-height: 100vh;
    padding: 0;
}

/* Glassmorphism Utilities */
.glass-card, .glass-panel, .glass-nav {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: var(--glass-shadow);
}

.glass-card {
    padding: 40px;
    width: 100%;
    max-width: 450px;
    text-align: center;
    transform: translateY(20px);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUp {
    to { transform: translateY(0); }
}

/* Typography & Elements */
.logo-container {
    margin-bottom: 30px;
}

.logo-container i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.logo-container h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, #a5b4fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-container.sm {
    margin-bottom: 20px;
}

.logo-container.sm h2 {
    font-size: 1.5rem;
    margin-top: 10px;
}

.saman-logo-text {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 4px;
    background: linear-gradient(135deg, #4ade80, #22c55e);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.saman-logo-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.4;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 30px;
}

/* Forms & Inputs */
.input-group {
    text-align: left;
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #cbd5e1;
}

.input-icon {
    position: relative;
}

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

.glass-input {
    width: 100%;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

.input-icon .glass-input {
    padding-left: 45px;
}

.glass-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.glass-input option {
    background-color: var(--bg-dark);
    color: white;
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.btn-primary:disabled {
    background: #334155;
    color: #94a3b8;
    cursor: not-allowed;
}

.btn-back {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 20px;
    transition: var(--transition);
}

.btn-back:hover {
    color: white;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    padding: 5px;
    border-radius: 5px;
}

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

.info-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 5px;
    text-align: left;
}

/* Dashboard Layout */
.glass-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 40px;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    border-top: none;
    margin-bottom: 30px;
}

.nav-brand {
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-brand i {
    color: var(--primary);
    font-size: 1.5rem;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.dashboard-content {
    padding: 0 40px 40px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Courses */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.course-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.course-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--course-color, var(--primary));
}

.course-tasks-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.course-card:hover {
    transform: translateY(-5px);
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(255, 255, 255, 0.2);
}

.course-code {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.course-name {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 10px;
    line-height: 1.3;
}

/* Main Layout: Tasks + Calendar */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
}

@media (max-width: 900px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
}

.glass-panel {
    padding: 25px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.filter-tabs {
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
    padding: 5px;
    border-radius: 8px;
}

.filter-tabs .tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.filter-tabs .tab.active {
    background: var(--primary);
    color: white;
}

/* Tasks */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 5px;
}

.tasks-list::-webkit-scrollbar {
    width: 6px;
}

.tasks-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: var(--transition);
}

.task-item:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

.task-item.completed {
    opacity: 0.6;
}

.task-item.completed .task-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-item.overdue {
    border-left: 3px solid var(--danger);
}

.checkbox-wrapper {
    position: relative;
    width: 22px;
    height: 22px;
    margin-top: 2px;
}

.checkbox-wrapper input {
    opacity: 0;
    width: 100%;
    height: 100%;
    position: absolute;
    cursor: pointer;
    z-index: 2;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background-color: transparent;
    border: 2px solid var(--text-muted);
    border-radius: 6px;
    transition: var(--transition);
}

.checkbox-wrapper input:checked ~ .checkmark {
    background-color: var(--accent);
    border-color: var(--accent);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-wrapper input:checked ~ .checkmark:after {
    display: block;
}

.task-details {
    flex: 1;
}

.task-title {
    font-weight: 500;
    margin-bottom: 5px;
}

.task-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    gap: 15px;
}

.task-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge.pending { background: rgba(79, 70, 229, 0.2); color: #a5b4fc; }
.badge.overdue { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.badge.urgent { background: rgba(239, 68, 68, 0.25); color: #fca5a5; }
.badge.soon { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }

/* Due Date Display */
.task-due-date {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 5px 10px;
    background: rgba(79, 70, 229, 0.1);
    border-radius: 6px;
    border-left: 3px solid var(--primary);
    font-size: 0.82rem;
    color: #c7d2fe;
}

.task-due-date i {
    font-size: 1rem;
    color: var(--primary);
}

.due-date-text {
    font-weight: 500;
}

/* Calendar Grid */
.calendar-grid-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.cal-day:hover {
    background: rgba(255, 255, 255, 0.1);
}

.cal-day.empty {
    cursor: default;
}

.cal-day.empty:hover {
    background: transparent;
}

.cal-day.today {
    background: var(--primary);
    color: white;
    font-weight: bold;
}

.cal-day.has-event::after {
    content: '';
    position: absolute;
    bottom: 5px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
}

.cal-day.has-event.overdue::after {
    background: var(--danger);
}

/* --- LOADING OVERLAY --- */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.loading-card {
    width: 90%;
    max-width: 400px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.progress-bar-container {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 10px;
    margin-bottom: 5px;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #8b5cf6);
    border-radius: 10px;
    transition: width 0.3s ease;
}
