/* Web Screensaver Premium Styling */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;900&display=swap');

/* Custom C64 Font — loaded from local project, no system install required */
@font-face {
    font-family: 'C64ProMono';
    src: url('C64_Pro_Mono-STYLE.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg-dark: #050508;
    --card-bg: rgba(10, 10, 18, 0.65);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    
    /* Neon Theme colors (default Cyan) */
    --accent-glow: rgba(0, 204, 255, 0.4);
    --accent-solid: #00ccff;
    --accent-gradient: linear-gradient(135deg, #00ccff 0%, #a855f7 100%);
    
    --transition-speed: 0.4s;
    --transition-curve: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-drag: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
}

/* Canvas background */
#canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 1;
}

/* Base style for ambient digital clock */
.clock-container {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    transition: all var(--transition-speed) var(--transition-curve);
    font-family: 'C64ProMono', monospace;
    font-weight: normal;
    letter-spacing: 0.04em;
    text-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.9;
}

/* Clock positions */
.clock-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.clock-center .time-display {
    font-size: 7.5rem;
    font-weight: 700;
    line-height: 1;
}

.clock-center .date-display {
    font-size: 1.8rem;
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-weight: 400;
}

.update-display {
    font-size: 0.65rem;
    margin-top: 0.3rem;
    color: var(--text-muted);
    opacity: 0.6;
}

.clock-bottom-right {
    bottom: 2.5rem;
    right: 2.5rem;
    text-align: right;
    align-items: flex-end;
}

.clock-bottom-right .time-display {
    font-size: 3.5rem;
    font-weight: 600;
    line-height: 1;
}

.clock-bottom-right .date-display {
    font-size: 1.1rem;
    margin-top: 0.2rem;
    color: var(--text-muted);
}

.clock-hidden {
    opacity: 0;
    transform: scale(0.9) translate(-50%, -50%);
    pointer-events: none;
    display: none;
}

/* Glassmorphic Settings Panel */
.settings-panel {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    bottom: 1.2rem;
    width: 290px;
    z-index: 10;
    background: var(--card-bg);
    backdrop-filter: blur(20px) saturate(185%);
    -webkit-backdrop-filter: blur(20px) saturate(185%);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), 
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.5s var(--transition-curve), 
                opacity 0.5s var(--transition-curve),
                visibility 0.5s var(--transition-curve);
    box-shadow: 0 0 40px rgba(0, 204, 255, 0.05);
}

.settings-header {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.settings-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.pin-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.pin-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.pin-btn.active {
    color: var(--accent-solid);
    text-shadow: 0 0 10px var(--accent-glow);
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.8rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

/* Hide scrollbar for standard look */
.settings-content::-webkit-scrollbar {
    width: 6px;
}
.settings-content::-webkit-scrollbar-track {
    background: transparent;
}
.settings-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
.settings-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.setting-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* Dropdown / Select Inputs */
select {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.45rem 0.8rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    transition: all 0.3s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2rem;
}

select:focus {
    border-color: var(--accent-solid);
    box-shadow: 0 0 12px var(--accent-glow);
}

select option {
    background: #0d0d15;
    color: var(--text-main);
}

/* Text Inputs */
.text-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.45rem 0.8rem;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    outline: none;
    transition: all 0.3s;
}

.text-input:focus {
    border-color: var(--accent-solid);
    box-shadow: 0 0 12px var(--accent-glow);
}

/* Styled Sliders (Ranges) */
.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    transition: background 0.3s;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--accent-solid);
    box-shadow: 0 0 8px var(--accent-glow);
    cursor: pointer;
    transition: transform 0.1s, background-color 0.3s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.25);
}

.slider-value {
    font-size: 0.78rem;
    font-weight: 600;
    min-width: 28px;
    text-align: right;
    color: var(--accent-solid);
}

/* Switches / Toggles */
.switch-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.2rem 0;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border-radius: 24px;
    border: 1px solid var(--border-color);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-main);
    transition: .3s var(--transition-curve);
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: rgba(0, 204, 255, 0.2);
    border-color: var(--accent-solid);
}

input:checked + .toggle-slider:before {
    transform: translateX(20px);
    background-color: var(--accent-solid);
    box-shadow: 0 0 8px var(--accent-glow);
}

/* Action Buttons */
.btn-primary {
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.65rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: all 0.3s;
    box-shadow: 0 4px 14px rgba(0, 204, 255, 0.2);
    margin-top: 0.2rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px var(--accent-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 8px;
    padding: 0.55rem;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-muted);
}

/* Info footer text */
.settings-footer {
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.4;
    background: rgba(0, 0, 0, 0.15);
}

/* Toggle Settings button (visible when UI is showing, floating on top-left or overlaying) */
.toggle-ui-btn {
    position: absolute;
    top: 1.2rem;
    left: 1.2rem;
    z-index: 9;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.toggle-ui-btn:hover {
    border-color: var(--accent-solid);
    color: var(--accent-solid);
    box-shadow: 0 0 15px var(--accent-glow);
    transform: scale(1.05);
}

/* Auto-hide UI states */
body.hide-ui {
    cursor: none;
}

body.hide-ui .settings-panel {
    opacity: 0;
    transform: translate3d(20px, 0, 0);
    pointer-events: none;
    visibility: hidden;
}

body.hide-ui .toggle-ui-btn {
    opacity: 0;
    transform: translate3d(-20px, 0, 0);
    pointer-events: none;
    visibility: hidden;
}

body.hide-ui .clock-container {
    opacity: 0.5; /* Fade clock slightly in passive mode to be very ambient */
}

/* Goal Display */
.goal-display {
    position: absolute;
    top: 12%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    pointer-events: none;
    transition: all var(--transition-speed) var(--transition-curve);
    font-family: 'C64ProMono', monospace;
    font-size: 1.5rem;
    color: var(--text-main);
    text-shadow: 0 0 20px rgba(0,0,0,0.9);
    opacity: 0.8;
    text-align: center;
    width: 80%;
    letter-spacing: 0.05em;
}

body.hide-ui .goal-display {
    opacity: 0.4;
}

/* Zen Mode (force hide) */
body.zen-mode .settings-panel,
body.zen-mode .toggle-ui-btn {
    opacity: 0 !important;
    transform: translate3d(20px, 0, 0) !important;
    pointer-events: none !important;
    visibility: hidden !important;
}
body.zen-mode {
    cursor: none !important;
}

/* Color palettes presets styles dynamically updated via JS variables */
.theme-cyber {
    --accent-solid: #00ccff;
    --accent-glow: rgba(0, 204, 255, 0.35);
    --accent-gradient: linear-gradient(135deg, #00ccff 0%, #a855f7 100%);
}

.theme-fire {
    --accent-solid: #ff6a00;
    --accent-glow: rgba(255, 106, 0, 0.35);
    --accent-gradient: linear-gradient(135deg, #ff6a00 0%, #ffb700 100%);
}

.theme-pink {
    --accent-solid: #ff0599;
    --accent-glow: rgba(255, 5, 153, 0.35);
    --accent-gradient: linear-gradient(135deg, #ff0599 0%, #00ccff 100%);
}

.theme-aurora {
    --accent-solid: #00f282;
    --accent-glow: rgba(0, 242, 130, 0.35);
    --accent-gradient: linear-gradient(135deg, #00f282 0%, #0072ff 100%);
}

.theme-mono {
    --accent-solid: #ffffff;
    --accent-glow: rgba(255, 255, 255, 0.25);
    --accent-gradient: linear-gradient(135deg, #ffffff 0%, #718096 100%);
}

/* Inline icons representation */
.icon-svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}
