/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter Tight', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #2F4F4F;
    background: #FAF9F6;
    overflow-x: hidden;
}

/* Abstract art background */
#abstract-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: #ffffff;
}

/* Main container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 100px 20px 20px 140px;
    position: relative;
    z-index: 1;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 120px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 10;
    background: rgba(255, 255, 255, 0.01);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2rem 1rem;
    box-sizing: border-box;
}

.sidebar .avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    object-fit: cover;
    border-radius: 12px;
}

.sidebar p {
    font-size: 0.85rem;
    color: #8B7355;
    margin: 0;
    line-height: 1.3;
    opacity: 0;
    transition: opacity 0.3s ease;
    position: fixed;
    top: 2.5rem;
    left: 140px;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.5rem;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 15;
}

.sidebar .avatar:hover + p {
    opacity: 1;
}

.sidebar .nav-btn {
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    color: #A0522D;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    width: 120px;
    text-align: center;
    box-sizing: border-box;
}

.nav-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    color: #A0522D;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #A0522D;
    transform: translateY(-2px);
}

.nav-btn.active {
    background: rgba(255, 255, 255, 0.2);
    color: #A0522D;
}

/* Dropdown menu */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    min-width: 160px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    z-index: 11;
    margin-top: 5px;
}

.dropdown-content .nav-btn {
    width: 100%;
    text-align: left;
    border-radius: 0;
    border: none;
    background: transparent;
    color: #A0522D;
    padding: 12px 16px;
    margin: 0;
    border-bottom: 1px solid rgba(160, 82, 45, 0.1);
}

.dropdown-content .nav-btn:last-child {
    border-bottom: none;
}

.dropdown-content .nav-btn:hover {
    background: rgba(160, 82, 45, 0.1);
    color: #A0522D;
    transform: none;
}

.dropdown.show .dropdown-content {
    display: block;
}

