/* ========================================
   GLOBAL STYLES
======================================== */
html, body {
    margin: 0;
    padding: 0;
    background-color: #000;
    font-family: 'Times New Roman', Times, serif;
    padding-top: 0px;
    cursor: crosshair;
    overflow-x: hidden;
}

/* ========================================
   PAGE BACKGROUND WITH OVERLAY
======================================== */
/* .page-bg {
    background-image: url("/static/dotted_ripple.gif");
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center 0px;
    background-color: rgba(0, 0, 0, 0.7);
    min-height: 100vh;
    height: 100%;
    width: 100vw;
    position: absolute;
    height: auto;
    top: 0;
    left: 0;
    z-index: 0;
} */

/* Dark overlay on background
.page-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 1;
    pointer-events: none;
}

/* All content sits above overlay */
/* .page-bg > * {
    position: relative;
    z-index: 2;
} */

/* ========================================
   NAVBAR
======================================== */
.navbar {
    background: transparent;
    height: 80px;
    align-items: center;
    display: flex;
    justify-content: flex-end;
    padding: 20px 40px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    z-index: 1000;
    border-bottom: 2px solid #fff;
    backdrop-filter: blur(4px);
}

/* .logo img {
    height: 65px;
    width: auto;
    display: block;
} */

.nav-links {
    list-style: none;
    display: flex;
    gap: 30px;
    margin: 0;
    padding: 0;
    margin-left: auto;
}

.nav-links li {
    position: relative;
    height: 80px;
    display: flex;
    align-items: center;
}

.nav-links li:not(:last-child) {
    border-right: 2px solid #fff;
    padding-right: 30px;
}

.nav-links li:first-child {
    border-left: 2px solid #fff;
    padding-left: 30px;
}

.nav-links a {
    text-decoration: none;
    color: #aaa;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 1px;
    transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a:focus,
.nav-links a.active {
    color: #fff;
}

.burger {
    display: none;
    font-size: 28px;
    color: #fff;
    cursor: pointer;
    z-index: 10000;
}

/* ========================================
   HOME PAGE - INTRO SECTION
======================================== */
.intro-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: #fff;
}

.intro-title {
    display: block;
    margin-top: 0px;
    margin-bottom: 10px;
    text-align: center;
    white-space: normal;
    word-break: break-all;
    line-height: 1;
    max-width: 95vw;
    letter-spacing: clamp(4px, 1vw, 30px);
    font-size: clamp(4rem, 1.9rem, 2.2rem);
}

.intro-subtitle {
    color: #fff;
    text-align: center;
    margin-top: 10px;
    margin-bottom: 10px;
    font-size: clamp(2rem, 0.5rem, 0.93rem);
    opacity: 1;
    letter-spacing: clamp(4px, 1vw, 30px);
}

.intro-tagline {
    color: #fff;
    text-align: center;
    margin-top: 10px;
    margin-bottom: 10px;
    font-size: clamp(1.5rem, 0.5rem, 0.78rem);
    opacity: 0.6;
    letter-spacing: clamp(4px, 1vw, 30px);
}

/* .intro-logo-top {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.intro-logo-top img {
    max-width: min(320px, 70vw);
    height: auto;
} */

/* .intro-logo-bottom {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-top: 0;
    opacity: 0.85;
}

.intro-logo-bottom img {
    max-width: min(200px, 60vw);
    height: auto;
} */

/* ========================================
   PROFILE PAGE
======================================== */
.profile-section {
    text-align: center;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
}

.profile-section h1 {
    font-size: 3.4rem;
    padding-top: 80px;
}

