/* ==========================================
   Simple Start — Premium Navigation Page
   ========================================== */

/* =========================
   1. CSS Variables & Themes
   ========================= */
:root {
    /* Layout */
    --container-width: 92%;
    --max-content-width: 1100px;

    /* Hero */
    --hero-time-size: 4.5rem;
    --hero-time-weight: 200;
    --hero-date-size: 0.9rem;
    --hero-greeting-size: 0.82rem;

    /* Transition */
    --theme-transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme */
html,
html[data-theme="light"] {
    --bg-primary: #f0f4f8;
    --bg-gradient-1: #e8edf5;
    --bg-gradient-2: #f5f0fa;
    --bg-gradient-3: #eef5f0;

    --surface: rgba(255, 255, 255, 0.6);
    --surface-hover: rgba(255, 255, 255, 0.88);
    --surface-border: rgba(255, 255, 255, 0.45);
    --surface-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
    --surface-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.08);
    --surface-shadow-focus: 0 8px 40px rgba(59, 130, 246, 0.12);

    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --text-hero: #1e293b;

    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.08);
    --accent-gradient: linear-gradient(135deg, #3b82f6, #8b5cf6);
    --accent-gradient-vivid: linear-gradient(135deg, #2563eb, #7c3aed);

    --input-bg: rgba(241, 245, 249, 0.8);
    --input-border: rgba(0, 0, 0, 0.05);
    --input-focus-border: rgba(59, 130, 246, 0.35);

    --divider: rgba(0, 0, 0, 0.06);
    --orb-1: rgba(59, 130, 246, 0.1);
    --orb-2: rgba(139, 92, 246, 0.08);
    --orb-3: rgba(16, 185, 129, 0.06);

    --scrollbar-track: transparent;
    --scrollbar-thumb: rgba(0, 0, 0, 0.12);

    --card-hover-border: rgba(59, 130, 246, 0.2);
    --card-hover-glow: 0 0 0 1px rgba(59, 130, 246, 0.1), 0 12px 40px rgba(59, 130, 246, 0.06);

    color-scheme: light;
}

/* Dark Theme */
html[data-theme="dark"] {
    --bg-primary: #0c1222;
    --bg-gradient-1: #0c1222;
    --bg-gradient-2: #151030;
    --bg-gradient-3: #0c1222;

    --surface: rgba(25, 35, 55, 0.6);
    --surface-hover: rgba(30, 42, 65, 0.85);
    --surface-border: rgba(148, 163, 184, 0.08);
    --surface-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    --surface-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.35);
    --surface-shadow-focus: 0 8px 40px rgba(96, 165, 250, 0.15);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-hero: #f8fafc;

    --accent: #60a5fa;
    --accent-hover: #93c5fd;
    --accent-glow: rgba(96, 165, 250, 0.1);
    --accent-gradient: linear-gradient(135deg, #60a5fa, #a78bfa);
    --accent-gradient-vivid: linear-gradient(135deg, #3b82f6, #8b5cf6);

    --input-bg: rgba(15, 23, 42, 0.5);
    --input-border: rgba(148, 163, 184, 0.08);
    --input-focus-border: rgba(96, 165, 250, 0.35);

    --divider: rgba(148, 163, 184, 0.08);
    --orb-1: rgba(96, 165, 250, 0.06);
    --orb-2: rgba(167, 139, 250, 0.05);
    --orb-3: rgba(52, 211, 153, 0.04);

    --scrollbar-track: transparent;
    --scrollbar-thumb: rgba(255, 255, 255, 0.1);

    --card-hover-border: rgba(96, 165, 250, 0.18);
    --card-hover-glow: 0 0 0 1px rgba(96, 165, 250, 0.1), 0 12px 40px rgba(96, 165, 250, 0.05);

    color-scheme: dark;
}

/* =========================
   2. Reset & Base
   ========================= */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    background: var(--bg-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    transition: background var(--theme-transition), color var(--theme-transition);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar {
    width: 0;
}

/* =========================
   3. Animated Background
   ========================= */
.background-overlay {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(160deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 50%, var(--bg-gradient-3) 100%);
    transition: background var(--theme-transition), opacity 1.5s ease;
}

.background-overlay::before,
.background-overlay::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    animation: float 20s ease-in-out infinite;
}

.background-overlay::before {
    width: 700px;
    height: 700px;
    background: var(--orb-1);
    top: -15%;
    right: -10%;
    animation-duration: 28s;
}

.background-overlay::after {
    width: 600px;
    height: 600px;
    background: var(--orb-2);
    bottom: -15%;
    left: -10%;
    animation-duration: 22s;
    animation-delay: -8s;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(40px, -40px) scale(1.06);
    }

    50% {
        transform: translate(-25px, 25px) scale(0.94);
    }

    75% {
        transform: translate(20px, 15px) scale(1.03);
    }
}

/* =========================
   4. Floating Toolbar
   ========================= */
.floating-toolbar {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    z-index: 500;
    animation: toolbarFadeIn 0.8s var(--smooth) 0.3s both;
}

@keyframes toolbarFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================
   5. Layout Container
   ========================= */
.container {
    width: var(--container-width);
    max-width: var(--max-content-width);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    margin: 0 auto;
    height: 100vh;
    padding: 5rem 0 1.5rem;
}

/* =========================
   6. Hero Section
   ========================= */
.hero-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
    animation: heroFadeIn 1s var(--smooth) 0.1s both;
}

