/* --- DESIGN TOKENS & RESET --- */
:root {
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    --glass-blur: blur(20px);
    --text-light: #ffffff;
    --text-dim: rgba(255, 255, 255, 0.75);
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; }
body { color: var(--text-light); min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; background-color: #05070a; position: relative; }

/* --- CANVAS LAYERS --- */
#stars-canvas, #bg-canvas { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; pointer-events: none; }
#stars-canvas { z-index: -2; }
#bg-canvas { z-index: -1; filter: blur(50px); }

a { text-decoration: none; color: var(--text-light); cursor: pointer; }
button, .dropdown-trigger { cursor: pointer; }
ul { list-style: none; }

/* --- GLASSMORPHISM UTILITY --- */
.glass {
    background: var(--glass-bg); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
}

/* --- NAVBAR --- */
.navbar { position: fixed; top: 0; left: 0; width: 100%; z-index: 1000; border-bottom: 1px solid var(--glass-border); }
.nav-container { max-width: 1400px; margin: 0 auto; padding: 0 2rem; height: 80px; display: flex; justify-content: space-between; align-items: center; }
.brand { font-size: 1.5rem; font-weight: 700; letter-spacing: 1px; }

.desktop-menu { display: flex; align-items: center; height: 100%; }
.dropdown { position: relative; height: 100%; display: flex; align-items: center; }
.dropdown-trigger { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; padding: 0.5rem 1rem; border-radius: 8px; transition: background 0.3s; }
.dropdown-trigger:hover { background: rgba(255, 255, 255, 0.1); }

.mega-menu {
    position: absolute; top: 100%; right: 0; width: 450px; border-radius: 0 0 16px 16px; border-top: none; padding: 1.5rem;
    display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; clip-path: inset(0 0 100% 0); visibility: hidden;
    transition: clip-path 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s;
}
.dropdown:hover .mega-menu { clip-path: inset(0 0 0 0); visibility: visible; }
.menu-tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; border-radius: 12px; text-align: center;
    transition: transform 0.2s, background 0.2s; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.08); cursor: pointer;
}
.menu-tile img, .menu-tile i { width: 32px; height: 32px; margin-bottom: 0.5rem; object-fit: contain; font-size: 2rem; }
.menu-tile span { font-size: 0.85rem; font-weight: 500; }
.menu-tile:hover { background: rgba(255, 255, 255, 0.12); }
.mobile-toggle { display: none; background: none; border: none; color: var(--text-light); font-size: 2rem; }

/* --- SPA VIEW LOGIC --- */
.view-section { display: none; flex-direction: column; animation: fadeIn 0.4s ease forwards; gap: 2rem; }
.view-section.active { display: flex; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
main { flex: 1; padding: 120px 2rem 4rem 2rem; max-width: 1400px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; }

/* --- AD PLACEMENTS --- */
.ad-placeholder {
    width: 100%; max-width: 728px; height: 90px; margin: 0 auto; border-radius: 12px; display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 2px;
    background: rgba(255, 255, 255, 0.03); border: 1px dashed rgba(255, 255, 255, 0.15); 
}
.ad-side {
    width: 160px; min-height: 400px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 2px; text-align: center;
    background: rgba(255, 255, 255, 0.03); border: 1px dashed rgba(255, 255, 255, 0.15); flex-shrink: 0;
}

/* --- HOME VIEW SPECIFICS --- */
.hero { text-align: center; padding: 1rem 0 2rem 0; }
.hero h1 { font-size: 3.5rem; margin-bottom: 0.5rem; font-weight: 700; }
.hero p { color: var(--text-dim); font-size: 1.2rem; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 2rem; }
.tool-card-wrapper { perspective: 1200px; display: flex; cursor: pointer; }
.tool-card { border-radius: 20px; padding: 2rem; display: flex; flex-direction: column; gap: 1rem; width: 100%; transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1); will-change: transform; }
.tool-icon-wrapper { width: 60px; height: 60px; border-radius: 16px; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.1); font-size: 2rem; }
.tool-icon-wrapper img { width: 40px; height: 40px; object-fit: contain; }
.tool-info h3 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.tool-info p { font-size: 0.95rem; color: var(--text-dim); line-height: 1.5; }

/* --- GENERIC TOOL HEADER --- */
.tool-header { display: flex; justify-content: flex-start; align-items: center; gap: 2rem; margin-bottom: 1rem; z-index: 10; position: relative;}
.tool-header h2 { font-size: 2.5rem; display: flex; align-items: center; gap: 1rem; margin: 0; font-weight: 700; }
.tool-header h2 img { width: 45px; height: 45px; object-fit: contain; }

