/* Donut-themed CSS with kawaii aesthetic */
:root {
    --pink-primary: #ffcce6;
    --pink-secondary: #ff99cc;
    --pink-dark: #ff66b3;
    --purple: #4b0082;
    --white: #ffffff;
    --donut-shadow: rgba(255, 102, 204, 0.3);
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

body {
    background-color: var(--pink-primary);
    background-image: 
        radial-gradient(var(--pink-secondary) 20%, transparent 20%),
        radial-gradient(var(--pink-secondary) 20%, transparent 20%);
    background-size: 30px 30px;
    background-position: 0 0, 15px 15px;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    color: var(--purple);
    text-align: center;
    margin: 0;
    padding: 20px;
    line-height: 1.6;
}

h1, h2, h3, h4 {
    color: var(--purple);
    text-shadow: 2px 2px var(--white);
    margin: 1em 0;
}

h1 {
    font-size: 3em;
    animation: float 6s ease-in-out infinite;
    /* banner behind the site title */
    position: relative;
    display: inline-block;
    z-index: 2; /* Increased z-index to be above the banner */
    padding: 0.12em 0.6em;
    border-radius: 10px;
}

h1::before {
    /* light yellow banner that extends a bit behind the title */
    content: "";
    position: absolute;
    left: -14px;
    right: -14px;
    top: 50%;
    transform: translateY(-50%);
    background: #fff9c4; /* light yellow */
    z-index: -1; /* Changed to negative z-index to stay behind the text */
    border-radius: 12px;
    height: 1.6em;
}

/* darker yellow outline around the banner */
h1::after {
    content: "";
    position: absolute;
    left: -18px;
    right: -18px;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 14px;
    height: 1.78em;
    z-index: -2; /* Changed to stay behind both text and yellow banner */
    box-shadow: 0 0 0 3px #f6d24a;
    pointer-events: none;
}

.intro {
    font-size: 1.2em;
    background: var(--white);
    border-radius: 15px;
    padding: 15px;
    margin: 20px auto;
    max-width: 600px;
    box-shadow: 0 5px 15px var(--donut-shadow);
}

a {
    color: var(--pink-dark);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--purple);
    text-decoration: underline wavy var(--pink-dark);
}

/* Sidebar title: increase contrast and legibility */
.sidebar h3 {
    color: #ffffff;
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    margin: 0 0 8px 0;
    padding: 6px 8px;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.45);
}

.images {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.images img {
    max-width: 200px;
    border: 3px solid var(--pink-secondary);
    border-radius: 15px;
    transition: transform 0.3s ease;
}

.images img:hover {
    transform: scale(1.1) rotate(5deg);
}

/* Music Player Styles */
.music-player {
    background: var(--white);
    border-radius: 20px;
    padding: 20px;
    margin: 20px auto;
    max-width: 600px;
    box-shadow: 0 5px 20px var(--donut-shadow);
}

.progress-container {
    margin: 15px 0;
    padding: 0 10px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--pink-primary);
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.progress-fill {
    height: 100%;
    background: var(--pink-dark);
    border-radius: 10px;
    width: 0;
    transition: width 0.1s linear;
    box-shadow: 0 1px 3px var(--donut-shadow);
}

.time-display {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    color: var(--purple);
    font-size: 0.9em;
    font-weight: bold;
}

.player-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 1rem 0;
}

.control-button {
    background: var(--pink-secondary);
    color: var(--white);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    font-size: 1.5em;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px var(--donut-shadow);
}

.control-button:hover {
    background: var(--pink-dark);
    transform: translateY(-3px);
}

/* Generic button style used for the FLC link */
.btn {
    display: inline-block;
    background: var(--pink-dark);
    color: var(--white);
    padding: 10px 16px;
    border-radius: 14px;
    text-decoration: none;
    font-weight: 800;
    box-shadow: 0 6px 18px rgba(255,102,204,0.18);
    transition: transform 150ms ease, box-shadow 150ms ease;
}
.btn:hover, .btn:focus {
    transform: translateY(-3px);
    box-shadow: 0 10px 28px rgba(255,102,204,0.22);
}

