@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Playfair+Display:wght@600;700&display=swap');

:root {
    --odon-bg: #f0f7f4;
    --odon-bg-alt: #e8f5e9;
    --odon-green-dark: #2e7d52;
    --odon-green-mid: #4caf6a;
    --odon-green-light: #81c995;
    --odon-green-pastel: #b9e4c9;
    --odon-mint: #c8f7dc;
    --odon-sage: #a8d5ba;
    --odon-cream: #fdfaf6;
    --odon-lavender: #e8dff5;
    --odon-peach: #fce4d6;
    --odon-sky: #dbeef9;
    --odon-rose: #f5e0e7;
    --text-main: #2c3e36;
    --text-secondary: #5a7d6a;
    --text-muted: #8faa9c;
    --card-shadow: 0 4px 15px rgba(46, 125, 82, 0.08);
    --card-shadow-hover: 0 8px 30px rgba(46, 125, 82, 0.15);
    --border-soft: 1px solid rgba(46, 125, 82, 0.12);
    --radius: 14px;
    --radius-sm: 10px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--odon-bg);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(200, 247, 220, 0.5) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(232, 223, 245, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 80%, rgba(252, 228, 214, 0.3) 0%, transparent 50%);
    color: var(--text-main);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
}

/* ─── Search Bar ─── */
.search-bar {
    position: fixed;
    top: 18px;
    right: 24px;
    z-index: 1100;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(46, 125, 82, 0.12);
    border-radius: 50px;
    padding: 6px 14px;
    box-shadow: 0 4px 20px rgba(46, 125, 82, 0.08);
    transition: all 0.3s ease;
    width: 220px;
}

.search-bar:focus-within {
    width: 300px;
    border-color: var(--odon-green-mid);
    box-shadow: 0 4px 25px rgba(76, 175, 106, 0.15);
}

.search-icon {
    font-size: 0.85rem;
    margin-right: 8px;
    opacity: 0.6;
}

.search-bar input {
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Poppins', sans-serif;
    font-size: 0.8rem;
    color: var(--text-main);
    width: 100%;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.search-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 2px 4px;
    border-radius: 50%;
    transition: all 0.2s;
}

.search-clear:hover {
    color: var(--odon-green-dark);
    background: rgba(46, 125, 82, 0.08);
}

/* ─── Header ─── */
header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 25px;
    position: relative;
}

header::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 4px;
    background: linear-gradient(90deg, var(--odon-green-pastel), var(--odon-green-mid), var(--odon-green-pastel));
    border-radius: 2px;
}

h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.5rem, 5vw, 2.8rem);
    font-weight: 700;
    color: var(--odon-green-dark);
    margin: 0;
    letter-spacing: 2px;
}

header p {
    font-family: 'Poppins', sans-serif;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 8px;
    font-weight: 300;
    letter-spacing: 1px;
}

header::before {
    content: "🦷";
    display: block;
    font-size: 2.2rem;
    margin-bottom: 8px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* ─── Grid ─── */
.grid-container {
    display: grid;
    grid-template-columns: repeat(5, 260px);
    gap: 20px;
    overflow-x: auto;
    padding: 10px 10px 130px 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--odon-green-light) var(--odon-bg);
}

.grid-container::-webkit-scrollbar { height: 6px; }
.grid-container::-webkit-scrollbar-track { background: var(--odon-bg); border-radius: 3px; }
.grid-container::-webkit-scrollbar-thumb { background: var(--odon-green-light); border-radius: 3px; }

.cycle-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cycle-header {
    font-family: 'Playfair Display', serif;
    text-align: left;
    font-weight: 600;
    padding: 10px 14px;
    border-left: 4px solid var(--odon-green-mid);
    background: linear-gradient(135deg, rgba(76, 175, 106, 0.08), rgba(200, 247, 220, 0.15));
    font-size: 0.82rem;
    color: var(--odon-green-dark);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 6px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cycle-count {
    font-family: 'Poppins', sans-serif;
    font-size: 0.65rem;
    font-weight: 500;
    background: rgba(46, 125, 82, 0.1);
    padding: 2px 8px;
    border-radius: 50px;
    color: var(--text-secondary);
}

/* ─── Cards ─── */
.course-card {
    background: var(--odon-cream);
    border: var(--border-soft);
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    box-shadow: var(--card-shadow);
    border-radius: var(--radius);
    min-height: 85px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    user-select: none;
}

.course-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--odon-green-light);
    border-radius: 4px 0 0 4px;
    transition: width 0.3s ease;
}

.course-card:hover:not(.locked) {
    border-color: var(--odon-green-mid);
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
}

.course-card:hover:not(.locked)::before {
    width: 6px;
}

/* ─── Ripple ─── */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(76, 175, 106, 0.25);
    transform: scale(0);
    animation: rippleAnim 0.6s ease-out;
    pointer-events: none;
}

