/* Root variables for light and dark themes */
:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --button-bg: #ffffff;
    --button-border: #dee2e6;
    --button-hover: #f8f9fa;
    --shadow: rgba(0, 0, 0, 0.1);

    --neon-main-color: #333333;
    --neon-secondary-color: #666;;
}

[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --text-color: #ffffff;
    --button-bg: #404040;
    --button-border: #555555;
    --button-hover: #4a4a4a;
    --shadow: rgba(255, 255, 255, 0.1);


    --neon-main-color: #ea02ff;
    --neon-secondary-color: #00ff55;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: 'Tilt Neon', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--neon-main-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
}

header {
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;

    display: flex;
    justify-content: flex-end;
    padding: 2rem;
}

footer {
    padding: 1rem 0;
    text-align: left;
    color: var(--neon-main-color);
    position: absolute;
    bottom: 0;
}

/* Theme toggle button */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: translateY(-1px);
}

.theme-toggle:active {
    transform: translateY(0);
}

.theme-toggle-icon {
    font-size: 2rem;
    transition: transform 0.3s ease;
}

a:link,
a:visited,
a:hover,
a:active {
    text-decoration: none;
}

.theme-toggle:hover .theme-toggle-icon {
    transform: scale(1.1);
}

/* Text box functionality */
.text-box {
    position: absolute;
    padding: 1rem;
    border: 2px solid transparent;
    cursor: move;
    user-select: none;
    transition: border-color 0.2s ease;
    min-width: 50px;
    min-height: 30px;
    word-wrap: break-word;
    color: var(--neon-main-color);
    box-sizing: border-box;
    color: var(--neon-main-color);
    }

    [data-theme="dark"] .text-box {
        text-shadow:
            0 0 4px var(--neon-main-color),
            0 0 8px var(--neon-main-color),
            0 0 16px var(--neon-main-color),
            0 0 32px var(--neon-main-color);
        color: #fff;
    }

    /* Use secondary neon color for .text-box.todo in dark mode */
    [data-theme="dark"] .text-box.todo {
        text-shadow:
            0 0 4px var(--neon-secondary-color),
            0 0 8px var(--neon-secondary-color),
            0 0 16px var(--neon-secondary-color),
            0 0 32px var(--neon-secondary-color);
        color: #fff;
    }
}

.text-box:hover {
    border-color: var(--button-border);
}

.text-box.dragging {
    opacity: 0.8;
    z-index: 1000;
    cursor: grabbing;
}

.text-box.resizing {
    opacity: 0.8;
}

/* Resize anchors */
.resize-anchor {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: var(--button-bg);
    border: 2px solid var(--button-border);
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1001;
}

.text-box:hover .resize-anchor,
.text-box.resizing .resize-anchor,
.text-box.selected .resize-anchor {
    opacity: 1;
}

/* Anchor positions */
.resize-anchor.nw { top: -6px; left: -6px; cursor: nw-resize; }
.resize-anchor.n { top: -6px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.resize-anchor.ne { top: -6px; right: -6px; cursor: ne-resize; }
.resize-anchor.e { top: 50%; right: -6px; transform: translateY(-50%); cursor: e-resize; }
.resize-anchor.se { bottom: -6px; right: -6px; cursor: se-resize; }
.resize-anchor.s { bottom: -6px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.resize-anchor.sw { bottom: -6px; left: -6px; cursor: sw-resize; }
.resize-anchor.w { top: 50%; left: -6px; transform: translateY(-50%); cursor: w-resize; }

/* Default positioning for existing text boxes */
.text-box.todo {
    top: 2%;
    left: 34%;
    width: 25%;
    font-size: 0.9rem;
    font-style: italic;
}

.text-box.main {
    top: 14%;
    left: 29%;
    width: 37%;
    font-size: 4rem;
    line-height: 1.4;
}

.text-box.caps {
    font-weight: bold;
    font-size: 2rem;
    line-height: 1;
    letter-spacing: 0.1em;
}

.text-box.caps:first-of-type {
    top: 64%;
    left: 19%;
    width: 6%;
}

.text-box.caps:nth-of-type(4) {
    top: 12.6%;
    left: 13%;
    width: 7.5%;
}

.text-box.caps-variant {
    font-weight: bold;
    font-size: 1.8rem;
    line-height: 1.2;
    top: 72%;
    left: 59%;
    width: 10%;
}

.cursive {
    font-style: italic;
    font-weight: normal;
    font-size: 0.8em;
}

/* Responsive design */
@media (max-width: 768px) {
    .theme-toggle {
        width: 40px;
        height: 40px;
    }
    
    .text-box {
        font-size: 0.9rem;
    }
    
    .text-box.caps {
        font-size: 1.5rem;
    }
    
    .text-box.caps-variant {
        font-size: 1.3rem;
    }
    
    /* Adjust positions for smaller screens */
    .text-box.todo {
        top: 15%;
        left: 60%;
        width: 35%;
    }
    
    .text-box.main {
        top: 35%;
        left: 10%;
        width: 45%;
    }
    
    .text-box.caps:first-of-type {
        top: 25%;
        left: 55%;
        width: 25%;
    }
    
    .text-box.caps:nth-of-type(4) {
        top: 55%;
        left: 50%;
        width: 30%;
    }
    
    .text-box.caps-variant {
        top: 65%;
        left: 15%;
        width: 35%;
    }
    
    /* Larger touch targets for resize anchors on mobile */
    .resize-anchor {
        width: 15px;
        height: 15px;
    }
    
    /* Show anchors by default on mobile since there's no hover */
    .text-box .resize-anchor {
        opacity: 0.7;
    }
    
    .text-box.resizing .resize-anchor {
        opacity: 1;
    }
}