.profile-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    margin-bottom: 40;
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.profile-card {
    background: #151515;
    color: #fff;
    padding: 20px;
    margin: 60px 20px 20px 20px;
    border-radius: 8px;
    width: 600px;
    vertical-align: top;
    text-align: center;
    transition: transform 0.2s ease-out;
    transform-origin: center center;
    padding-top: 100px;
    position: relative;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.profile-image {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid #151515;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.profile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-card:hover {
    transform: scale(1.05);
}

.profile-card h2 {
    font-size: 1.5rem;
    margin: 0 0 15px 0;
}

.profile-card .course {
    font-size: 1.1rem;
    margin: 10px 0;
    color: #aaa;
}

.profile-card .tagline {
    font-size: 1.2rem;
    margin: 15px 0;
}

.profile-card .profile-quote {
    font-size: 0.9rem;
    font-style: italic;
    color: #aaa;
    margin: 20px 0 0 0;
    text-align: center;
}

/* ========================================
   PORTFOLIO PAGE
======================================== */
.portfolio-section {
    text-align: center;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    align-items: center;
    box-sizing: border-box;
    padding-top: 80px;
}

.portfolio-section h1 {
    font-size: 3.4rem;
}

.portfolio-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0px;
}

.work-card {
    background: #151515;
    color: #fff;
    padding: 20px;
    margin-left: 40px;
    margin-top: 15px;
    border-radius: 8px;
    display: inline-block;
    width: 210px;
    height: 160px;
    vertical-align: top;
    text-align: center;
    transition: transform 0.2s;
    min-height: 50px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #1c1c1c #111;
    transform-origin: center center;
    position: relative;
}

.work-card h3,
.work-card p {
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
}

.work-card:hover {
    transform: scale(1.05);
}

.work-card .try-link {
    opacity: 0;
    transition: opacity 0.3s;
    display: inline-block;
    margin-top: 10px;
    color: #fff;
    font-weight: 600;
}

.work-card:hover .try-link {
    opacity: 1;
}

.work-card a:hover {
    color: #ccc;
}

/* ========================================
   WORK DETAIL PAGES (with io-box)
======================================== */
.work-detail-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    text-align: center;
    padding-top: 80px;  /* adjust for navbar height */
    box-sizing: border-box;
    color: #fff;
}

.works.page-bg {
    background-size: 2990px 2990px;
    background-position: center;
}

.work-detail-section h1 {
    margin-bottom: 30px;
}

.io-box {
    border: 2px solid #fff;
    border-radius: 8px;
    padding: 25px;
    background: rgba(17, 17, 17, 0.7);
    margin: 0px auto;
    width: 90%;
    box-sizing: border-box;
}

.io-box input[type="text"],
.io-box input[type="number"] {
    width: 100%;
    padding: 8px;
    margin: 5px 0 10px 0;
    border-radius: 4px;
    border: none;
    box-sizing: border-box;
    background: #222;
    color: #fff;
}

.io-box input[type="submit"] {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    background: #fff;
    color: #000;
    cursor: pointer;
}

/* ========================================
   LINKED LIST FORM STYLES
======================================== */
.container {
    display: flex;
    gap: 10px;
    text-align: left;
}

#data-field {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.operation-field {
    flex-direction: column;
    display: flex;
    margin: auto;
    align-items: flex-start;
}

#index-field {
    margin-top: 10px;
    display: none;
    text-align: left;
}

#index-field.show {
    display: block;
}

.io-box select {
    width: 100%;
    padding: 8px;
    margin: 5px 0 10px 0;
    border-radius: 4px;
    border: none;
    box-sizing: border-box;
    background: #222;
    color: #fff;
}

.list-display {
    margin-top: 20px;
    color: #fff;
}

.list-display h3 {
    margin-bottom: 10px;
}

.message {
    margin-top: 15px;
    color: #ffff00;
}

.removed_message {
    margin-top: 15px;
    color: #e43109;
}

/* ========================================
   BINARY TREE PAGE
======================================== */
.tree-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
    margin: 30px 0;
    position: relative;
    background: #000;
    border-radius: 8px;
    border: 2px solid #fff;
}

#tree-canvas {
    cursor: grab;
    display: block;
    width: 100%;
    height: auto;
}

#tree-canvas:active {
    cursor: grabbing;
}

.empty-tree-note {
    color: #aaa;
    font-size: 1.1rem;
    text-align: center;
    position: absolute;
}