@keyframes heroFadeIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Greeting Pill */
.greeting-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: var(--hero-greeting-size);
    font-weight: 500;
    color: var(--text-primary);
    background: rgba(15, 23, 42, 0.25);
    backdrop-filter: blur(30px) saturate(160%);
    -webkit-backdrop-filter: blur(30px) saturate(160%);
    padding: 0.35rem 0.9rem;
    border-radius: 99px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all var(--theme-transition);
    white-space: nowrap;
    animation: pillSlideIn 0.7s var(--smooth) 0.3s both;
}

html[data-theme="light"] .greeting-pill {
    background: rgba(255, 255, 255, 0.45);
    border-color: rgba(255, 255, 255, 0.5);
}

@keyframes pillSlideIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.greeting-pill:hover {
    background: rgba(15, 23, 42, 0.22);
    transform: scale(1.03);
}

html[data-theme="light"] .greeting-pill:hover {
    background: rgba(255, 255, 255, 0.4);
}

#greeting-icon {
    font-size: 0.95rem;
    line-height: 1;
}

/* Time Display */
.time-display {
    text-align: center;
    line-height: 1;
    animation: timeFadeIn 0.9s var(--smooth) 0.2s both;
}

@keyframes timeFadeIn {
    from {
        opacity: 0;
        transform: scale(0.92);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

#time {
    font-size: var(--hero-time-size);
    font-weight: var(--hero-time-weight);
    color: var(--text-hero);
    font-variant-numeric: tabular-nums;
    letter-spacing: -3px;
    line-height: 1;
    transition: color var(--theme-transition);
}

/* Date Text */
.date-text {
    font-size: var(--hero-date-size);
    color: var(--text-tertiary);
    font-weight: 400;
    letter-spacing: 0.3px;
    transition: color var(--theme-transition);
    animation: dateFadeIn 0.8s var(--smooth) 0.4s both;
}

@keyframes dateFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================
   7. Search Section
   ========================= */
.search-section {
    width: 100%;
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 100;
    flex-shrink: 0;
    margin: 1.5rem 0 2.5rem;
    animation: searchSlideIn 0.8s var(--smooth) 0.5s both;
}

@keyframes searchSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-container {
    width: 100%;
    max-width: 560px;
    height: 52px;
    background: rgba(15, 23, 42, 0.25);
    backdrop-filter: blur(30px) saturate(160%);
    -webkit-backdrop-filter: blur(30px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 26px;
    padding: 0 0.6rem 0 1.2rem;
    transition: all 0.4s var(--smooth);
    display: flex;
    align-items: center;
    position: relative;
}

html[data-theme="light"] .search-container {
    background: rgba(255, 255, 255, 0.45);
    border-color: rgba(255, 255, 255, 0.5);
}

.search-container:focus-within {
    background: rgba(15, 23, 42, 0.22);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
    max-width: 620px;
}

html[data-theme="light"] .search-container:focus-within {
    background: rgba(255, 255, 255, 0.4);
    border-color: var(--input-focus-border);
}

/* Engine Selector */
.search-engine-selector {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    user-select: none;
    height: 100%;
    padding-right: 0.8rem;
    white-space: nowrap;
    transition: color 0.2s;
}

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

.selector-arrow {
    opacity: 0.45;
    transition: all 0.25s var(--smooth);
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.search-engine-selector:hover .selector-arrow {
    opacity: 1;
}

.search-engine-selector.active .selector-arrow {
    transform: rotate(180deg);
}

/* Vertical Divider */
.divider-vertical {
    width: 1px;
    height: 20px;
    background: var(--divider);
    margin: 0 0.5rem;
    flex-shrink: 0;
}

/* Engine Dropdown */
.engine-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 130px;
    background: rgba(15, 23, 42, 0.2);
    backdrop-filter: blur(30px) saturate(160%);
    -webkit-backdrop-filter: blur(30px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    opacity: 0;
    transform: translateY(-6px) scale(0.96);
    pointer-events: none;
    visibility: hidden;
    transition: all 0.25s var(--spring);
    z-index: 200;
}

html[data-theme="light"] .engine-dropdown {
    background: rgba(255, 255, 255, 0.35);
    border-color: rgba(255, 255, 255, 0.45);
}

.engine-dropdown.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    visibility: visible;
}

.engine-option {
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: all 0.2s;
    cursor: pointer;
    font-weight: 500;
}

.engine-option:hover {
    background: var(--accent-glow);
    color: var(--accent);
}

.engine-option.active {
    color: var(--accent);
    font-weight: 600;
}

/* Search Input */
#search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    color: var(--text-primary);
    padding: 0 0.6rem;
    outline: none;
    min-width: 0;
    font-family: inherit;
}

#search-input::placeholder {
    color: var(--text-secondary);
    font-weight: 400;
}

