@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css');


/* =====================================================
   ENDIS - Main Stylesheet
   Educational Learning Platform
   ===================================================== */

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

/* Global font inheritance - ensures ALL elements use Figtree */
body, button, input, select, textarea, a, span, div, p, h1, h2, h3, h4, h5, h6 {
    font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

body {
    font-family: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    padding: 1rem;
    background: var(--accent-primary);
    color: white;
    z-index: 10000;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* =====================================================
   Loading Screen
   ===================================================== */
.loading-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-logo {
    margin-bottom: 2rem;
}

.loading-bar {
    width: 200px;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto 1rem;
}

.loading-progress {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 2px;
    animation: loading 2s ease-in-out infinite;
}

@keyframes loading {
    0% { width: 0; transform: translateX(0); }
    50% { width: 100%; transform: translateX(0); }
    100% { width: 100%; transform: translateX(100%); }
}

.loading-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* =====================================================
   Logo
   ===================================================== */
.logo-text {
    font-family: 'BlocParty Outline', 'Figtree', sans-serif;
    font-weight: 400;
    font-size: 2rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.05rem;
}

.logo-text.small {
    font-size: 1.25rem;
}

.logo-text.large {
    font-size: 3rem;
}

/* =====================================================
   Header
   ===================================================== */
.main-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-header);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-primary);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

/* Navigation */
.main-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--accent-bg);
    color: var(--accent-primary);
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Icon Button */
.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.icon-btn svg {
    width: 20px;
    height: 20px;
}

/* =====================================================
   Hero Section
   ===================================================== */
.hero-section {
    position: relative;
    min-height: calc(100vh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    overflow: hidden;
}

.hero-background {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: -1;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: var(--accent-primary);
    top: -20%;
    left: -10%;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: var(--accent-secondary);
    bottom: -10%;
    right: -10%;
    animation-delay: -7s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: var(--accent-tertiary);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(20px, -20px) scale(1.05); }
    50% { transform: translate(-10px, 30px) scale(0.95); }
    75% { transform: translate(-30px, -10px) scale(1.02); }
}

.hero-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    margin-bottom: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary), var(--accent-tertiary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 3rem;
}

/* =====================================================
   Search Form
   ===================================================== */
.search-form {
    margin-bottom: 3rem;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-input);
    border: 2px solid var(--border-primary);
    border-radius: 1rem;
    transition: all 0.2s ease;
}

.search-input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px var(--accent-bg);
}

.search-icon {
    position: absolute;
    left: 1rem;
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    pointer-events: none;
}

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

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

.search-submit {
    position: absolute;
    right: 0.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary);
    border: none;
    border-radius: 0.75rem;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-submit:hover {
    background: var(--accent-hover);
    transform: translateX(2px);
}

.search-submit svg {
    width: 18px;
    height: 18px;
}

.search-error {
    margin-top: 0.5rem;
    color: var(--error);
    font-size: 0.875rem;
}

/* =====================================================
   Quick Links
   ===================================================== */
.quick-links {
    margin-top: 2rem;
}

.quick-links-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.quick-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 0.75rem;
    max-width: 600px;
    margin: 0 auto;
}

.quick-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-link:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.quick-link img {
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
}

.quick-link span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* =====================================================
   Features Section
   ===================================================== */
.features-section {
    padding: 6rem 1rem;
    background: var(--bg-secondary);
}

.section-title {
    text-align: center;
    margin-bottom: 3rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    padding: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 1rem;
    text-align: center;
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px -10px var(--shadow-color);
}

.feature-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* =====================================================
   Buttons
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-primary);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* =====================================================
   Modal
   ===================================================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 1rem;
    padding: 2rem;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.5rem;
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* =====================================================
   Onboarding
   ===================================================== */
.onboarding-content {
    max-width: 480px;
    text-align: center;
}

.onboarding-slides {
    min-height: 300px;
}

.onboarding-slide {
    display: none;
    animation: fadeIn 0.3s ease;
}

.onboarding-slide.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(10px); }
    to { opacity: 1; transform: translateX(0); }
}

.slide-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

.onboarding-slide h2 {
    margin-bottom: 0.75rem;
}