.container {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

#data-field,
.operation-field {
    display: flex;
    flex-direction: column;
}

#data-field label,
.operation-field label {
    margin-bottom: 8px;
    font-weight: bold;
    color: #fff;
}

#data-field input,
.operation-field select {
    padding: 10px;
    background: #1a1a1a;
    border: 2px solid #fff;
    border-radius: 4px;
    color: #fff;
    font-size: 1rem;
}

#data-field input::placeholder {
    color: #888;
}

.operation-field select option {
    background: #1a1a1a;
    color: #fff;
}

.message {
    color: #4caf50;
    font-weight: bold;
    margin-top: 15px;
}

.message-success {
    color: #4caf50;
    font-weight: bold;
    margin-top: 15px;
}

.message-error {
    color: #f44336;
    font-weight: bold;
    margin-top: 15px;
}

.search_result {
    color: #2196f3;
    font-weight: bold;
    margin-top: 15px;
}

.traversal_result {
    color: #2196f3;
    font-weight: bold;
    margin-top: 15px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .tree-container {
        min-height: 400px;
    }

    .container {
        flex-direction: column;
        gap: 10px;
    }

    #data-field,
    .operation-field {
        width: 100%;
    }
}


/* ========================================
   GRAPH PAGE
======================================== */
:root {
    --lrt1-color: #FFCD00;
    --lrt2-color: #5B2D82;
    --mrt3-color: #0038A8;
}

.map-header {
    background: #000;
    padding: clamp(0.75rem, 2vw, 1.5rem) clamp(1rem, 3vw, 2rem);
    border-bottom: 2px solid #fff;
    z-index: 10;
    color: #fff;
    margin-top: 80px;
}

.map-header h1 { 
    margin: 0 0 0.5rem 0; 
    font-size: clamp(1.3rem, 3vw, 2rem);
    font-weight: 800; 
    letter-spacing: -0.025em; 
    color: #fff;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: clamp(0.75rem, 2vw, 2rem);
    flex-wrap: wrap;
}

.legend { 
    display: flex; 
    gap: clamp(0.75rem, 2vw, 1.5rem);
    margin-top: 10px;
    flex-wrap: wrap;
}

.legend-item { 
    display: flex; 
    align-items: center; 
    gap: 0.5rem; 
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    font-weight: 600;
    color: #fff;
}

.legend-pill { 
    width: clamp(10px, 1.5vw, 12px);
    height: clamp(10px, 1.5vw, 12px);
    border-radius: 50%; 
}

.path-panel {
    flex-grow: 1;
    background: #151515;
    padding: clamp(0.5rem, 1vw, 0.75rem) clamp(0.75rem, 1.5vw, 1rem);
    border-radius: 8px;
    border: 2px solid #fff;
    font-size: clamp(0.85rem, 1.5vw, 1.05rem);
    min-height: 1.2rem;
    display: flex;
    align-items: center;
    color: #fff;
    min-width: 0;
}

.actions { 
    display: flex; 
    gap: clamp(0.5rem, 1vw, 0.75rem);
    flex-shrink: 0;
}

.btn-primary { 
    padding: clamp(8px, 1.5vw, 10px) clamp(15px, 3vw, 30px);
    border: 2px solid #fff;
    border-radius: 4px;
    font-weight: bold;
    font-size: clamp(12px, 2vw, 16px);
    cursor: pointer;
    transition: all 0.2s;
    background: #fff; 
    color: #000;
    white-space: nowrap;
}

.btn-primary:hover { 
    background: #ddd;
    transform: scale(1.05);
}

.btn-secondary { 
    padding: clamp(8px, 1.5vw, 10px) clamp(15px, 3vw, 30px);
    border: none;
    border-radius: 4px;
    font-weight: bold;
    font-size: clamp(12px, 2vw, 16px);
    cursor: pointer;
    transition: all 0.2s;
    background: #f44336; 
    color: #fff;
    white-space: nowrap;
}

.btn-secondary:hover { 
    background: #d32f2f;
    transform: scale(1.05);
}