/* Search Shortcut Hint */
.search-hint {
    position: absolute;
    right: 60px;
    display: flex;
    align-items: center;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s;
}

.search-container:focus-within .search-hint {
    opacity: 0;
}

.search-hint kbd {
    font-family: inherit;
    font-size: 0.72rem;
    color: var(--text-tertiary);
    background: var(--input-bg);
    border: 1px solid var(--divider);
    border-radius: 5px;
    padding: 0.15rem 0.45rem;
    font-weight: 600;
    line-height: 1.3;
}

/* Search Button */
#search-btn {
    background: var(--accent-gradient-vivid);
    border: none;
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s var(--smooth);
    flex-shrink: 0;
}

#search-btn svg {
    width: 16px;
    height: 16px;
}

#search-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 16px var(--accent-glow);
}

#search-btn:active {
    transform: scale(0.94);
}

/* =========================
   8. Main Content — Bookmarks
   ========================= */
main {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.6rem 1.5rem;
    width: 100%;
}

/* Category Card — Glass */
.category-group {
    background: rgba(15, 23, 42, 0.15);
    backdrop-filter: blur(30px) saturate(160%);
    -webkit-backdrop-filter: blur(30px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 0.5rem 0.4rem;
    transition: all 0.35s var(--smooth);
    opacity: 0;
    transform: translateY(16px);
}

html[data-theme="light"] .category-group {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.35);
}

.category-group.visible {
    opacity: 1;
    transform: translateY(0);
}

.category-group:hover {
    background: rgba(15, 23, 42, 0.22);
    border-color: rgba(255, 255, 255, 0.14);
    transform: translateY(-2px);
}

html[data-theme="light"] .category-group:hover {
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.5);
}

.category-group.visible:hover {
    transform: translateY(-2px);
}

/* Category Title Bar */
.category-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 0.15rem 0.5rem 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.category-title::before {
    content: '';
    display: block;
    width: 3px;
    height: 13px;
    border-radius: 3px;
    background: var(--accent-gradient);
    flex-shrink: 0;
}

/* Colorful category indicators */
.category-group:nth-child(1) .category-title::before {
    background: linear-gradient(180deg, #3b82f6, #06b6d4);
}

.category-group:nth-child(2) .category-title::before {
    background: linear-gradient(180deg, #8b5cf6, #ec4899);
}

.category-group:nth-child(3) .category-title::before {
    background: linear-gradient(180deg, #f59e0b, #ef4444);
}

.category-group:nth-child(4) .category-title::before {
    background: linear-gradient(180deg, #10b981, #14b8a6);
}

.category-group:nth-child(5) .category-title::before {
    background: linear-gradient(180deg, #f43f5e, #fb923c);
}

.category-group:nth-child(6) .category-title::before {
    background: linear-gradient(180deg, #6366f1, #8b5cf6);
}

/* Links Grid — 2 per row */
.links-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.link-item {
    display: flex;
    align-items: center;
    text-decoration: none;
    padding: 0.5rem 0.6rem;
    border-radius: 10px;
    transition: all 0.2s var(--smooth);
    gap: 0.65rem;
}

.link-item:hover {
    background: rgba(255, 255, 255, 0.07);
}

html[data-theme="light"] .link-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

.link-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 6px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.06));
    transition: transform 0.25s var(--spring);
    flex-shrink: 0;
}

.link-item:hover .link-icon {
    transform: scale(1.15);
}

.link-name {
    font-size: 0.88rem;
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
    line-height: 1;
}

.link-item:hover .link-name {
    color: var(--accent);
}

/* =========================
   9. Theme Toggle
   ========================= */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 23, 42, 0.15);
    backdrop-filter: blur(30px) saturate(160%);
    -webkit-backdrop-filter: blur(30px) saturate(160%);
    cursor: pointer;
    transition: all 0.3s var(--smooth);
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1;
}

html[data-theme="light"] .theme-toggle-btn {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.35);
}