.btn {
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); color: white; padding: 0.8rem 1.5rem;
    border-radius: 8px; font-weight: 500; display: inline-flex; align-items: center; gap: 0.5rem; transition: all 0.2s; font-size: 1rem; cursor: pointer;
}
.btn:hover { background: rgba(255,255,255,0.2); transform: translateY(-2px); }
.btn-primary { background: #ffffff; color: #05070a; border: none; font-weight: 600; }
.btn-primary:hover { background: #e0e0e0; }
.btn-accent { background: var(--accent-blue); color: white; border: none; font-weight: 600; }
.btn-accent:hover { background: var(--accent-blue-hover); }

/* --- TEXT TOOLS --- */
.tool-workspace { display: flex; gap: 2rem; flex: 1; min-height: 50vh; }
.text-panel { flex: 1; display: flex; flex-direction: column; gap: 1rem; }
.text-panel label { font-weight: 500; color: var(--text-dim); letter-spacing: 1px; text-transform: uppercase; font-size: 0.85rem;}
textarea {
    width: 100%; flex: 1; resize: none; background: rgba(0,0,0,0.2); color: white; border: 1px solid rgba(255,255,255,0.15);
    padding: 1.5rem; border-radius: 16px; font-size: 1.5rem; line-height: 1.6; outline: none; transition: border-color 0.3s;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
textarea:focus { border-color: rgba(255,255,255,0.5); }
textarea::placeholder { color: rgba(255,255,255,0.3); font-family: 'Poppins', sans-serif; }
.tool-actions { display: flex; justify-content: center; gap: 1rem; padding-top: 1rem; }

/* --- COLOR PICKER --- */
.color-picker-workspace { display: flex; gap: 2rem; min-height: 450px; }
.image-container {
    flex: 2; border: 1px dashed rgba(255,255,255,0.3); border-radius: 16px; display: flex; align-items: center; justify-content: center;
    overflow: hidden; position: relative; background: rgba(0,0,0,0.2); min-height: 300px;
}
.image-container canvas { max-width: 100%; max-height: 600px; cursor: crosshair; display: none; border-radius: 8px; }
#image-placeholder-text { color: rgba(255,255,255,0.4); font-size: 1.1rem; text-align: center; padding: 2rem; }
.color-history-container { flex: 1; display: flex; flex-direction: column; gap: 1rem; }
.color-list {
    flex: 1; overflow-y: auto; max-height: 600px; display: flex; flex-direction: column; gap: 0.8rem;
    padding: 1rem; border-radius: 16px; background: rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.1);
}
.color-list::-webkit-scrollbar { width: 8px; }
.color-list::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 8px; }
.color-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 8px; }
.color-item {
    padding: 1.5rem; border-radius: 12px; display: flex; flex-direction: column; align-items: center;
    border: 1px solid rgba(255,255,255,0.3); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2); animation: fadeIn 0.3s ease;
}
.color-item .hex { font-size: 1.8rem; font-weight: 700; margin-bottom: 0.2rem; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.color-item .rgb { font-size: 0.95rem; font-weight: 500; opacity: 0.9; }

/* --- SYMBOLS TOOL --- */
.symbols-category { margin-bottom: 2rem; }
.symbols-category h3 { margin-bottom: 1rem; color: var(--text-dim); border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 0.5rem; }
.symbols-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 1rem; }
.symbol-tile {
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: 16px; 
    padding: 2rem 1rem; display: flex; flex-direction: column; align-items: center;
    transition: transform 0.2s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.2s, background 0.2s; cursor: pointer;
}
.symbol-tile:hover { transform: scale(0.92); background: rgba(255,255,255,0.08); box-shadow: inset 0 5px 20px rgba(0,0,0,0.5); }
.symbol-tile .char { font-size: 3rem; margin-bottom: 0.5rem; font-family: system-ui, sans-serif; }
.symbol-tile .name { font-size: 0.85rem; color: var(--text-dim); text-align: center; }

.single-symbol-layout { display: flex; justify-content: center; align-items: stretch; gap: 2rem; margin-top: 2rem; }
.symbol-display {
    flex: 1; max-width: 600px; border-radius: 20px; display: flex; flex-direction: column; align-items: center; 
    justify-content: center; padding: 4rem 2rem; text-align: center;
}
#big-symbol-char { font-size: 10rem; font-family: system-ui, sans-serif; margin-bottom: 2rem; line-height: 1; }