/* Slightly different style specifically for the FLC button to stand out */
.flc-button {
    border: 2px solid rgba(255,255,255,0.12);
}

.playlist {
    margin-top: 20px;
    background: var(--pink-primary);
    border-radius: 15px;
    padding: 15px;
}

.playlist-item {
    background: var(--white);
    padding: 10px 15px;
    margin: 5px 0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.playlist-item:hover {
    background: var(--pink-secondary);
    color: var(--white);
    transform: translateX(5px);
}

.playlist-item.active {
    background: var(--pink-dark);
    color: var(--white);
    border-color: var(--white);
}

/* Synth Section */
.synth-section {
    background: var(--white);
    border-radius: 20px;
    padding: 20px;
    margin: 20px auto;
    max-width: 600px;
    box-shadow: 0 5px 20px var(--donut-shadow);
}

.synth label {
    display: block;
    margin: 10px 0;
}

.synth input[type="range"] {
    width: 80%;
    margin: 10px 0;
}

/* Electronics Info Section */
.electronics-info {
    background: var(--white);
    border-radius: 20px;
    padding: 20px;
    margin: 20px auto;
    max-width: 600px;
    box-shadow: 0 5px 20px var(--donut-shadow);
}

/* Layout with sidebar */
.layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    justify-content: center;
}

.sidebar {
    width: 220px;
    background: var(--pink-dark);
    color: var(--white);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    flex-shrink: 0;
}

.sidebar h3 {
    margin-top: 0;
    color: var(--white);
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.sidebar-option {
    background: transparent;
    border: 2px solid rgba(255,255,255,0.12);
    color: var(--white);
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    font-weight: 700;
}

.sidebar-option:hover,
.sidebar-option:focus {
    background: rgba(255,255,255,0.08);
    transform: translateX(6px);
}

.sidebar {
    background: var(--pink-dark);
    padding: 20px;
    border-radius: 20px;
    width: 280px;
    min-width: 280px;
    position: relative;
    color: var(--white);
}

.sidebar-inner {
    position: sticky;
    top: 20px;
    padding-right: 10px;
}

.main-content {
    max-width: 800px;
    width: 100%;
}

@media (max-width: 900px) {
    .layout { flex-direction: column; padding: 0 10px; }
    .sidebar { 
        width: 100%; 
        display: flex; 
        justify-content: center;
        background: var(--pink-dark);
        margin: -20px -10px 20px;
        padding: 20px;
    }
    .sidebar-inner {
        width: 100%;
        max-width: 800px;
    }
    .sidebar nav { flex-direction: row; gap: 8px; }
    .sidebar-option { border-radius: 999px; padding: 8px 12px; }
}

/* Chatbox styles inside the sidebar */
.chatbox {
    margin-top: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
    padding: 16px;
    border-radius: 12px;
    width: 100%; /* Keep it within sidebar width */
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1); /* Subtle inner border */
}

.chatbox h4 {
    margin: 0 0 8px 0;
    font-size: 0.95rem;
    color: var(--purple) !important; /* Force purple color */
}

/* Chat title banner similar to the main title */
.chat-title {
    position: relative;
    display: inline-block;
    z-index: 2; /* Increased to ensure text stays on top */
    padding: 0.08em 0.5em;
    border-radius: 8px;
    color: var(--purple) !important; /* Force purple color with !important */
    font-weight: 900;
    text-shadow: none; /* Remove text shadow for better readability */
    letter-spacing: 0.02em; /* Slightly improve readability */
}
.chat-title::before {
    content: "";
    position: absolute;
    left: -8px;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    background: #fff9c4; /* light yellow */
    z-index: -1; /* Changed to negative to stay behind text */
    border-radius: 10px;
    height: 1.1em;
}