.map-viewport {
    flex-grow: 1;
    overflow: auto;
    background: #000;
    position: relative;
    padding: clamp(10px, 3vw, 40px);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - clamp(150px, 20vh, 200px));
}

#map-canvas {
    display: block;
    background-color: #000;
    border: 2px solid #fff;
    border-radius: 8px;
    cursor: grab;
    max-width: 100%;
    height: auto;
    width: clamp(300px, 90vw, 1200px);
}

#map-canvas:active {
    cursor: grabbing;
}

.station-tooltip {
    position: fixed;
    background: #151515;
    color: white;
    padding: clamp(6px, 1vw, 8px) clamp(10px, 2vw, 14px);
    border-radius: 6px;
    border: 2px solid #fff;
    font-size: clamp(0.7rem, 1.5vw, 0.85rem);
    font-weight: 600;
    pointer-events: none;
    display: none;
    z-index: 1000;
}

.dropdown-container {
    display: flex;
    gap: clamp(0.5rem, 1vw, 0.75rem);
    align-items: center;
    flex-wrap: wrap;
}

.dropdown-container select {
    padding: clamp(8px, 1.5vw, 10px) clamp(10px, 2vw, 14px);
    border-radius: 4px;
    background: #151515;
    color: #fff;
    border: 2px solid #fff;
    font-size: clamp(12px, 2vw, 16px);
    min-width: clamp(120px, 20vw, 170px);
    font-weight: bold;
}

.dropdown-container select option {
    background: #151515;
    color: #fff;
}


/* ========================================
   SORTING PAGE
======================================== */
.io-row {
    display: flex;
    gap: clamp(5px, 1vw, 10px);
    align-items: center;
    flex-wrap: nowrap;
    min-width: 0;
    width: 100%;
}

.operation-field {
    flex: 1;
    min-width: clamp(100px, 20vw, 200px);
    max-width: 100%;
}

.algo-select {
    width: 50%;
    height: clamp(32px, 5vw, 38px);
    padding: clamp(4px, 1vw, 8px);
    font-size: clamp(12px, 2vw, 16px);
    border-radius: 4px;
    border: none;
    background: #222;
    color: #fff;
    min-width: 0;
}

.run-btn {
    padding: clamp(6px, 1.5vw, 10px) clamp(10px, 2vw, 20px);
    background-color: #fff;
    color: #000;
    border: 2px solid #fff;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: clamp(10px, 1.5vw, 14px);
    min-width: clamp(50px, 10vw, 80px);
}

.clear-btn {
    padding: clamp(6px, 1.5vw, 10px) clamp(10px, 2vw, 20px);
    background-color: #f44336;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: clamp(10px, 1.5vw, 14px);
    min-width: clamp(50px, 10vw, 80px);
}

/* --- Stats Row --- */
.stats-row {
    display: flex;
    justify-content: space-around;
    margin: clamp(10px, 2vw, 20px) 0 clamp(5px, 1vw, 10px) 0;
    flex-wrap: nowrap;
    gap: clamp(5px, 1vw, 10px);
    overflow-x: auto;
    font-size: clamp(10px, 1.5vw, 14px);
}

/* --- Bars Area --- */
.bars-area {
    width: 100%;
    height: clamp(250px, 40vw, 350px);
    border: 2px solid #fff;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    background: #000;
    min-height: 200px;
}

/* --- Number Input and Button Row --- */
.number-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: nowrap;
    width: 100%;
    padding-top: 20px;
    min-width: 0;
}

.number-label {
    color: #fff;
    min-width: fit-content;
    margin-bottom: 0;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 14px;
}

.number-input {
    flex: 1;
    min-width: 60px;
    box-sizing: border-box;
    height: 38px;
    font-size: 16px;
    background: #222;
    color: #fff;
    border-radius: 4px;
    border: none;
    padding: 8px;
}

