/* ===========================
   NEW TAB — CUSTOM STYLESHEET
   =========================== */

/* ---------- CSS Variables for Theming ---------- */
:root {
    --transition-speed: 0.35s;
}

/* Dark theme (default) */
[data-theme="dark"] {
    --bg-primary: #0f0c29;
    --bg-secondary: #302b63;
    --bg-accent: #24243e;
    --glass-bg: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --text-primary: #ffffff;
    --text-secondary: #b8b8d4;
    --text-muted: #7c7c9a;
    --accent: #a78bfa;
    --accent-hover: #c4b5fd;
    --card-bg: rgba(255, 255, 255, 0.07);
    --card-hover-bg: rgba(167, 139, 250, 0.2);
    --input-bg: rgba(255, 255, 255, 0.08);
    --input-border: rgba(255, 255, 255, 0.15);
    --danger: #f87171;
    --danger-hover: #fca5a5;
    --gradient-start: #0f0c29;
    --gradient-mid: #302b63;
    --gradient-end: #24243e;
}

/* Light theme */
[data-theme="light"] {
    --bg-primary: #f0f0f5;
    --bg-secondary: #e2e0f0;
    --bg-accent: #d8d6eb;
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.8);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a6a;
    --text-muted: #8888a8;
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-hover-bg: rgba(124, 58, 237, 0.12);
    --input-bg: rgba(255, 255, 255, 0.8);
    --input-border: rgba(0, 0, 0, 0.1);
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --gradient-start: #e8e0ff;
    --gradient-mid: #f0f0f5;
    --gradient-end: #d8d6eb;
}

/* ---------- Reset & Base ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-mid), var(--gradient-end));
    color: var(--text-primary);
    transition: background var(--transition-speed) ease, color var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 40px 20px 60px;
    overflow-x: hidden;
}

/* Animated background blobs */
body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.3;
    z-index: -1;
    animation: float 12s ease-in-out infinite alternate;
}

body::before {
    width: 500px;
    height: 500px;
    background: var(--accent);
    top: -150px;
    left: -100px;
}

body::after {
    width: 400px;
    height: 400px;
    background: #f472b6;
    bottom: -100px;
    right: -80px;
    animation-delay: -6s;
}

@keyframes float {
    from { transform: translateY(0) scale(1); }
    to   { transform: translateY(40px) scale(1.08); }
}

/* ---------- Container ---------- */
.container {
    max-width: 720px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

/* ---------- Theme Toggle Button ---------- */
.theme-btn {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 100;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    font-size: 22px;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
    box-shadow: var(--glass-shadow);
}

.theme-btn:hover {
    transform: scale(1.15);
    background: var(--card-hover-bg);
}

/* ---------- Clock Box ---------- */
.clock-box {
    text-align: center;
    padding: 32px 40px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    box-shadow: var(--glass-shadow);
    width: 100%;
    max-width: 500px;
    animation: fadeSlideIn 0.6s ease-out;
}

.greeting {
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.clock {
    font-size: 4rem;
    font-weight: 700;
    letter-spacing: 4px;
    background: linear-gradient(135deg, var(--accent), #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}

.date {
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ---------- Search Bar ---------- */
.search-bar {
    display: flex;
    width: 100%;
    max-width: 500px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--glass-shadow);
    transition: border-color 0.2s ease;
    animation: fadeSlideIn 0.6s ease-out 0.1s both;
}

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

.search-input {
    flex: 1;
    padding: 14px 20px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1rem;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    padding: 14px 18px;
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.search-btn:hover {
    background: var(--card-hover-bg);
}

/* ---------- Bookmarks Grid ---------- */
.bookmarks-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    width: 100%;
    max-width: 500px;
    animation: fadeSlideIn 0.6s ease-out 0.2s both;
}

.card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 12px;
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    text-decoration: none;
    color: var(--text-primary);
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-4px) scale(1.03);
    background: var(--card-hover-bg);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
}

.card-icon {
    font-size: 2rem;
}

.card-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ---------- To-Do Section ---------- */
.todo-section {
    width: 100%;
    max-width: 500px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 24px;
    box-shadow: var(--glass-shadow);
    animation: fadeSlideIn 0.6s ease-out 0.3s both;
}

.todo-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.todo-form {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.todo-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--input-border);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s ease;
}

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

.todo-input::placeholder {
    color: var(--text-muted);
}

.todo-add-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
}

.todo-add-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.08);
}

.todo-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
}

.todo-list::-webkit-scrollbar {
    width: 6px;
}

.todo-list::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    animation: fadeSlideIn 0.3s ease-out;
}

.todo-item.done .todo-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.todo-check {
    width: 20px;
    height: 20px;
    border: 2px solid var(--accent);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s ease;
    color: #fff;
    font-size: 12px;
}

.todo-check:hover {
    background: var(--accent);
}

.todo-text {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-primary);
    word-break: break-word;
}

.todo-delete {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--danger);
    font-size: 1.1rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.todo-delete:hover {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger-hover);
}

/* Empty state */
.todo-empty {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ---------- Quote Box ---------- */
.quote-box {
    text-align: center;
    padding: 20px 28px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    box-shadow: var(--glass-shadow);
    width: 100%;
    max-width: 500px;
    animation: fadeSlideIn 0.6s ease-out 0.4s both;
}

.quote-text {
    font-size: 0.95rem;
    font-style: italic;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ---------- Animations ---------- */
@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Responsive: Mobile ---------- */
@media (max-width: 600px) {
    body {
        padding: 24px 14px 40px;
    }

    .clock {
        font-size: 2.6rem;
    }

    .greeting {
        font-size: 1.1rem;
    }

    .bookmarks-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .card {
        padding: 16px 10px;
    }

    .card-icon {
        font-size: 1.6rem;
    }

    .card-label {
        font-size: 0.75rem;
    }

    .clock-box,
    .search-bar,
    .todo-section,
    .quote-box {
        padding: 18px;
        border-radius: 14px;
    }

    .theme-btn {
        width: 42px;
        height: 42px;
        top: 14px;
        right: 14px;
    }
}
