/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0a0a0f;
    --surface: #111118;
    --surface2: #1a1a24;
    --border: #2a2a3a;
    --accent: #7c6af7;
    --accent2: #f7a06a;
    --accent3: #6af7c4;
    --text: #e8e8f0;
    --muted: #6b6b8a;
    --font-heading: 'Syne', sans-serif;
    --font-mono: 'Space Mono', monospace;
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-heading);
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    position: relative;
}

/* ===== SCANLINE OVERLAY ===== */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
}

.crt-flicker {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    animation: flicker 0.15s infinite;
    opacity: 0;
}

@keyframes flicker {
    0%   { opacity: 0; }
    5%   { opacity: 0.015; background: rgba(124, 106, 247, 0.01); }
    10%  { opacity: 0; }
    15%  { opacity: 0.02; background: rgba(124, 106, 247, 0.01); }
    20%  { opacity: 0; }
    100% { opacity: 0; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--muted);
}

/* ===== SETTINGS BUTTON ===== */
.settings-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
    font-size: 1.4rem;
    width: 42px;
    height: 42px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* ===== SETTINGS PANEL ===== */
.settings-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    height: 100%;
    background: rgba(10, 10, 15, 0.97);
    backdrop-filter: blur(12px);
    border-left: 1px solid var(--border);
    z-index: 10000;
    transition: right 0.3s ease;
    overflow-y: auto;
}

.settings-panel.open {
    right: 0;
}

.settings-inner {
    padding: 30px;
}

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

.settings-header h2 {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-header h2::before {
    content: '';
    width: 24px;
    height: 1px;
    background: var(--accent);
}

.settings-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.2rem;
    cursor: pointer;
    font-family: var(--font-mono);
    transition: color 0.2s;
}

.settings-close:hover {
    color: var(--text);
}

.settings-section {
    margin-bottom: 25px;
}

.settings-section label,
.settings-section h3 {
    display: block;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 10px;
    font-weight: 400;
}

.settings-section input[type="text"] {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 10px 16px;
    outline: none;
    transition: border-color 0.2s;
}

.settings-section input[type="text"]:focus {
    border-color: var(--accent);
}

.settings-section input[type="text"]::placeholder {
    color: var(--muted);
}

.settings-hint {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
    margin-top: 6px;
}

.toggle-group {
    display: flex;
    gap: 0;
}

.toggle-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 8px 20px;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.5px;
}

.toggle-btn:first-child {
    border-radius: 6px 0 0 6px;
    border-right: none;
}

.toggle-btn:last-child {
    border-radius: 0 6px 6px 0;
}

.toggle-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.toggle-btn:hover:not(.active) {
    border-color: var(--accent);
    color: var(--accent);
}

.add-btn {
    background: none;
    border: 1px dashed var(--border);
    border-radius: 6px;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 8px 16px;
    cursor: pointer;
    width: 100%;
    transition: all 0.15s;
    margin-top: 8px;
    letter-spacing: 0.5px;
}

.add-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.editor-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.editor-row input {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 8px 12px;
    outline: none;
    transition: border-color 0.2s;
}

.editor-row input:focus {
    border-color: var(--accent);
}

.editor-row input::placeholder {
    color: var(--muted);
}

.remove-btn {
    background: none;
    border: 1px solid rgba(255, 50, 50, 0.2);
    border-radius: 6px;
    color: rgba(255, 50, 50, 0.4);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    width: 32px;
    height: 32px;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-btn:hover {
    border-color: rgba(255, 50, 50, 0.5);
    color: #ff5050;
}

/* ===== DASHBOARD ===== */
.dashboard {
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 40px 60px;
    position: relative;
    z-index: 1;
}

/* ===== CLOCK ===== */
.clock-container {
    text-align: center;
    margin-bottom: 8px;
}

.clock {
    font-family: var(--font-mono);
    font-size: clamp(3rem, 6vw, 5rem);
    font-weight: 700;
    letter-spacing: 4px;
    line-height: 1;
    background: linear-gradient(135deg, #e8e8f0 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.date {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
    letter-spacing: 3px;
    margin-top: 10px;
    text-transform: uppercase;
}

/* ===== GREETING ===== */
.greeting {
    text-align: center;
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 35px;
    letter-spacing: -0.3px;
}

/* ===== SEARCH ===== */
.search-container {
    margin-bottom: 40px;
}

.search-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface2);
    padding: 0 16px;
    transition: border-color 0.2s;
}

.search-wrapper:focus-within {
    border-color: var(--accent);
}

.search-prompt {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 1rem;
    margin-right: 10px;
}

#searchInput {
    flex: 1;
    background: none;
    border: none;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 14px 0;
    outline: none;
}

#searchInput::placeholder {
    color: var(--muted);
}

.search-go {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.2rem;
    cursor: pointer;
    font-family: var(--font-mono);
    padding: 5px;
    transition: color 0.2s;
}

.search-go:hover {
    color: var(--accent);
}

/* ===== BOOKMARKS ===== */
.bookmarks-section {
    margin-bottom: 40px;
}

.section-title {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 400;
    color: var(--accent);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    width: 24px;
    height: 1px;
    background: var(--accent);
}

.bookmarks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.bookmark-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    text-decoration: none;
    color: var(--text);
    transition: all 0.15s;
    cursor: pointer;
}

.bookmark-card:hover {
    border-color: var(--accent);
    background: var(--surface2);
    transform: translateY(-2px);
}

.bookmark-icon {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    image-rendering: auto;
}

.bookmark-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.5px;
    color: var(--muted);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.bookmark-card:hover .bookmark-label {
    color: var(--text);
}

/* ===== PANELS ===== */
.panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.panel {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    padding: 20px;
    min-height: 200px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.panel-header .section-title {
    margin-bottom: 0;
}

.refresh-btn {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
    font-size: 1rem;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-family: var(--font-mono);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.refresh-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.refresh-btn.spinning {
    animation: spin 0.6s ease;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== NEWS ===== */
.news-item {
    padding: 12px 0;
    border-bottom: 1px solid rgba(42, 42, 58, 0.5);
    cursor: pointer;
    transition: all 0.1s;
}

.news-item:last-child {
    border-bottom: none;
}

.news-item:hover {
    padding-left: 8px;
}

.news-item a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.news-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 4px;
    transition: color 0.15s;
}

.news-item:hover .news-title {
    color: var(--accent);
}

.news-source {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ===== ROBLOX ===== */
.roblox-game {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(42, 42, 58, 0.5);
}

.roblox-game:last-child {
    border-bottom: none;
}

.roblox-thumb {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    border: 1px solid var(--border);
    object-fit: cover;
}

.roblox-info {
    flex: 1;
    min-width: 0;
}

.roblox-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.roblox-players {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent3);
    display: flex;
    align-items: center;
    gap: 6px;
}

.roblox-players .live-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--accent3);
    border-radius: 50%;
    animation: pulse 2s infinite;
    box-shadow: 0 0 6px rgba(106, 247, 196, 0.4);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ===== LOADING / ERROR ===== */
.loading, .error-msg {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--muted);
    padding: 20px 0;
    text-align: center;
    letter-spacing: 0.5px;
}

.error-msg {
    color: var(--accent2);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .dashboard {
        padding: 40px 20px 30px;
    }

    .greeting {
        font-size: 1rem;
    }

    .panels {
        grid-template-columns: 1fr;
    }

    .bookmarks-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    }

    .settings-panel {
        width: 100%;
        right: -100%;
    }
}

@media (max-width: 480px) {
    .bookmarks-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