.number-btn {
    background-color: #fff;
    color: #000;
    border: 2px solid #fff;
    border-radius: 4px;
    font-weight: bold;
    height: 38px;
    font-size: 14px;
    padding: 0 15px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ========================================
   CONTACT PAGE
======================================== */
.profile-card .social-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.profile-card .social-link {
    color: #fff;
    font-size: 20px;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.profile-card .social-link:hover {
    transform: scale(1.2);
}

/* ========================================
   SCREEN EFFECTS
======================================== */
#zoom-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000000;
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.1);
    transition: opacity 2s, transform 3s cubic-bezier(.4, 2, .3, .9);
}

.zoom-transition {
    transform: scale(1.1);
    transition: transform 3s, filter 2s;
    filter: blur(8px);
    pointer-events: none;
}

/* .screen-ripple {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    transform: scale(0);
    animation: screen-ripple-distort 0.7s linear;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    filter: url(#wavy-ripple);
    z-index: 9999;
}

@keyframes screen-ripple-distort {
    to {
        transform: scale(4);
        opacity: 0;
    }
} */

/* ========================================
   MOBILE STYLES
======================================== */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }

    .intro-title {
        font-size: 3.2rem;
    }

    .intro-subtitle {
        font-size: 1.2rem;
    }
    .intro-tagline {
        font-size: 0.85rem;
    }

    /* Navbar Mobile */
    .burger {
        display: block;
    }

    .navbar {
        flex-direction: row;
        padding: 10px 40px;
        height: auto;
    }

    /* .logo img {
        height: 8.5vh;
        width: auto;
    } */

    .nav-links {
        flex-direction: column;
        position: fixed;
        top: 69.5px;
        right: -50%;
        width: 25%;
        height: calc(100vh - 80px);
        background: rgba(0, 0, 0, 0.7);
        padding: 20px;
        text-align: center;
        transition: right 0.3s ease-in-out;
        z-index: 999;
    }

    .nav-links.show {
        right: 0;
    }

    .nav-links li {
        margin: 20px 0;
        height: auto;
    }

    .nav-links li:not(:last-child) {
        border-right: none;
        padding-right: 0;
    }

    .nav-links li:first-child {
        border-left: none;
        padding-left: 0;
    }

    .nav-links a {
        font-size: 10px;
        color: #fff;
    }

    /* Home Page Mobile */
    /* .intro-logo-top img {
        max-width: min(220px, 70vw);
    }

    .intro-logo-bottom img {
        max-width: min(135px, 50vw);
    }

    .intro-tagline {
        letter-spacing: 8px;
        margin-top: 0px;
        font-size: 2rem;
        padding: 0 10px;
        line-height: 1.5;
    } */

    /* Profile Page Mobile */
    .profile-card {
        width: 80%;
        margin: 10px auto;
    }

    .profile-image {
        width: 100px;
        height: 100px;
        top: -50px;
    }
    
    .profile-card h2 {
        font-size: 1.3rem;
    }
    
    .profile-card .course {
        font-size: 1rem;
    }
    
    .profile-card .tagline {
        font-size: 1.1rem;
    }
    
    .profile-card .profile-quote {
        font-size: 0.8rem;
    }

    .profile-section h1 {
        font-size: 2.2rem;
    }

    /* Portfolio Page Mobile */
    .portfolio-section h1 {
        font-size: 2rem;
    }

    .work-card {
        width: 80%;
        max-width: 100%;
        margin: 10px auto;
        box-sizing: border-box;
    }

    /* Work Detail Pages Mobile */
    .io-box {
        width: 90%;
        max-width: 500px;
        box-sizing: border-box;
    }

    .io-box input[type="text"],
    .io-box input[type="number"] {
        word-break: break-word;
        overflow-wrap: break-word;
        width: 96%;
    }

    .operation-field {
        max-width: 90px;
    }

    .operation-field select {
        font-size: 12px;
        padding: 6px;
    }

    .list-display p {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    /* Contact Page Mobile */
    .profile-card .social-links {
        gap: 10px;
    }
    
    .profile-card .social-link {
        font-size: 18px;
    }
}