/* --- CALCULATOR EMBEDDED MODAL --- */
.calc-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    z-index: 2000; display: none; align-items: center; justify-content: center;
    animation: fadeIn 0.25s ease forwards;
}
.calc-modal-overlay.active { display: flex; }
.calc-popout-window {
    background: rgba(20, 25, 40, 0.85); border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px; padding: 1.5rem; width: 320px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6); display: flex; flex-direction: column; gap: 1rem;
    position: relative;
}
.calc-popout-header { display: flex; justify-content: space-between; align-items: center; }
.calc-popout-header h3 { font-size: 1.1rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; }
.calc-popout-header h3 img { width: 24px; height: 24px; }
.calc-close-btn { background: rgba(255,255,255,0.1); border: none; color: white; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.calc-close-btn:hover { background: rgba(255,255,255,0.25); }
.calc-display {
    background: rgba(0, 0, 0, 0.3); border-radius: 12px; padding: 1rem;
    text-align: right; font-size: 2.2rem; font-weight: 300; border: 1px inset rgba(255,255,255,0.08);
    overflow-x: auto; white-space: nowrap; color: white;
}
.calc-display::-webkit-scrollbar { display: none; }
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; }
.calc-btn {
    background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.1);
    color: white; border-radius: 12px; padding: 0.9rem 0; font-size: 1.1rem; font-weight: 500;
    cursor: pointer; transition: background 0.1s, transform 0.1s;
}
.calc-btn:active { background: rgba(255,255,255,0.2); transform: scale(0.95); }
.calc-btn.op { background: rgba(59, 130, 246, 0.35); border-color: rgba(59, 130, 246, 0.6); }
.calc-btn.op:active { background: rgba(59, 130, 246, 0.6); }
.calc-btn.clear { background: rgba(239, 68, 68, 0.25); color: #fca5a5; }

/* --- TOOL 6: TIMERS --- */
.timer-header-actions { display: flex; gap: 1rem; justify-content: center; margin-bottom: 1rem; }
.timers-container { 
    display: flex; flex-wrap: wrap; justify-content: center; gap: 1.5rem; 
    max-width: 1100px; margin: 0 auto; width: 100%; transition: all 0.3s ease;
}
.timer-card { 
    background: rgba(0,0,0,0.3); border-radius: 20px; padding: 2rem; display: flex; flex-direction: column; 
    align-items: center; gap: 1.5rem; border: 1px solid rgba(255,255,255,0.1); position: relative;
    flex: 0 1 320px; transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.timers-container.single-timer .timer-card { flex: 1 1 100%; max-width: 700px; padding: 4rem; }
.timers-container.single-timer .timer-display { font-size: 6rem; }
.timers-container.single-timer .timer-display input { font-size: 6rem; width: 150px; }

.timer-remove { position: absolute; top: 15px; right: 15px; background: none; border: none; color: rgba(255,255,255,0.4); font-size: 1.5rem; cursor: pointer; transition: color 0.2s; }
.timer-remove:hover { color: #f87171; }
.timer-display { font-size: 3.5rem; font-weight: 700; font-family: monospace; line-height: 1; display: flex; gap: 0.5rem; align-items: center; transition: all 0.3s ease;}
.timer-display input { 
    background: transparent; border: none; color: white; font-size: 3.5rem; font-weight: 700; font-family: monospace; 
    width: 90px; text-align: center; border-bottom: 2px solid rgba(255,255,255,0.2); outline: none; transition: all 0.3s ease;
}
.timer-display input:focus { border-bottom-color: var(--accent-blue); }
.timer-controls { display: flex; gap: 1rem; width: 100%; justify-content: center;}
.timer-controls button { flex: 1; max-width: 180px; }
.pomodoro-badge { position: absolute; top: 15px; left: 15px; background: rgba(239, 68, 68, 0.2); color: #fca5a5; padding: 0.3rem 0.6rem; border-radius: 8px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }

/* --- TOOL 7: CLOCK APP --- */
#clock-view { position: relative; } 

.clock-app-container {
    position: relative; flex: 1; display: flex; flex-direction: column; border-radius: 24px;
    overflow: hidden; min-height: 60vh; color: var(--clock-text-color, #ffffff);
    transition: color 0.4s ease; border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    isolation: isolate;
}

.clock-app-container:fullscreen { 
    border-radius: 0; 
    border: none; 
    width: 100vw; 
    height: 100vh; 
    margin: 0; 
    padding: 0; 
}
.clock-app-container:fullscreen .clock-custom-bg { border-radius: 0; }

.clock-custom-bg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; 
    border-radius: 24px; transition: background 0.5s ease;
}
.clock-bg-gradient {
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%; animation: clkGradientBG 15s ease infinite;
}
@keyframes clkGradientBG { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

.clock-fs-btn { 
    position: absolute; top: 1.5rem; right: 1.5rem; z-index: 20; 
    color: var(--clock-text-color, #ffffff);
}
.clock-fs-btn i { color: inherit; }

.clock-workspace { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; min-height: 60vh; position: relative; padding: 2rem; z-index: 2; }

.clock-display-tile { 
    padding: 3rem 2rem; border-radius: 32px; text-align: center; display: flex; flex-direction: column; gap: 1rem; 
    width: 100%; max-width: 850px; 
}

.clock-time-text { font-size: clamp(3rem, 8vw, 6rem); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.clock-date-text { font-size: 1.5rem; opacity: 0.8; }

.clock-settings-row { margin-top: 2rem; display: flex; gap: 1rem; }
.clock-tz-select {
    background: rgba(255,255,255,0.1); color: inherit; border: 1px solid rgba(255,255,255,0.2);
    padding: 0.8rem 1.5rem; border-radius: 12px; font-size: 1rem; outline: none; cursor: pointer;
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.clock-tz-select option { background: #05070a; color: white; }

.clock-bottom-left {
    position: absolute; bottom: 1.5rem; left: 1.5rem; display: flex; gap: 1rem; align-items: center; z-index: 10;
    height: 56px; 
}

.clock-bg-selector { padding: 0 1rem; border-radius: 16px; display: flex; gap: 0.8rem; align-items: center; height: 100%; }
.bg-color-btn { width: 32px; height: 32px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.5); cursor: pointer; transition: transform 0.2s; }
.bg-color-btn:hover { transform: scale(1.1); }
.bg-color-picker-wrapper { position: relative; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,0.2); border: 2px solid rgba(255,255,255,0.5); cursor: pointer; overflow: hidden; color: inherit;}
.bg-color-picker-wrapper input[type="color"] { position: absolute; opacity: 0; width: 200%; height: 200%; cursor: pointer; }
.bg-color-picker-wrapper i { font-size: 1.2rem; pointer-events: none; }

.clock-seconds-toggle {
    display: flex; align-items: center; gap: 0.8rem; padding: 0 1rem; border-radius: 16px; height: 100%;
    cursor: pointer; overflow: hidden; width: 56px; 
    transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), background 0.3s;
    white-space: nowrap; border: 1px solid rgba(255,255,255,0.12);
    justify-content: flex-start;
}
.clock-seconds-toggle i { font-size: 1.5rem; width: 24px; display: flex; justify-content: center; flex-shrink: 0; }
.clock-seconds-toggle .sec-label { font-size: 0.8rem; font-weight: 500; opacity: 0; transition: opacity 0.2s; }

.clock-seconds-toggle.hovered, .clock-seconds-toggle:hover { width: 145px; background: rgba(255,255,255,0.15); }
.clock-seconds-toggle.hovered .sec-label, .clock-seconds-toggle:hover .sec-label { opacity: 1; }

.video-ad-popup {
    position: absolute; bottom: 2rem; right: 2rem; width: 300px; height: 170px; border-radius: 16px; 
    background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 10;
    border: 1px solid rgba(255,255,255,0.2); font-size: 0.9rem; color: rgba(255,255,255,0.5);
}
.close-ad-btn {
    position: absolute; top: -10px; right: -10px; width: 30px; height: 30px; border-radius: 50%;
    background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.4); color: white;
    display: flex; align-items: center; justify-content: center; cursor: pointer; backdrop-filter: blur(5px);
}
.close-ad-btn:hover { background: rgba(255,255,255,0.3); }

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh; background: rgba(5, 7, 10, 0.9); backdrop-filter: blur(25px);
    z-index: 999; display: flex; flex-direction: column; padding: 6rem 2rem 2rem 2rem; transform: translateX(100%); transition: transform 0.4s ease;
}
.mobile-menu-overlay.active { transform: translateX(0); }
.mobile-menu-links { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 900px) {
    .tool-workspace, .color-picker-workspace { flex-direction: column; }
    textarea { min-height: 250px; }
    .tool-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .tool-header h2 { font-size: 2rem; }
    .color-list { max-height: 300px; }
    .single-symbol-layout { flex-direction: column; align-items: center; }
    .ad-side { width: 100%; max-width: 728px; min-height: 90px; }
    
    .clock-bottom-left { bottom: 1.5rem; top: auto; left: 50%; transform: translateX(-50%); width: 100%; justify-content: center; }
}
@media (max-width: 768px) {
    .desktop-menu { display: none; }
    .mobile-toggle { display: block; }
    .ad-placeholder { height: 50px; max-width: 320px; }
    .hero h1 { font-size: 2.2rem; }
    .tool-card { transform: none !important; }
    
    .timers-container.single-timer .timer-display input { width: 90px; font-size: 3.5rem; }
    .timers-container.single-timer .timer-display { font-size: 3.5rem; }
    
    .clock-display-tile { padding: 2rem 1rem; width: 90%; }
    .video-ad-popup { display: none; }
}