/* Sections */
.section {
    display: none;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.section.active {
    display: block;
}

/* About section */
.about-content {
    max-width: 500px;
    margin: 0 auto;
}

.about-content h2 {
    color: #A0522D;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.about-content ul {
    margin: 1rem 0;
    padding-left: 2rem;
}

.about-content li {
    margin-bottom: 0.5rem;
}

.contact {
    margin-top: 2rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.contact a {
    color: #A0522D;
    text-decoration: none;
    font-weight: 500;
}

.contact a:hover {
    color: #CD853F;
    text-decoration: underline;
}

/* Game containers */
.game-container {
    text-align: center;
}

.game-container h2 {
    color: #A0522D;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

/* Canvas styling */
canvas {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    margin: 0 auto 1rem auto;
    display: block;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Game controls */
.game-controls {
    margin-top: 1rem;
}

.game-controls button {
    padding: 12px 24px;
    background: #A0522D;
    color: #FAF9F6;
    border: none;
    border-radius: 25px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    cursor: pointer;
    margin: 0 10px 10px 0;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.game-controls button:hover {
    background: #CD853F;
    transform: translateY(-2px);
}

.game-controls button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.game-controls p {
    margin: 0.5rem 0;
    font-weight: 500;
    color: #333;
}

/* Algorithm selector */
.algorithm-selector {
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.algorithm-selector label {
    color: #A0522D;
    font-weight: 500;
    font-size: 0.9rem;
}

.algorithm-selector select {
    padding: 8px 12px;
    border: 2px solid #A0522D;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.8);
    color: #2F4F4F;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.algorithm-selector select:focus {
    outline: none;
    border-color: #CD853F;
}

/* Trie input section */
.trie-input {
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Binary search visualization */
.binary-visualization {
    margin-bottom: 2rem;
}

.search-range {
    margin-bottom: 2.5rem;
    position: relative;
    min-height: 90px;
}

.range-bar {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    margin: 0 auto;
    border: 2px solid #A0522D;
    overflow: visible;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.range-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #A0522D, #CD853F);
    border-radius: 18px;
    transition: width 0.5s ease;
}

.range-marker {
    position: absolute;
    top: 100%;
    margin-top: 10px;
    background: #FAF9F6;
    border: 2px solid #A0522D;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: bold;
    color: #A0522D;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: left 0.5s ease;
}

.range-marker.left {
    left: 0;
    background: #42b883;
    border-color: #42b883;
    color: white;
}

.range-marker.right {
    right: 0;
    background: #42b883;
    border-color: #42b883;
    color: white;
}

.range-marker.guess {
    background: #ff6b6b;
    border-color: #ff6b6b;
    color: white;
    z-index: 2;
}

.binary-info {
    text-align: center;
    margin-bottom: 1rem;
}

.guess-arrow {
    position: relative;
    font-size: 2rem;
    color: #A0522D;
    text-align: center;
    margin-top: 10px;
    transition: left 0.5s ease;
    pointer-events: none;
}

.binary-info p {
    margin: 0.5rem 0;
    font-size: 1rem;
    color: #2F4F4F;
}

#feedback {
    font-weight: 500;
    min-height: 1.2rem;
}

.trie-input input {
    padding: 10px;
    border: 2px solid #A0522D;
    border-radius: 5px;
    font-size: 1rem;
    min-width: 200px;
    background: rgba(255, 255, 255, 0.8);
}

.trie-input input:focus {
    outline: none;
    border-color: #CD853F;
}

.trie-input button {
    padding: 10px 20px;
    background: #A0522D;
    color: #FAF9F6;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    transition: all 0.3s ease;
}

.trie-input button:hover {
    background: #CD853F;
}

/* Connect 4 board */
.connect4-board {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 5px;
    width: 350px;
    height: 300px;
    margin: 0 auto;
    background: #000;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.connect4-cell {
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.connect4-cell:hover {
    background: #f0f0f0;
    transform: scale(1.05);
}

.connect4-cell.red {
    background: #A0522D;
    box-shadow: 0 2px 4px rgba(160, 82, 45, 0.6);
}

.connect4-cell.yellow {
    background: #CD853F;
    box-shadow: 0 2px 4px rgba(205, 133, 63, 0.6);
}

/* Search results */
.search-results {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.search-results p {
    font-weight: 500;
    color: #333;
}

/* World Clock */
.world-clock-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 3rem;
    flex-wrap: wrap;
}

.analog-clock {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    border-radius: 0;
    padding: 2rem;
    box-shadow: none;
}

.analog-clock canvas {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: 50%;
    border: 1px solid rgba(160, 82, 45, 0.6);
    cursor: grab;
    transition: all 0.2s ease;
}

.analog-clock canvas:active {
    cursor: grabbing;
    transform: scale(1.02);
}

.analog-clock h3 {
    color: #A0522D;
    font-size: 1.5rem;
    margin: 0;
    font-family: 'Inter', sans-serif;
}

.analog-clock p {
    color: #2F4F4F;
    font-size: 1.1rem;
    margin: 0;
    font-weight: 500;
}

/* Word Clock */
.word-clock {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 20px auto;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 30px;
    font-family: 'Bogle', sans-serif;
}

.clock-row {
    display: flex;
    justify-content: center;
    margin-bottom: 5px;
}

.clock-row:last-child {
    margin-bottom: 0;
}

.clock-cell {
    width: 45px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: bold;
    color: #666;
    background: #f8f8f8;
    border: 2px solid #ccc;
    border-radius: 4px;
    margin: 3px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    position: relative;
}

.clock-cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0.2) 100%);
    border-radius: 2px;
    pointer-events: none;
}

.clock-cell.active {
    color: #fff;
    background: #A0522D;
    border-color: #8B4513;
    box-shadow: 0 0 15px rgba(160, 82, 45, 0.6), inset 0 1px 0 rgba(255,255,255,0.2);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

.clock-cell.active::before {
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0.1) 100%);
}

.clock-info {
    margin-top: 20px;
    text-align: center;
}

.clock-info p {
    font-size: 1.1rem;
    color: #A0522D;
    font-weight: 500;
}

/* QLOCKTWO */
.qlocktwo-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 20px auto;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 30px;
    font-family: 'Bogle', sans-serif;
}

.qlocktwo-row {
    display: flex;
    justify-content: center;
    margin-bottom: 5px;
}

.qlocktwo-row:last-child {
    margin-bottom: 0;
}

.qlocktwo-cell {
    width: 40px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: #666;
    background: #f8f8f8;
    border: 2px solid #ccc;
    border-radius: 4px;
    margin: 2px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    position: relative;
}

.qlocktwo-cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0.2) 100%);
    border-radius: 2px;
    pointer-events: none;
}

.qlocktwo-cell.active {
    color: #fff;
    background: #A0522D;
    border-color: #8B4513;
    box-shadow: 0 0 15px rgba(160, 82, 45, 0.6), inset 0 1px 0 rgba(255,255,255,0.2);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

.qlocktwo-cell.active::before {
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0.1) 100%);
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header {
        padding: 2rem 1rem 1rem;
    }

    .header h1 {
        font-size: 2rem;
    }

    .nav {
        flex-direction: column;
        align-items: center;
    }

    .nav-btn {
        width: 100%;
        max-width: 300px;
    }

    .section {
        padding: 1rem;
    }

    canvas {
        width: 100%;
        max-width: 400px;
        height: auto;
    }

    #pongCanvas {
        max-width: 100%;
    }

    .trie-input {
        flex-direction: column;
        align-items: center;
    }

    .trie-input input {
        width: 100%;
        max-width: 300px;
    }

    .clock-letter {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .game-container h2 {
        font-size: 1.5rem;
    }

    .game-controls button {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .clock-letter {
        width: 30px;
        height: 30px;
        font-size: 18px;
    }
}