@keyframes rippleAnim {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ─── Highlight chain ─── */
.course-card.highlight-prereq {
    border-color: #f0ad4e !important;
    box-shadow: 0 0 0 3px rgba(240, 173, 78, 0.2), var(--card-shadow) !important;
}

.course-card.highlight-dependent {
    border-color: #5bc0de !important;
    box-shadow: 0 0 0 3px rgba(91, 192, 222, 0.2), var(--card-shadow) !important;
}

.course-card.dimmed {
    opacity: 0.3;
    transform: scale(0.97);
}

/* ─── Search match ─── */
.course-card.search-match {
    border-color: var(--odon-green-mid);
    box-shadow: 0 0 0 3px rgba(76, 175, 106, 0.2), var(--card-shadow-hover);
    z-index: 10;
}

.course-card.search-no-match {
    opacity: 0.25;
}

/* ─── Approved State ─── */
.course-card.approved {
    background: linear-gradient(135deg, #e8f8ee 0%, #d4f0df 100%);
    border: 1px solid var(--odon-green-mid);
    box-shadow: 0 4px 20px rgba(76, 175, 106, 0.15);
}

.course-card.approved::before {
    width: 5px;
    background: var(--odon-green-dark);
}

.course-card.approved::after {
    content: "✓";
    position: absolute;
    top: 8px;
    right: 12px;
    color: var(--odon-green-dark);
    font-weight: 700;
    font-size: 1.1rem;
}

/* ─── Locked State ─── */
.course-card.locked {
    background: #f5f5f0;
    border-color: #e0e0d8;
    cursor: not-allowed;
    opacity: 0.55;
}

.course-card.locked::before {
    background: #ccc;
}

.course-card.locked::after {
    content: "🔒";
    position: absolute;
    bottom: 8px;
    right: 10px;
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* ─── Unlock Animation ─── */
.course-card.just-unlocked {
    animation: unlockPulse 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes unlockPulse {
    0% {
        opacity: 0.55;
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(76, 175, 106, 0);
    }
    40% {
        opacity: 1;
        transform: scale(1.04);
        box-shadow: 0 0 0 12px rgba(76, 175, 106, 0.15);
    }
    70% {
        transform: scale(0.98);
        box-shadow: 0 0 0 6px rgba(76, 175, 106, 0.08);
    }
    100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: var(--card-shadow);
    }
}

/* ─── Approved Animation ─── */
.course-card.just-approved {
    animation: approveBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes approveBounce {
    0% { transform: scale(1); }
    30% { transform: scale(0.92); }
    60% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

/* ─── Card Text ─── */
.course-name {
    display: block;
    font-size: 0.85rem;
    margin-bottom: 4px;
    color: var(--text-main);
    line-height: 1.25;
    font-weight: 500;
}

.course-code {
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    font-weight: 400;
}

/* ─── Info icon on card ─── */
.card-info-btn {
    position: absolute;
    bottom: 8px;
    right: 10px;
    font-size: 0.7rem;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(46, 125, 82, 0.08);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    padding: 0;
    line-height: 1;
}

.card-info-btn:hover {
    background: rgba(46, 125, 82, 0.18);
    color: var(--odon-green-dark);
    transform: scale(1.15);
}

.course-card.locked .card-info-btn,
.course-card.approved .card-info-btn {
    display: none;
}

/* ─── Tooltip ─── */
.tooltip {
    visibility: hidden;
    width: 210px;
    background: white;
    color: var(--odon-green-dark);
    border: 1px solid var(--odon-green-pastel);
    text-align: center;
    padding: 10px 12px;
    position: absolute;
    z-index: 100;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    box-shadow: 0 8px 25px rgba(46, 125, 82, 0.12);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: var(--radius-sm);
    font-weight: 400;
}

.tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: white transparent transparent transparent;
}

.course-card.locked:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

/* ─── Detail Panel ─── */
.detail-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid rgba(46, 125, 82, 0.1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.08);
    z-index: 2000;
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    padding: 30px 28px;
    overflow-y: auto;
}

.detail-panel.open {
    right: 0;
}

.detail-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.15);
    z-index: 1999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.detail-backdrop.open {
    opacity: 1;
    pointer-events: all;
}

.detail-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(46, 125, 82, 0.08);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-close:hover {
    background: rgba(46, 125, 82, 0.18);
    color: var(--odon-green-dark);
}

.detail-content h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    color: var(--odon-green-dark);
    margin: 0 0 4px 0;
}

.detail-content .detail-code {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-bottom: 20px;
    display: block;
}

.detail-content .detail-section {
    margin-bottom: 18px;
}

.detail-content .detail-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 8px;
}

.detail-content .detail-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 500;
    margin: 3px 4px 3px 0;
}