.theme-toggle-btn:hover {
    background: rgba(15, 23, 42, 0.22);
    transform: scale(1.1) rotate(15deg);
    color: var(--text-primary);
}

html[data-theme="light"] .theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

.theme-toggle-btn:active {
    transform: scale(0.9);
}

.theme-toggle-btn .icon-sun {
    display: none;
}

.theme-toggle-btn .icon-moon {
    display: block;
}

html[data-theme="dark"] .theme-toggle-btn .icon-sun {
    display: block;
}

html[data-theme="dark"] .theme-toggle-btn .icon-moon {
    display: none;
}

/* =========================
   10. Responsive
   ========================= */
/* Large screens */
@media (min-width: 1440px) {
    :root {
        --max-content-width: 1300px;
        --hero-time-size: 5.2rem;
        --hero-date-size: 0.98rem;
    }

    main {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.2rem;
    }

    .search-container {
        max-width: 680px;
    }

    .search-container:focus-within {
        max-width: 740px;
    }
}

@media (min-width: 1920px) {
    :root {
        --max-content-width: 1560px;
        --hero-time-size: 5.8rem;
        --hero-date-size: 1rem;
    }

    main {
        grid-template-columns: repeat(5, 1fr);
        gap: 1.3rem;
    }

    .search-container {
        max-width: 760px;
    }

    .search-container:focus-within {
        max-width: 820px;
    }
}

@media (min-width: 2560px) {
    :root {
        --max-content-width: 1920px;
        --hero-time-size: 6.5rem;
        --hero-date-size: 1.05rem;
    }

    .container {
        padding: 6rem 0 2rem;
    }

    main {
        grid-template-columns: repeat(6, 1fr);
        gap: 1.5rem;
    }

    .search-container {
        max-width: 860px;
        height: 58px;
    }

    .search-container:focus-within {
        max-width: 920px;
    }

    .link-icon {
        width: 28px;
        height: 28px;
    }

    .link-name {
        font-size: 0.95rem;
    }
}

/* Small screens */
@media (max-width: 1024px) {
    :root {
        --hero-time-size: 3.8rem;
    }

    main {
        gap: 0.75rem;
    }

    .link-item {
        padding: 0.5rem 0.65rem;
    }
}

@media (max-width: 768px) {
    :root {
        --hero-time-size: 3.2rem;
        --hero-date-size: 0.82rem;
    }

    .container {
        padding: 3.5rem 0 1rem;
    }

    main {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.65rem;
    }

    .link-item {
        padding: 0.45rem 0.6rem;
        gap: 0.55rem;
    }

    .link-icon {
        width: 22px;
        height: 22px;
    }

    .link-name {
        font-size: 0.82rem;
    }

    .search-hint {
        display: none;
    }

    .floating-toolbar {
        top: 0.75rem;
        right: 0.75rem;
    }
}

@media (max-width: 480px) {
    :root {
        --hero-time-size: 2.8rem;
        --hero-date-size: 0.75rem;
    }

    .container {
        padding: 2.5rem 0 0.75rem;
    }

    main {
        gap: 0.5rem;
    }

    .category-title {
        font-size: 0.65rem;
        padding-bottom: 0.35rem;
    }

    .link-item {
        padding: 0.4rem 0.55rem;
        gap: 0.5rem;
    }

    .link-icon {
        width: 20px;
        height: 20px;
    }

    .link-name {
        font-size: 0.78rem;
    }

    .search-container {
        height: 48px;
        border-radius: 24px;
    }

    .floating-toolbar {
        gap: 0.4rem;
    }
}

/* =========================
   11. Reduced Motion
   ========================= */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