/* darker yellow outline for chat title banner */
.chat-title::after {
    content: "";
    position: absolute;
    left: -10px;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 12px;
    height: 1.28em;
    z-index: -2; /* Changed to stay behind both text and yellow banner */
    box-shadow: 0 0 0 2px #f6d24a;
    pointer-events: none;
}

/* Donut decorative element next to title */
.donut {
    display: inline-block;
    width: 40px;
    height: 40px;
    margin-left: 8px;
    vertical-align: middle;
    border-radius: 50%;
    position: relative;
    background: conic-gradient(#ffb74d 0 120deg, #f06292 120deg 220deg, #ffb74d 220deg 360deg);
    box-shadow: 0 4px 8px rgba(0,0,0,0.12);
}
.donut::before {
    /* hole revealing page background (pink) */
    content: "";
    position: absolute;
    left: 9px;
    top: 9px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--pink-primary);
}
.donut::after {
    /* bite overlay (will expand to simulate a bite) */
    content: "";
    position: absolute;
    right: -6px;
    top: -6px;
    width: 0px;
    height: 0px;
    border-radius: 50%;
    background: var(--pink-primary);
    transition: width 450ms ease, height 450ms ease, transform 450ms ease;
}
.donut.animate::after {
    width: 26px;
    height: 26px;
    transform: rotate(20deg);
}

.chat-display {
    background: #fff0f5; /* light pink */
    color: #4b004b;
    padding: 12px;
    width: 100%;
    box-sizing: border-box;
    min-height: 280px;
    max-height: 400px;
    overflow-y: auto;
    border-radius: 12px;
    text-align: left;
    font-weight: 600;
    margin-bottom: 12px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

/* Style the scrollbar for the chat display */
.chat-display::-webkit-scrollbar {
    width: 8px;
}

.chat-display::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

.chat-display::-webkit-scrollbar-thumb {
    background: var(--pink-secondary);
    border-radius: 4px;
}

.chat-display::-webkit-scrollbar-thumb:hover {
    background: var(--pink-dark);
}

.chat-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.chatbox input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.95);
    color: var(--purple);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.chatbox input[type="text"]:focus {
    border-color: var(--pink-secondary);
    outline: none;
    box-shadow: 0 2px 8px rgba(255,102,204,0.2);
}

.chat-submit {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: none;
    background: var(--white);
    color: var(--pink-dark);
    font-weight: 800;
    cursor: pointer;
}

.chat-submit:hover, .chat-submit:focus {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(255,102,204,0.14);
}

/* Chat message bubbles */
.chat-message { margin-bottom: 10px; display: block; }
.chat-message .chat-meta { font-size: 0.75rem; color: #6b006b; margin-bottom: 4px; }
.chat-message .chat-text { display: inline-block; padding: 8px 10px; border-radius: 12px; background: #ffffff; color:#2b0b2b; max-width: 100%; }
.chat-message.mine { text-align: right; }
.chat-message.mine .chat-text { background: var(--pink-secondary); color: white; }
.chat-time { font-size: 0.7rem; color: rgba(0,0,0,0.35); margin-left: 6px; }

@media (max-width: 900px) {
    .chatbox { 
        display: flex; 
        flex-direction: column;
        gap: 8px; 
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
    }
    .chatbox h4 { text-align: center; }
    .chat-controls {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }
    .chat-submit { 
        width: auto;
        white-space: nowrap;
    }
}

.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--pink-dark);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid var(--white);
    cursor: pointer;
    font-size: 24px;
    box-shadow: 0 4px 12px var(--donut-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
}

.back-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px var(--donut-shadow);
}

/* Draggable Todo List Popup */
.todo-popup {
    position: fixed;
    top: 100px;
    right: 20px;
    width: 300px;
    background: var(--white);
    border-radius: 15px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 1000;
    cursor: move;
    border: 3px solid var(--pink-secondary);
}