.detail-badge.badge-approved {
    background: #e8f8ee;
    color: var(--odon-green-dark);
    border: 1px solid var(--odon-green-pastel);
}

.detail-badge.badge-pending {
    background: #fff8e1;
    color: #b8860b;
    border: 1px solid #ffe082;
}

.detail-badge.badge-locked {
    background: #f5f5f0;
    color: #999;
    border: 1px solid #e0e0d8;
}

.detail-badge.badge-year {
    background: rgba(46, 125, 82, 0.08);
    color: var(--odon-green-dark);
    border: 1px solid rgba(46, 125, 82, 0.15);
}

.detail-status {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.detail-status.status-approved {
    background: linear-gradient(135deg, #e8f8ee, #d4f0df);
    color: var(--odon-green-dark);
}

.detail-status.status-available {
    background: linear-gradient(135deg, #e8f0f8, #dbeef9);
    color: #2c5f8a;
}

.detail-status.status-locked {
    background: #f5f5f0;
    color: #999;
}

/* ─── Stats Bar ─── */
.stats-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 12px 28px;
    border: 1px solid rgba(46, 125, 82, 0.15);
    box-shadow: 0 8px 40px rgba(46, 125, 82, 0.1);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 16px;
    border-radius: 50px;
    white-space: nowrap;
}

.progress-ring-container {
    position: relative;
    width: 48px;
    height: 48px;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: transparent;
    stroke: rgba(46, 125, 82, 0.1);
    stroke-width: 4;
}

.progress-ring-fill {
    fill: transparent;
    stroke: var(--odon-green-mid);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 125.66;
    stroke-dashoffset: 125.66;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.progress-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--odon-green-dark);
}

.stats-info {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.stats-label {
    color: var(--text-muted);
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 500;
}

#progressText {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--odon-green-dark);
    line-height: 1;
}

.stats-divider {
    width: 1px;
    height: 30px;
    background: rgba(46, 125, 82, 0.12);
}

.stats-years {
    display: flex;
    gap: 6px;
}

.year-dot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.year-dot-label {
    font-size: 0.5rem;
    color: var(--text-muted);
    font-weight: 500;
}

.year-dot-bar {
    width: 24px;
    height: 4px;
    border-radius: 2px;
    background: rgba(46, 125, 82, 0.1);
    overflow: hidden;
}

.year-dot-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--odon-green-mid);
    transition: width 0.5s ease;
}

.btn-reset {
    padding: 7px 16px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid rgba(46, 125, 82, 0.2);
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    border-radius: 50px;
}

.btn-reset:hover {
    color: white;
    background: var(--odon-green-mid);
    border-color: var(--odon-green-mid);
    box-shadow: 0 4px 12px rgba(76, 175, 106, 0.3);
}

/* ─── Toast ─── */
.toast-container {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(46, 125, 82, 0.15);
    border-radius: 50px;
    padding: 10px 22px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-main);
    box-shadow: 0 8px 30px rgba(46, 125, 82, 0.12);
    animation: toastIn 0.4s ease, toastOut 0.4s ease 2.6s forwards;
    white-space: nowrap;
    pointer-events: auto;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

/* ─── Confetti Canvas ─── */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
}

/* ─── Overlay ─── */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://www.transparenttextures.com/patterns/subtle-white-feathers.png');
    pointer-events: none;
    opacity: 0.03;
    z-index: 9999;
}

/* ─── Pastel accents per year ─── */
.cycle-column[data-cycle="1"] .cycle-header { border-left-color: #81c995; }
.cycle-column[data-cycle="2"] .cycle-header { border-left-color: #a8d5ba; }
.cycle-column[data-cycle="3"] .cycle-header { border-left-color: #b5c9e8; }
.cycle-column[data-cycle="4"] .cycle-header { border-left-color: #c4b5e0; }
.cycle-column[data-cycle="5"] .cycle-header { border-left-color: #e8c3a8; }

.cycle-column[data-cycle="1"] .course-card:not(.locked):not(.approved)::before { background: #81c995; }
.cycle-column[data-cycle="2"] .course-card:not(.locked):not(.approved)::before { background: #a8d5ba; }
.cycle-column[data-cycle="3"] .course-card:not(.locked):not(.approved)::before { background: #b5c9e8; }
.cycle-column[data-cycle="4"] .course-card:not(.locked):not(.approved)::before { background: #c4b5e0; }
.cycle-column[data-cycle="5"] .course-card:not(.locked):not(.approved)::before { background: #e8c3a8; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: repeat(5, 220px);
        gap: 15px;
    }
    h1 { font-size: 1.3rem; }
    .search-bar { width: 160px; top: 12px; right: 12px; }
    .search-bar:focus-within { width: 220px; }
    .stats-years { display: none; }
    .stats-divider { display: none; }
}