.onboarding-slide p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.theme-selector,
.cloak-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.theme-option,
.cloak-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-option:hover,
.cloak-option:hover {
    border-color: var(--accent-primary);
}

.theme-option.selected,
.cloak-option.selected {
    border-color: var(--accent-primary);
    background: var(--accent-bg);
}

.theme-preview {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.theme-preview.dark { background: linear-gradient(135deg, #1a1a2e, #16213e); }
.theme-preview.light { background: linear-gradient(135deg, #f8fafc, #e2e8f0); }
.theme-preview.midnight { background: linear-gradient(135deg, #0f0f1a, #1a1a2e); }
.theme-preview.ocean { background: linear-gradient(135deg, #0d1b2a, #1b263b); }
.theme-preview.forest { background: linear-gradient(135deg, #1a2e1a, #2d4a2d); }
.theme-preview.sunset { background: linear-gradient(135deg, #2d1b2d, #4a2d3d); }
.theme-preview.rose { background: linear-gradient(135deg, #2d1a2a, #4a2d42); }
.theme-preview.amber { background: linear-gradient(135deg, #2d2a1a, #4a3d2d); }
.theme-preview.cyan { background: linear-gradient(135deg, #1a2a2d, #2d4a4a); }

.cloak-option img {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
}

.cloak-option span,
.theme-option span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.search-engine-selector {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.search-option {
    display: block;
    cursor: pointer;
}

.search-option input {
    display: none;
}

.search-option .option-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.search-option input:checked + .option-content {
    border-color: var(--accent-primary);
    background: var(--accent-bg);
}

.search-option img {
    width: 24px;
    height: 24px;
}

.onboarding-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-primary);
}

.slide-indicators {
    display: flex;
    gap: 0.5rem;
}

.indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    transition: all 0.2s ease;
}

.indicator.active {
    background: var(--accent-primary);
    transform: scale(1.2);
}

/* =====================================================
   Settings
   ===================================================== */
.settings-content {
    max-width: 600px;
    width: 100%;
    overflow-x: hidden;
}

.settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-primary);
}

.settings-tab {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.settings-tab.active {
    background: var(--accent-bg);
    color: var(--accent-primary);
}

.settings-panel {
    display: none;
}

.settings-panel.active {
    display: block;
}

.setting-group {
    margin-bottom: 1.5rem;
}

.setting-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.setting-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.setting-select,
.setting-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-primary);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.setting-select:focus,
.setting-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.setting-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.setting-toggle > div:first-child {
    flex: 1;
    min-width: 0;
}

.toggle {
    position: relative;
    width: 48px;
    min-width: 48px;
    height: 26px;
    flex-shrink: 0;
}

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

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-tertiary);
    border-radius: 26px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.toggle input:checked + .toggle-slider {
    background: var(--accent-primary);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.theme-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-btn:hover {
    border-color: var(--border-secondary);
}

.theme-btn.active {
    border-color: var(--accent-primary);
    background: var(--accent-bg);
}

.theme-btn .theme-preview {
    width: 48px;
    height: 48px;
}

.theme-btn span {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Confirm Modal */
.confirm-content {
    max-width: 400px;
    text-align: center;
    padding: 2rem;
}

.confirm-message {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* Checkbox Styling */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
    cursor: pointer;
    border-radius: 4px;
}

input[type="checkbox"]:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* About Panel */
.about-content {
    text-align: center;
    padding: 1rem;
}

.about-logo {
    margin-bottom: 1rem;
}

.about-version {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.about-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.about-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.about-links a {
    color: var(--accent-primary);
    font-size: 0.875rem;
}

.about-copyright {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* =====================================================
   Sidebar
   ===================================================== */
.sidebar {
    position: fixed;
    top: 0;
    right: -320px;
    width: 320px;
    height: 100vh;
    background: var(--bg-card);
    border-left: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: right 0.3s ease;
}

.sidebar.open {
    right: 0;
}

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

.sidebar-header h2 {
    font-size: 1.25rem;
}

.sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-close svg {
    width: 18px;
    height: 18px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.sidebar-footer {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--border-primary);
}

.sidebar-footer .btn {
    flex: 1;
}

.bookmarks-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.bookmark-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bookmark-item:hover {
    background: var(--bg-hover);
}

.bookmark-icon {
    width: 24px;
    height: 24px;
    border-radius: 0.25rem;
}

.bookmark-info {
    flex: 1;
    overflow: hidden;
}

.bookmark-title {
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bookmark-url {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bookmark-delete {
    padding: 0.25rem;
    background: transparent;
    border: none;
    border-radius: 0.25rem;
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
}

.bookmark-item:hover .bookmark-delete {
    opacity: 1;
}

.bookmark-delete:hover {
    background: var(--error-bg);
    color: var(--error);
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.empty-state span {
    font-size: 0.875rem;
}

/* =====================================================
   Footer
   ===================================================== */
.main-footer {
    margin-top: auto;
    padding: 2rem 1rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-primary);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-brand {
    margin-bottom: 1rem;
}

.footer-brand p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.footer-links a {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.footer-links a:hover {
    color: var(--accent-primary);
}

.footer-copyright {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* =====================================================
   Toast Notifications
   ===================================================== */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 0.75rem;
    box-shadow: 0 10px 30px -10px var(--shadow-color);
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.toast-out {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--error); }
.toast-info .toast-icon { color: var(--accent-primary); }

.toast-message {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* =====================================================
   Profile Menu & Dropdown
   ===================================================== */
.profile-menu-container {
    position: relative;
}

.profile-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

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

.profile-btn:active {
    transform: scale(0.95);
}

.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-size: 14px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.profile-avatar.logged-in {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    font-weight: 600;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    overflow: hidden;
}

.profile-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#profile-dropdown-content {
    padding: 16px;
}

/* Button active/pressed states */
button:active,
.btn:active,
.icon-btn:active,
.settings-tab:active,
.theme-btn:active,
.btn-small:active,
.btn-primary:active,
.btn-oauth:active {
    transform: scale(0.97);
    opacity: 0.9;
}

/* =====================================================
   Account System Styles
   ===================================================== */
.account-logged-in {
    text-align: center;
}

.account-user {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: 12px;
}

.account-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: white;
    overflow: hidden;
}

.account-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.account-info {
    text-align: center;
}

.account-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.account-email {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.account-provider {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 4px 12px;
    border-radius: 20px;
}

.account-provider i {
    font-size: 12px;
}

.account-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 16px;
}

.btn-small {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.8125rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

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

.btn-small i {
    font-size: 14px;
}

.btn-sync {
    background: var(--accent-primary);
    color: white;
}

.btn-sync:hover {
    background: var(--accent-hover);
}

.btn-logout {
    background: rgba(220, 38, 38, 0.1);
    color: #ef4444;
}

.btn-logout:hover {
    background: rgba(220, 38, 38, 0.2);
}

.backup-section {
    padding-top: 16px;
    border-top: 1px solid var(--border-primary);
}

.backup-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Auth Container */
.auth-container {
    max-width: 360px;
    margin: 0 auto;
}

.auth-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: 10px;
}

.auth-tab-btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-tab-btn:hover {
    color: var(--text-primary);
}

.auth-tab-btn.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: 12px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.875rem;
    background: var(--bg-input);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-bg);
}

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

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 0.875rem;
    font-weight: 600;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-full {
    width: 100%;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-primary);
}

.oauth-buttons {
    display: flex;
    gap: 10px;
}

.btn-oauth {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-oauth:hover {
    background: var(--bg-hover);
    border-color: var(--border-secondary);
}

.btn-oauth i {
    font-size: 16px;
}

.btn-google:hover {
    border-color: #4285f4;
    color: #4285f4;
}

.btn-github:hover {
    border-color: #fff;
}

/* =====================================================
   Responsive Design
   ===================================================== */
@media (max-width: 1024px) {
    .hero-section {
        min-height: auto;
        padding: 3rem 1rem;
    }
    
    .gradient-orb {
        opacity: 0.3;
    }
}

@media (max-width: 768px) {
    .main-nav {
        display: none;
    }
    
    .header-container {
        padding: 0.5rem 1rem;
    }
    
    .quick-links-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .theme-selector,
    .cloak-selector {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .theme-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .settings-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    
    .sidebar {
        width: 100%;
        right: -100%;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .quick-links-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
    }

    .quick-link {
        padding: 0.75rem 0.5rem;
    }

    .quick-link img {
        width: 28px;
        height: 28px;
    }

    .modal-content {
        padding: 1rem;
        max-width: calc(100vw - 2rem);
    }

    .settings-content {
        max-width: 100%;
    }

    .setting-toggle {
        gap: 0.5rem;
    }

    .setting-label {
        font-size: 0.875rem;
    }

    .setting-description {
        font-size: 0.75rem;
    }

    .theme-grid {
        gap: 0.5rem;
    }

    .theme-btn {
        padding: 0.75rem 0.5rem;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn-group .btn {
        width: 100%;
    }
}

/* =====================================================
   Utility Classes
   ===================================================== */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

/* =====================================================
   Toast Notifications
   ===================================================== */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    pointer-events: auto;
    max-width: 350px;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    border-color: #4ade80;
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.1) 0%, var(--bg-secondary) 100%);
}

.toast-success::before {
    content: '✓';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #4ade80;
    color: #000;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.75rem;
}

.toast-error {
    border-color: #ef4444;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, var(--bg-secondary) 100%);
}

.toast-error::before {
    content: '✕';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #ef4444;
    color: #fff;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.75rem;
}

.toast-info {
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, var(--bg-secondary) 100%);
}

.toast-info::before {
    content: 'ℹ';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--accent-primary);
    color: #fff;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.85rem;
}

.toast span {
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.4;
}

@media (max-width: 640px) {
    .toast-container {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }
    
    .toast {
        max-width: none;
    }
}

/* =====================================================
   Ad Container Styles
   ===================================================== */
.ad-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 16px auto;
    min-height: 50px;
    overflow: hidden;
}

.ad-container.ad-loading {
    background: transparent;
    border-radius: 8px;
}

@keyframes adPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.3; }
}

.ad-container.ad-loaded {
    animation: none;
    background: transparent;
}

.ad-container.ad-failed {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.ad-wrapper {
    max-width: 100%;
    overflow: hidden;
}

/* Desktop ad banner */
.ad-banner-desktop {
    display: flex;
}

/* Mobile ad banner */
.ad-banner-mobile {
    display: none;
}

@media (max-width: 768px) {
    .ad-banner-desktop {
        display: none;
    }
    .ad-banner-mobile {
        display: flex;
    }
}

/* New tab page ad */
.ntp-ad-container {
    margin-top: 24px;
    text-align: center;
}

/* Sidebar ads */
.sidebar-ad {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
}

.sidebar-ad-left {
    left: 10px;
}

.sidebar-ad-right {
    right: 10px;
}

@media (max-width: 1199px) {
    .sidebar-ad {
        display: none !important;
    }
}

/* Footer ad */
.footer-ad {
    margin: 24px auto;
    max-width: 100%;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-primary);
}

/* Medium rectangle ad */
.ad-medium-rectangle {
    min-height: 250px;
    max-width: 300px;
    margin: 16px auto;
}

/* Sidebar ads - Wide screens (>1200px, covers Chromebooks at 1366px) */
.sidebar-ad {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
    width: 160px;
    min-height: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 8px;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

.sidebar-ad-left {
    left: 10px;
}

.sidebar-ad-right {
    right: 10px;
}

.sidebar-ad.ad-failed {
    display: none !important;
}

/* Hide the entire sidebar wrapper when child ad fails */
.sidebar-ad-container:has(.ad-failed) {
    display: none !important;
}

/* Hide sidebar ads on smaller screens */
@media (max-width: 1199px) {
    .sidebar-ad {
        display: none !important;
    }
}

/* Adjust main content when sidebars are visible */
@media (min-width: 1200px) {
    .main-content-with-sidebars {
        max-width: calc(100% - 360px);
        margin: 0 auto;
    }
}

/* Grid ad row styling */
.grid-ad-row {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    margin: 16px 0;
    border-top: 1px solid var(--border-primary);
    border-bottom: 1px solid var(--border-primary);
    background: var(--bg-secondary);
    border-radius: 8px;
}

.grid-ad-row.ad-failed,
.grid-ad-row:empty {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Ad loading animation */
.ad-container.ad-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: adShimmer 1.5s infinite;
}

@keyframes adShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Ensure ad wrapper respects max-width */
.ad-wrapper {
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-wrapper iframe {
    max-width: 100%;
    border: none;
}