.todo-header {
    background: var(--pink-secondary);
    color: white;
    padding: 10px 15px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.todo-header h4 {
    margin: 0;
    color: white !important;
    font-size: 1.1em;
    text-shadow: 1px 1px rgba(0,0,0,0.1);
}

.minimize-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 20px;
    padding: 0 5px;
    line-height: 1;
}

.todo-content {
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.todo-input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.todo-input-group input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--pink-primary);
    border-radius: 8px;
    font-size: 0.95em;
}

.todo-input-group button {
    background: var(--pink-dark);
    color: white;
    border: none;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.todo-input-group button:hover {
    transform: scale(1.1);
}

.todo-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--pink-primary);
    animation: slideIn 0.3s ease;
}

.todo-item:last-child {
    border-bottom: none;
}

.todo-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid var(--pink-secondary);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
}

.todo-checkbox.checked::after {
    content: "✓";
    position: absolute;
    color: var(--pink-dark);
    font-size: 14px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.todo-text {
    flex: 1;
    color: var(--purple);
}

.todo-text.completed {
    text-decoration: line-through;
    color: #999;
}

.todo-delete {
    color: #ff4444;
    cursor: pointer;
    font-size: 18px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.todo-delete:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.todo-popup.minimized .todo-content {
    display: none;
}

footer {
    margin-top: 40px;
    padding: 20px;
    font-size: 1.2em;
    color: var(--purple);
    text-shadow: 1px 1px var(--white);
    animation: float 5s ease-in-out infinite;
}

/* Synth page styles */
.synth-card {
    background: var(--white);
    border-radius: 20px;
    padding: 25px;
    margin: 30px 0;
    box-shadow: 0 8px 24px var(--donut-shadow);
    text-align: left;
}

/* Beat Pad Styles */
.beat-pad-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    padding: 20px;
    background: var(--pink-primary);
    border-radius: 15px;
    margin: 20px 0;
}

.beat-pad {
    aspect-ratio: 1;
    background: var(--white);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.1s ease;
    box-shadow: 0 4px 0 var(--pink-dark);
    user-select: none;
}

.beat-pad:active,
.beat-pad.active {
    transform: translateY(4px);
    box-shadow: 0 0 0 var(--pink-dark);
}

.beat-pad::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 12px;
    box-shadow: 0 0 20px var(--pink-secondary);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.beat-pad:active::after,
.beat-pad.active::after {
    opacity: 1;
}

.pad-label {
    color: var(--purple);
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 5px;
}

.key-hint {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: var(--pink-secondary);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    font-weight: bold;
}

/* Clock Control Styles */
.clock-control {
    border: 2px solid var(--pink-secondary);
    background: linear-gradient(45deg, var(--white), #fff5f9);
}

.clock-control h2 {
    color: var(--pink-dark);
}

.clock-control .synth-controls {
    background: var(--pink-secondary);
}

.synth-card h2 {
    margin-top: 0;
    color: var(--purple);
    font-size: 1.8em;
}

.synth-controls {
    background: var(--pink-primary);
    padding: 20px;
    border-radius: 15px;
    margin-top: 20px;
}

.control-group {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.control-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    color: var(--purple);
    font-weight: bold;
}

.control-group .slider {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--white);
    border-radius: 4px;
    outline: none;
}

.control-group .slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--pink-dark);
    border: 3px solid var(--white);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-group .slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.value-display {
    min-width: 70px;
    padding: 4px 8px;
    background: var(--white);
    border-radius: 4px;
    color: var(--purple);
    font-weight: bold;
    text-align: center;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.button-group button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.play-button {
    background: var(--purple);
    color: white;
}

.stop-button {
    background: var(--pink-dark);
    color: white;
}

.play-button:hover, .stop-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.play-button:disabled, .stop-button:disabled {
    opacity: 0.6;
    transform: none;
    cursor: not-allowed;
}

/* Active state for sidebar links */
.sidebar-option.active {
    background: rgba(255,255,255,0.15);
    transform: translateX(6px);
}