/* Touch device optimizations */
body {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* Disable text selection on menu triggers */
.shortcut-menu-button,
.context-menu-trigger {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

/* Prevent text selection on most elements */
* {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow text selection in input fields and textareas */
input,
textarea,
[contenteditable] {
    -webkit-user-select: text !important;
    -khtml-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

/* Ensure buttons and interactive elements are not selectable */
button, a, .btn, [role="button"], .clickable {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

:root {
 /* Default theme variables (light) */
 --bg-color: #f8f9fa;
 --text-color: #212529;
 --text-secondary: #495057;
 --border-color: #dee2e6;
 --card-bg: #ffffff;
 --card-hover-bg: #f1f3f5;
 --button-bg: #e9ecef;
 --button-hover-bg: #dee2e6;
 --button-active-bg: #495057;
 --sidebar-bg: #ffffff;
 --accent-color: #42a5f5;
 --accent-hover: #64b5f6;
 --accent-active: #1e88e5;
 --text-on-accent: #ffffff;
 --hover-color: rgba(0, 0, 0, 0.05);
 --shadow: rgba(0, 0, 0, 0.1);
 --disclaimer-bg: rgba(255, 255, 255, 0.9);
 --active-button-text: #ffffff;
 --warning-color: #ffc107;
 --danger-color: #f44336;
 --button-text: #000000;
}


/* Light Theme - Clean & Minimal */
body.light-theme {
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --text-secondary: #495057;
    --border-color: #dee2e6;
    --card-bg: #ffffff;
    --card-hover-bg: #f1f3f5;
    --button-bg: #e9ecef;
    --button-hover-bg: #dee2e6;
    --button-active-bg: #495057;
    --sidebar-bg: #ffffff;
    --accent-color: #42a5f5; /* Blue for better visibility */
    --accent-hover: #64b5f6; /* Slightly lighter blue for hover */
    --accent-active: #1e88e5; /* Slightly darker blue for active state */
    --text-on-accent: #ffffff; /* White text for better contrast */
    --hover-color: rgba(0, 0, 0, 0.05);
    --shadow: rgba(0, 0, 0, 0.1);
    --disclaimer-bg: rgba(255, 255, 255, 0.95);
    --active-button-text: #ffffff; /* White text for better contrast on dark accent */
    --warning-color: #ff9800;
    --danger-color: #f44336;
    --button-text: #FFFFFF; /* Black text for buttons on light background */

}



body.light-theme .letter-header-square {
    background-color: var(--accent-color);
    color: var(--active-button-text);
}

/* Dark Theme - Default */
body.dark-theme {
    /* Default theme variables (dark) */
    --bg-color: #181818; /* Darker grey */
    --text-color: #ffffff;
    --text-secondary: #aaaaaa; /* Lighter grey for secondary text */
    --border-color: rgba(255, 255, 255, 0.1); /* Slightly less opaque white */
    --card-bg: #282828; /* Slightly lighter grey for cards */
    --card-hover-bg: #383838; /* Hover for cards */
    --button-bg: rgba(255, 255, 255, 0.1); /* Button background */
    --button-hover-bg: rgba(255, 255, 255, 0.15); /* Button hover */
    --button-active-bg: #ffffff; /* White for active elements (like category) */
    --sidebar-bg: #202020; /* Sidebar background */
    --accent-color: #42a5f5; /* Updated blue accent */
    --accent-hover: #64b5f6; /* Slightly lighter blue for hover */
    --accent-active: #1e88e5; /* Slightly darker blue for active state */
    --text-on-accent: #ffffff; /* White text for better contrast on accent */
    --hover-color: rgba(255, 255, 255, 0.08); /* Subtle white overlay on hover */
    --shadow: rgba(0, 0, 0, 0.5); /* Darker shadow for more depth */
    --disclaimer-bg: rgba(50, 50, 50, 0.9); /* Darker disclaimer */
    --active-button-text: #000000; /* Black text on white accent */
    --warning-color: #ffc107; /* Brighter warning color */
    --danger-color: #f44336; /* Standard red for errors */
    --button-text: #000000; /* Black text for buttons on light background */
}



/**************************************************************
 * GLOBAL & BASE STYLES
 **************************************************************/

 * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    font-family: 'Inter', sans-serif;
    color: var(--text-color);
    min-height: 100vh;
    transition: all 0.3s ease;
    overflow-x: hidden;
}

.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 5px; /* Removed top padding, kept side padding */
}


/**************************************************************
 * MAIN LAYOUT
 **************************************************************/

main {
    display: flex;
    gap: 30px;
    min-height: calc(100vh - 200px);
}

.content-area {
    flex: 1;
}


/**************************************************************
 * HEADER
 **************************************************************/

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    position: -webkit-sticky; /* For Safari */
    position: sticky;
    top: 0;
    z-index: 1000; /* Ensure it's above other content */
    background-color: var(--bg-color); /* Match body background to prevent transparency */
    transition: background-color 0.3s ease; /* Smooth transition for theme changes */
}

.logo-title-container {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    background: var(--card-bg);
    border: 5px solid var(--border-color);
    border-radius: 12px;
    padding: 8px 16px 0;
    transition: all 0.2s ease;
    cursor: pointer;
    height: 56px;
    box-sizing: border-box;
    min-width: 200px;
    width: 100%;
    max-width: 200px;
    user-select: none;
}

.logo-title-container:hover {
    background: var(--button-hover-bg);
    transform: translateY(-1px);
}

.logo-title-container:active {
    background: var(--button-active-bg);
    transform: translateY(0);
}

.logo-title-container .app-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    pointer-events: none; /* Ensure clicks go through to container */
}

.logo-title-container .app-title {
    font-family: 'League Spartan', sans-serif;
    font-size: 2rem;
    font-weight: 600;
    margin: 2px 0 0 0;
    color: var(--text-color);
    white-space: nowrap;
    line-height: 1.2;
    display: inline-block;
    vertical-align: middle;
    padding-bottom: 4px;
    pointer-events: none; /* Ensure clicks go through to container */
}

.header-controls {
    display: flex;
    gap: 15px; /* Equal gap between header controls */
    align-items: center;
    flex-shrink: 0;
}

.edit-toggle {
    background: var(--button-bg);
    border: 5px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-color);
    position: relative;
    width: auto;
    min-width: 56px; /* Match the height */
    height: auto;
    min-height: 56px; /* Match the All dropdown */
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.edit-toggle:hover {
    background: var(--button-hover-bg);
}

.edit-toggle.active {
    background: var(--accent-color);
    color: var(--active-button-text);
}

.edit-toggle .material-icons {
    position: absolute;
    transition: all 0.3s ease;
}

.edit-toggle .edit-icon {
    opacity: 1;
    transform: rotate(0deg);
}

.edit-toggle .done-icon {
    opacity: 0;
    transform: rotate(-90deg);
}

.edit-toggle.active .edit-icon {
    opacity: 0;
    transform: rotate(90deg);
}

.edit-toggle.active .done-icon {
    opacity: 1;
    transform: rotate(0deg);
}

.hamburger-menu {
    background: var(--button-bg);
    border: 5px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    width: auto;
    min-width: 56px; /* Match the height */
    height: auto;
    min-height: 56px; /* Match the All dropdown */
    padding: 12px 16px; /* Match the padding of All dropdown */
    box-sizing: border-box;
}

.hamburger-menu:hover {
    background: var(--button-hover-bg);
}


/**************************************************************
 * SEARCH
 **************************************************************/

.search-container {
    flex: 1;
    margin: 0 15px 0 30px; /* Reduced side margins for equal spacing */
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: transparent;
    transition: all 0.2s ease;
    z-index: 900; /* Lower than flyout */
    min-width: 0; /* Allows the container to shrink below its content size */
}

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--card-bg);
    padding: 8px 16px;
    width: 100%;
    border: 5px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.search-bar:focus-within {
    box-shadow: 0 2px 12px rgba(66, 165, 245, 0.2);
    border-color: var(--border-color);
    outline: none;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 16px;
    outline: none;
    padding: 8px 0;
    margin-right: 8px;
}

.search-input:focus {
    outline: none;
}

.search-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.8;
}

.search-toggle-button {
    background: none;
    border: none;
    padding: 4px;
    margin-right: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
    position: relative;
    width: 32px;
    height: 32px;
}

.search-toggle-button:hover {
    background-color: var(--button-hover-bg);
}

.search-icon,
.back-icon {
    color: var(--text-secondary);
    font-size: 20px;
    position: absolute;
    transition: all 0.2s ease;
    opacity: 0;
    transform: scale(0.8);
}

.search-icon {
    opacity: 1;
    transform: scale(1);
    transition: all 0.2s ease;
}

.search-bar.active .search-icon {
    opacity: 0;
    transform: scale(0.8);
}

.search-bar.active .back-icon {
    opacity: 1;
    transform: scale(1);
}

.search-submit-button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.search-submit-button:hover {
    background-color: var(--button-hover-bg);
}

.search-bar.active .search-submit-button {
    display: flex;
}

/* Fix hover states on touch devices */
@media (hover: none) and (pointer: coarse) {
    .search-toggle-button:hover,
    .search-submit-button:hover,
    .search-toggle-button:active,
    .search-submit-button:active {
        background: transparent !important;
        transform: none !important;
        box-shadow: none !important;
    }

    /* Reset any active states after touch */
    .search-toggle-button:active,
    .search-submit-button:active {
        opacity: 0.7;
    }

    /* Reset hover states when search is not active */
    .search-toggle-button:not(.active):hover,
    .search-toggle-button:not(.active):active {
        background: transparent !important;
    }
}


/**************************************************************
 * SEARCH RESULTS
 **************************************************************/

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-radius: 12px;
    max-height: 500px;
    overflow: auto;
    z-index: 1002;
    border: 5px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: calc(100% + 10px); /* Account for border width */
    margin-left: -5px; /* Align with search bar border */
    box-sizing: border-box;
    padding: 12px 0;
    display: none;
}

#searchInput:focus~.search-results,
.search-results:focus-within,
.search-container:focus-within .search-results {
    max-height: 500px;
    opacity: 1;
    padding: 12px 0 !important;
    border-radius: 12px;
    overflow-y: auto;
}

.search-section {
    padding: 12px 16px;
}

.search-section:not(:first-child) {
    border-top: 1px solid var(--border-color);
}

.section-title {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding: 0 4px;
}

.search-shortcuts {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.search-shortcut {
    background: var(--button-bg);
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text-color);
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    border: 1px solid var(--border-color);
}

.search-shortcut:hover {
    background: var(--button-hover-bg);
    text-decoration: none;
}

.search-shortcut-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-color);
    font-size: 14px;
    flex-shrink: 0;
}

.search-shortcut-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.no-results {
    color: var(--text-secondary);
    text-align: center;
    padding: 16px;
    font-size: 14px;
}


/**************************************************************
 * CATEGORIES SIDEBAR (Desktop)
 **************************************************************/

.categories-container {
    min-width: 200px;
    background: var(--card-bg);
    border: 5px solid var(--border-color);
    border-radius: 12px;
    padding: 10px;
    transition: all 0.3s ease;
    position: -webkit-sticky; /* For Safari */
    position: sticky;
    top: 72px; /* Assuming header height is approx 72px */
    height: calc(100vh - 112px); /* Adjusted height */
    overflow-y: auto;
    align-self: flex-start;
    margin-bottom: 20px; /* This provides the visible margin */
}

.categories-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.category-button-container {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.category-button {
    background: transparent;
    border: none;
    padding: 10px 15px;
    margin: 5px 0;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    width: 100%;
    color: var(--category-text, var(--text-color));
    transition: all 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.category-button.active {
    background: var(--category-active-bg, var(--accent-color));
    color: var(--category-active-text, var(--button-text)) !important;
    font-weight: 600;
}

.category-button:not(.active):hover {
    background: var(--category-hover-bg, var(--hover-color));
    color: var(--category-hover-text, var(--text-color)) !important;
}

.category-button.active:hover {
    background: var(--category-active-hover, var(--accent-hover));
    color: var(--category-active-text, var(--button-text)) !important;
}

.category-button.home-category {
    position: relative;
    padding-right: 30px; /* Make room for the icon */
}

.category-button.home-category::after {
    content: 'home';
    font-family: 'Material Icons';
    display: inline-block;
    margin-left: 4px;
    font-size: 1rem;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.category-more-button {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: inherit; /* Inherit color from parent */
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    opacity: 1;
    transition: opacity 0.2s, background-color 0.2s, color 0.2s;
}

.category-button-container:hover .category-more-button,
.category-button.active+.category-more-button {
    opacity: 1;
}

.category-more-button:hover {
    background-color: var(--button-hover-bg);
}

.category-button.active+.category-more-button {
    color: var(--category-active-text, var(--button-text));
}

.category-button.active+.category-more-button:hover {
    background-color: var(--category-active-hover, var(--accent-hover));
    color: var(--category-active-text, var(--button-text));
}

.add-category-btn {
    background: var(--button-bg);
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    width: 100%;
}

.add-category-btn:hover {
    background: var(--button-hover-bg);
}


/**************************************************************
 * SHORTCUTS CONTAINER & GRID
 **************************************************************/

.shortcuts-container {
    background: var(--card-bg);
    border: 5px solid var(--border-color);
    border-radius: 12px;
    padding: 20px 20px 120px 20px; /* Added more padding at the bottom */
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: -webkit-sticky; /* For Safari */
    position: sticky;
    top: 72px; /* Align with categories-container */
    height: calc(100vh - 112px); /* Match categories-container adjusted height */
    overflow-y: auto;
    align-self: flex-start;
    margin-bottom: 20px; /* This provides the visible margin */
    scrollbar-gutter: stable;
    contain: layout style;
    transform: translateZ(0);
    will-change: transform;
}

/* Custom scrollbar styling for shortcuts container only */
.shortcuts-container::-webkit-scrollbar {
    width: 14px;
}

.shortcuts-container::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 11px; /* Match inner container radius */
}

.shortcuts-container::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 11px; /* Match container border radius */
    opacity: 0.4;
    border: 2px solid transparent;
    background-clip: content-box; /* Creates padding effect */
}

.shortcuts-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-color);
    opacity: 0.6;
    background-clip: content-box;
}

.shortcuts-container::-webkit-scrollbar-corner {
    background: transparent;
    border-radius: 11px; /* Match container corners */
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 30px;
}

/* Center grid items when a category is selected */
.category-selected .shortcuts-grid {
    justify-items: center;
    justify-content: center;
}

.letter-header-square {
    width: 80px;
    height: 80px;
    background: var(--accent-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color); /* Dark text on accent */
    font-size: 2rem;
    font-weight: 600;
    margin: 20px 0 16px 0;
    box-shadow: 0 2px 8px var(--shadow); /* Use theme shadow */
    grid-column: 1;
    cursor: pointer;
}

.letter-header-square:hover {
    background: var(--accent-hover);
    transform: translateY(-4px);
    box-shadow: 0 6px 16px var(--accent-shadow);
}

.empty-category-message {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.empty-category-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: var(--card-hover-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.empty-category-icon .material-icons {
    font-size: 36px;
    color: var(--accent-color);
}

.empty-category-message p {
    margin: 0;
    font-size: 1.1rem;
    max-width: 300px;
    line-height: 1.5;
}


/**************************************************************
 * INDIVIDUAL SHORTCUT ITEMS
 **************************************************************/

.shortcut-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s ease;
    padding: 8px;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    width: 96px;
    height: 104px;
    justify-content: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px var(--shadow);
}

.shortcut-item:hover {
    background: var(--card-hover-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow);
    border-color: var(--accent-color);
}

.shortcut-item.first-in-letter {
    grid-column: 1;
    margin-top: 0;
}

.shortcut-icon {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    background: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    overflow: hidden;
    position: relative;
    transition: all 0.2s ease;
    border: none !important;
    box-shadow: none !important;
}

.shortcut-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0px;
}

.shortcut-name {
    font-size: 0.68rem;
    font-weight: 500;
    text-align: center;
    max-width: 72px;
    word-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.5;
}

/* Edit Mode Styles for Shortcuts */
body.editing .shortcut-item {
    cursor: default;
    pointer-events: auto; /* Keep pointer events for menu button */
}

body.editing .shortcut-item:hover {
    transform: none; /* Remove hover lift effect in edit mode */
}

body.editing .shortcut-menu-button {
    opacity: 1;
    transform: scale(1);
}

.shortcut-menu-button {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border: none;
    background: #000000;
    color: #ffffff;
    border-radius: 50%;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.shortcut-menu-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: var(--menu-button-bg);
    color: var(--menu-button-text);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
    line-height: 1;
}

.shortcut-menu-btn:hover {
    background: var(--menu-button-hover-bg);
    transform: scale(1.1);
}

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


/**************************************************************
 * ADD SHORTCUT BUTTON
 **************************************************************/

.add-shortcut-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 16px;
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 2px dashed var(--border-color);
    width: fit-content;
    margin-bottom: 10px;
}

.add-shortcut-item:hover {
    border-color: var(--accent-color);
    background: var(--card-hover-bg);
}

.add-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: var(--button-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.add-shortcut-item:hover .add-icon {
    background: var(--accent-color);
}

.plus-icon {
    font-size: 2rem;
    color: var(--text-secondary);
}

.add-shortcut-item:hover .plus-icon {
    color: var(--text-on-accent);
}




/* ==========================================================================
   Dialog Styles
   ========================================================================== */

   .dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.dialog-overlay.active {
    display: flex;
}

.dialog {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 10px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px var(--shadow);
}

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

.dialog-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.dialog-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.3s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.dialog-close:hover {
    color: var(--text-color);
    background-color: var(--button-hover-bg);
}

.dialog-mode-switcher {
    display: flex;
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden; /* To make sure child button borders don't stick out */
    border: 1px solid var(--border-color);
}

.dialog-mode-btn {
    flex-grow: 1;
    padding: 10px 15px;
    background-color: transparent;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

.dialog-mode-btn:last-child {
    border-right: none;
}

.dialog-mode-btn.active {
    background-color: var(--accent-color);
    color: var(--text-on-accent);
    font-weight: 600;
}

.dialog-mode-btn:not(.active):hover {
    background-color: var(--button-hover-bg);
    color: var(--text-color);
}


/* ==========================================================================
   Form & Input Styles
   ========================================================================== */

.dialog-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
    transition: all 0.3s ease;
}

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

#editShortcutUrl {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg, var(--bg-color));
    color: var(--text-color);
    font-size: 1rem;
    transition: all 0.3s ease;
    margin-top: 8px;
}

#editShortcutUrl:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--focus-ring);
    outline: none;
}

#existingSiteSelect {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 0.9rem;
}

.categories-checklist {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
}

.category-checkbox-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.category-checkbox-item:hover {
    background: var(--card-hover-bg);
}

.category-checkbox-item input[type="checkbox"] {
    margin-right: 8px;
    accent-color: var(--accent-color);
}

.category-checkbox-item label {
    cursor: pointer;
    flex: 1;
    color: var(--text-color);
    font-size: 0.9rem;
}

.character-counter {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: right;
    margin-top: -4px;
    transition: color 0.3s ease;
}

.character-counter.warning {
    color: var(--warning-color);
}

.character-counter.danger {
    color: var(--error-color);
}


/* ==========================================================================
   Button Styles
   ========================================================================== */

.dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

.dialog-buttons .button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.dialog-buttons .button.primary {
    background-color: var(--accent-color);
    color: var(--text-on-accent);
}

.dialog-buttons .button.primary:hover {
    background-color: var(--accent-hover);
}

.dialog-buttons .button .material-icons {
    font-size: 18px;
}

.dialog-cancel,
.dialog-add {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.dialog-cancel {
    background: var(--button-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.dialog-cancel:hover {
    background: var(--button-hover-bg);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px var(--shadow);
}

.dialog-cancel:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px var(--shadow);
}

.dialog-add {
    background: var(--accent-color);
    color: var(--active-button-text);
    font-weight: 600;
    border: 1px solid transparent;
}

.dialog-add:hover {
    background: var(--accent-hover);
    color: var(--active-button-text);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px var(--shadow);
}

.dialog-add:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px var(--shadow);
}

.dialog-add:disabled {
    background: var(--text-secondary) !important;
    cursor: not-allowed !important;
    opacity: 0.5 !important;
    pointer-events: none;
}

.dialog-add:disabled:hover {
    background: var(--text-secondary) !important;
    transform: none;
}


/* ==========================================================================
   Import Statistics Styles
   ========================================================================== */

.import-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.import-stat {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

.import-stat.success {
    border-left: 4px solid #4CAF50;
}

.import-stat.info {
    border-left: 4px solid #2196F3;
}

.import-stat.warning {
    border-left: 4px solid #FFC107;
}

.import-stat .material-icons {
    font-size: 24px;
    margin-right: 16px;
}

.import-stat.success .material-icons {
    color: #4CAF50;
}

.import-stat.info .material-icons {
    color: #2196F3;
}

.import-stat.warning .material-icons {
    color: #FFC107;
}

.stat-details {
    display: flex;
    flex-direction: column;
}

.stat-count {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}


/* ==========================================================================
   Jump Dialog Styles
   ========================================================================== */

.jump-dialog {
    max-width: 500px;
    width: 90%;
    padding: 24px;
}

.jump-dialog .dialog-header {
    margin-bottom: 16px;
}

.jump-dialog h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-color);
}

.jump-letters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 12px;
    margin: 0;
    padding: 8px 0;
}

.jump-letter {
    aspect-ratio: 1;
    background: var(--button-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-color);
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.jump-letter:hover {
    background: var(--card-hover-bg);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.jump-letter.has-sites {
    background: var(--accent-color);
    color: var(--text-on-accent);
    border-color: var(--accent-color);
}

.jump-letter:disabled {
    background: var(--card-bg);
    color: var(--text-secondary);
    border-color: var(--border-color);
    cursor: not-allowed;
    opacity: 0.5;
}

.jump-letter:disabled:hover {
    background: var(--card-bg);
    border-color: var(--border-color);
    transform: none;
}


/* ==========================================================================
   Context Menu Styles
   ========================================================================== */

.context-menu {
    position: fixed;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px var(--shadow);
    z-index: 9999; /* Very high z-index to ensure it appears above everything */
    min-width: 200px;
    padding: 8px 0;
    display: none;
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    transform: translateZ(0); /* Force hardware acceleration */
    will-change: transform; /* Optimize for animations */
}

.context-menu.active {
    display: block;
}

.context-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    color: var(--text-color);
    font-size: 0.9rem;
    position: relative;
}

.context-menu-item:hover {
    background: var(--card-hover-bg);
}

.context-menu-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.context-menu-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.material-icons.context-menu-icon {
    font-size: 1.1rem;
    margin-right: 2px;
}

.context-menu-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 4px 0;
}

.context-menu-expandable {
    position: relative;
}

.context-menu-expandable .context-menu-text {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.context-menu-expandable:hover {
    background: var(--card-hover-bg);
}

.multiselect-arrow {
    font-size: 18px;
    transition: transform 0.2s ease;
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.context-menu-expandable.open .multiselect-arrow {
    transform: rotate(180deg);
}

.multiselect-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 4px 12px var(--shadow);
    z-index: 1002;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.multiselect-options.show,
.multiselect-options.active {
    display: block;
}

.multiselect-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.multiselect-option:hover {
    background: var(--card-hover-bg);
}

.multiselect-option input[type="checkbox"] {
    margin-right: 8px;
    accent-color: var(--accent-color);
}

.multiselect-option label {
    cursor: pointer;
    flex: 1;
    color: var(--text-color);
    font-size: 0.8rem;
}


/* ==========================================================================
   Theme Toggle Styles
   ========================================================================== */

.theme-toggle-container {
    position: relative;
}

.theme-options {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 16px var(--shadow);
    padding: 8px;
    min-width: 160px;
    z-index: 1000;
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.theme-options.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.9rem;
    text-align: left;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.theme-option:hover {
    background: var(--button-hover-bg);
}

.theme-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 8px;
}


/* ==========================================================================
   Miscellaneous Styles
   ========================================================================== */

/* Site Tooltip Code */
/* (No specific classes were provided for site tooltips in the original code) */


/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--card-bg);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-color);
}





/* ==========================================================================
   Animation Classes & Keyframes
   ========================================================================== */

   .fade-in {
    animation: fadeIn 0.3s ease-in;
}

.scale-in {
    animation: scaleIn 0.2s ease-out;
}

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-5px) scale(1.05);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}


/* ==========================================================================
   General Editing State Styles
   ========================================================================== */

.editing-element {
    display: none;
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.3s ease;
}

body.editing .editing-element {
    display: flex;
    opacity: 1;
    transform: scale(1);
}


/* ==========================================================================
   Scrollable Checklist Styles
   ========================================================================== */

.sites-checklist,
.scrollable-checklist {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    background-color: var(--bg-color);
    scrollbar-gutter: stable;
}

.sites-checklist .form-group {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    padding: 6px;
    border-radius: 4px;
    transition: background-color 0.2s ease-in-out;
}

.sites-checklist .form-group:hover {
    background-color: var(--button-hover-bg);
}

.sites-checklist input[type="checkbox"] {
    margin-right: 10px;
    width: 16px;
    height: 16px;
    accent-color: var(--accent-color);
}

.sites-checklist label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    flex-grow: 1;
}

/* Existing sites checklist container */
.existing-sites-checklist {
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    padding: 8px 12px;
    margin: 0;
    box-sizing: border-box;
}

/* List items in existing sites checklist */
.existing-sites-checklist .site-item {
    display: flex;
    align-items: center;
    width: 100%;
    margin: 0 0 8px 0;
    padding: 12px 16px;
    border-radius: 8px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    cursor: pointer;
    box-sizing: border-box;
}

.sites-checklist .site-item:hover {
    background-color: var(--button-hover-bg);
}

/* Checkbox styles for existing sites checklist */
.existing-sites-checklist .site-checkbox {
    width: 18px;
    height: 18px;
    margin: 0 12px 0 0;
    accent-color: var(--accent-color);
    cursor: pointer;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.existing-sites-checklist .site-checkbox:checked {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

/* Label container for existing sites checklist */
.existing-sites-checklist .site-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    flex-grow: 1;
    min-width: 0;
    gap: 12px;
}

/* Site icon for existing sites checklist */
.existing-sites-checklist .site-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Site favicon */
.existing-sites-checklist .site-favicon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* Site name for existing sites checklist */
.existing-sites-checklist .site-name {
    font-size: 0.95rem;
    color: var(--text-color);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}

/* Hover effect for list items */
.existing-sites-checklist .site-item:hover {
    background-color: var(--button-hover-bg);
    border-color: var(--accent-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Active/focus state for better accessibility */
.existing-sites-checklist .site-item:active,
.existing-sites-checklist .site-item:focus-within {
    background-color: var(--card-hover-bg);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(66, 165, 245, 0.2);
}

/* Scrollbar styling */
.existing-sites-checklist::-webkit-scrollbar {
    width: 6px;
}

.existing-sites-checklist::-webkit-scrollbar-track {
    background: transparent;
}

.existing-sites-checklist::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 3px;
}

.existing-sites-checklist::-webkit-scrollbar-thumb:hover {
    background: var(--text-color);
}

.scrollable-checklist::-webkit-scrollbar {
    width: 6px;
}

.scrollable-checklist::-webkit-scrollbar-track {
    background: transparent;
}

.scrollable-checklist::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 3px;
}

.scrollable-checklist::-webkit-scrollbar-thumb:hover {
    background: var(--text-color);
}


/* ==========================================================================
   Custom Checkbox Styles
   ========================================================================== */

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 32px;
    margin-bottom: 12px;
    cursor: pointer;
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--accent-color);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}


/* ==========================================================================
   Categories Dropdown Styles
   ========================================================================== */

.add-to-existing-categories-dropdown {
    position: relative;
    width: 100%;
}

.add-to-existing-categories-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.add-to-existing-categories-trigger:hover {
    border-color: var(--accent-color);
    background-color: var(--card-hover-bg);
}

.add-to-existing-categories-trigger.active {
    border-color: var(--accent-color);
}

.add-to-existing-categories-trigger .dropdown-arrow {
    font-size: 20px;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.add-to-existing-categories-trigger.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-text {
    flex: 1;
    text-align: left;
}

.add-to-existing-categories-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    margin-top: 4px;
}

.add-to-existing-categories-options.active {
    display: block;
}

.add-to-existing-categories-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.add-to-existing-categories-option:hover {
    background: var(--card-hover-bg);
}

.add-to-existing-categories-option:first-child {
    border-radius: 8px 8px 0 0;
}

.add-to-existing-categories-option:last-child {
    border-radius: 0 0 8px 8px;
}

.add-to-existing-categories-option input[type="checkbox"] {
    margin-right: 8px;
    accent-color: var(--accent-color);
}

.add-to-existing-categories-option label {
    flex: 1;
    cursor: pointer;
    margin: 0;
    color: var(--text-color);
}

.add-to-existing-categories-option.create-category-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    color: var(--accent-color);
    font-weight: 500;
    border-top: 1px solid var(--border-color);
    margin-top: 4px;
    border-radius: 0 0 8px 8px;
    background-color: rgba(66, 165, 245, 0.08);
    transition: all 0.2s ease;
}

.add-to-existing-categories-option.create-category-option:hover {
    background-color: rgba(66, 165, 245, 0.15);
}

.add-to-existing-categories-option.create-category-option .material-icons {
    font-size: 18px;
    margin-right: 8px;
    color: var(--accent-color);
}


/* ==========================================================================
   Welcome Dialog Styles
   ========================================================================== */

#welcomeDialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    animation: fadeIn 0.3s ease-out forwards;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

#welcomeDialog.active {
    display: flex;
    opacity: 1;
}

#welcomeDialog .dialog {
    background: var(--bg-color);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    transform: translateY(20px);
    opacity: 0;
    border: 1px solid var(--border-color);
    animation: slideUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.1s forwards;
    will-change: transform, opacity;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#welcomeDialog .dialog-header {
    padding: 28px 28px 20px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

#welcomeDialog .dialog-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-color);
    font-weight: 600;
    line-height: 1.2;
}

#welcomeDialog .welcome-title-container {
    display: flex;
    align-items: center;
    gap: 16px;
    transform: translateX(-10px);
    opacity: 0;
    animation: slideUp 0.4s ease-out 0.3s forwards;
}

#welcomeDialog .welcome-title-container .app-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    animation: bounce 2s ease-in-out 0.5s infinite;
    transition: transform 0.3s ease;
}

#welcomeDialog .welcome-title-container .app-logo:hover {
    animation: none;
    transform: scale(1.1);
}

#welcomeDialog .dialog-content {
    padding: 20px 24px;
    line-height: 1.6;
    color: var(--text-color);
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    transform: translateY(10px);
    opacity: 0;
    animation: slideUp 0.4s ease-out 0.4s forwards;
}

#welcomeDialog .dialog-content p {
    margin: 0 0 16px;
    color: var(--text-secondary);
}

#welcomeDialog .welcome-options {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 16px 20px;
    margin: 16px auto;
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

#welcomeDialog .hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 8px 0 0 0;
    opacity: 0.8;
    text-align: center;
    display: block;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.4;
}

#welcomeDialog .checkbox-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 12px 0 24px;
    cursor: pointer;
    transition: transform 0.2s ease;
    position: relative;
    width: auto;
    padding-left: 0;
    box-sizing: border-box;
    gap: 8px;
}

#welcomeDialog .checkbox-container input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

#welcomeDialog .checkbox-container .checkmark {
    position: relative;
    height: 20px;
    width: 20px;
    background-color: var(--card-bg);
    border: 2px solid var(--accent-color);
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

#welcomeDialog .checkbox-container:hover .checkmark {
    transform: scale(1.1);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.2);
}

#welcomeDialog .checkbox-container input:checked ~ .checkmark {
    background-color: var(--accent-color);
    animation: pulse 0.5s ease;
}

#welcomeDialog .checkbox-container .checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

#welcomeDialog .checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

#welcomeDialog .checkbox-container span {
    margin-left: 6px;
    color: var(--text-color);
    font-size: 0.95rem;
}

#welcomeDialog .dialog-buttons {
    display: flex;
    justify-content: flex-end;
    padding: 16px 24px 24px;
    gap: 12px;
    border-top: 1px solid var(--border-color);
    transform: translateY(10px);
    opacity: 0;
    animation: slideUp 0.4s ease-out 0.5s forwards;
}

#welcomeDialog .dialog-button {
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    border: none;
    outline: none;
}

#welcomeDialog .dialog-button.primary {
    background-color: var(--accent-color);
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#welcomeDialog .dialog-button.primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

#welcomeDialog .dialog-button.primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#welcomeDialog .dialog-button.secondary {
    background-color: var(--button-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

#welcomeDialog .dialog-button.secondary:hover {
    background-color: var(--button-hover-bg);
    transform: translateY(-1px);
}







/* ==========================================================================
   Flyout & Slide-in Panel Styles
   ========================================================================== */

.mobile-flyout-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 1001; /* Below the flyout menu (1002) but above everything else */
}

.mobile-flyout-overlay.active {
    display: block;
}

   .app-settings-flyout {
    position: fixed;
    top: 0;
    right: -350px;
    width: 300px;
    height: 100vh;
    background-color: var(--card-bg);
    box-shadow: -2px 0 10px var(--shadow);
    z-index: 2000;
    transition: right 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}

.app-settings-flyout.open {
    right: 0;
}

.flyout-header,
.app-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--card-bg);
    position: sticky;
    top: 0;
    z-index: 2;
}

.app-settings-header {
    padding: 20px;
}

.flyout-header h3,
.app-settings-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
}

.close-flyout,
.close-app-settings {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.close-flyout {
    padding: 8px;
    margin: -8px;
    border-radius: 50%;
}

.close-app-settings {
    padding: 5px;
    border-radius: 4px;
}

.close-flyout:hover,
.close-app-settings:hover {
    background-color: var(--button-hover-bg);
}

.app-settings-content {
    padding: 20px 20px 120px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.app-settings-section {
    margin-bottom: 1.5rem;
}

.app-settings-section h4 {
    margin: 0 0 12px 0;
    color: var(--text-color);
    font-size: 16px;
}

.app-settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--overlay-bg);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    pointer-events: auto;
}

.app-settings-overlay.visible {
    opacity: 1;
    visibility: visible;
}


/* ==========================================================================
   Button Styles
   ========================================================================== */

.hamburger-menu {
    background: var(--button-bg);
    border: 5px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    width: auto;
    min-width: 56px;
    height: auto;
    min-height: 56px;
    padding: 12px 16px;
    box-sizing: border-box;
}

.hamburger-menu:hover {
    background: var(--button-hover-bg);
}

.hamburger-menu .material-icons {
    font-size: 24px;
}

.app-settings-button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--button-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: left;
}

.app-settings-button:hover {
    background-color: var(--button-hover-bg);
}

.app-settings-button .material-icons {
    margin-right: 12px;
    font-size: 1.5rem;
}

#resetSettings {
    color: var(--danger-color);
}

#resetSettings .material-icons {
    color: var(--danger-color);
}

#resetSettings:hover {
    background-color: rgba(244, 67, 54, 0.1);
}

#addStarterShortcuts {
    color: #ff9800; /* Orange color */
    position: relative;
}

#addStarterShortcuts .material-icons {
    color: #ff9800; /* Orange color */
}

#addStarterShortcuts:hover {
    background-color: rgba(255, 152, 0, 0.1);
}

#addStarterShortcuts::after {
    content: 'This will add popular websites organized into categories for easy access.';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 250px;
    padding: 8px 12px;
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

#addStarterShortcuts:hover::after {
    opacity: 1;
    visibility: visible;
}

.view-more-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 12px;
    margin: 8px 0;
    background: transparent;
    color: var(--accent-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.view-more-button:hover {
    background: var(--hover-color);
}

.view-more-button .material-icons {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.view-more-button.expanded .material-icons {
    transform: rotate(180deg);
}



/* ==========================================================================
   Form Components & Validation
   ========================================================================== */

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    margin-left: auto;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .4s;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

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

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

input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.validation-tooltip {
    font-size: 0.85rem;
    color: var(--error-color);
    background-color: var(--error-bg);
    border: 1px solid var(--error-color);
    border-radius: 6px;
    padding: 8px 12px;
    margin-top: 1px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    animation: fadeInError 0.3s ease;
}

.validation-tooltip::before {
    content: "⚠️";
    margin-right: 8px;
    font-size: 1rem;
    color: var(--error-color);
}

@keyframes fadeInError {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ==========================================================================
   Search Engine List
   ========================================================================== */

/* Custom Search Engine Dropdown */
.search-engine-select {
    position: relative;
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: var(--card-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
    margin: 0 0 16px 0;
    padding: 0 44px 0 12px;
    z-index: 2;
}


.selected-option {
    display: flex;
    align-items: center;
    padding: 10px 0;
    min-height: 44px;
}

.search-engine-favicon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    border-radius: 50%;
    object-fit: contain;
}

.search-engine-name {
    font-size: 0.95rem;
    color: var(--text-color);
}

.search-engine-options {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    box-sizing: border-box;
    max-height: 300px;
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10;
    padding: 8px 0;
    margin: 0;
}

.search-engine-select[aria-expanded="true"] .search-engine-options {
    display: block;
}

.search-engine-option {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    transition: all 0.2s ease;
}

.search-engine-option:hover {
    background-color: var(--card-hover-bg);
}

.search-engine-option.active {
    background-color: var(--accent-color-10);
}

/* Hide the original select element */
.search-engine-select select {
    display: none;
}

/* Style the dropdown wrapper and arrow */
.search-engine-select-wrapper {
    position: relative;
    width: 100%;
    margin: 0 0 8px 0;
}

.search-engine-arrow {
    position: absolute;
    right: 12px;
    top: 40%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 20px !important;
    transition: all 0.2s ease;
    z-index: 5;
    cursor: pointer;
}

.search-engine-select[aria-expanded="true"] ~ .search-engine-arrow {
    color: var(--accent-color);
    transform: translateY(-50%) rotate(180deg);
    top: 40%;
}

/* Active state for the entire select area */
.search-engine-select:active {
    transform: translateY(1px);
}

.search-engines-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 12px 0;
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
}

.search-engines-list.collapsed {
    max-height: 104px; /* (item height 48px * 2) + gap 8px */
}

.search-engine-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--button-bg);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-engine-item:hover {
    background: var(--button-hover-bg);
}

.search-engine-item.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.search-engine-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    border-radius: 4px;
    object-fit: contain;
}

.search-engines-note {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-top: 8px;
    margin-bottom: 12px;
    text-align: center;
}


/* ==========================================================================
   Theme Option Styles
   ========================================================================== */

.theme-options-vertical {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.theme-options-vertical .theme-option {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--button-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    margin-bottom: 8px;
}

.theme-options-vertical .theme-option:last-child {
    margin-bottom: 0;
}

.theme-options-vertical .theme-option:hover {
    background: var(--button-hover-bg);
}

.theme-options-vertical .theme-option.active {
    background: var(--accent-color);
    color: var(--text-on-accent);
    border-color: var(--accent-color);
}

.theme-options-vertical .theme-option.active .theme-emoji {
    filter: none;
}

.theme-options-vertical .theme-emoji {
    margin-right: 8px;
    font-size: 1.2em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}


/* ==========================================================================
   Confirmation Dialog Styles
   ========================================================================== */

#resetConfirmDialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#resetConfirmDialog .dialog {
    background: var(--bg-color);
    border-radius: 12px;
    padding: 24px;
    max-width: 450px;
    width: 100%;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
}

#resetConfirmDialog .dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

#resetConfirmDialog .dialog-header h3 {
    margin: 0;
    color: var(--text-color);
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.2;
}

#resetConfirmDialog .welcome-title-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

#resetConfirmDialog .welcome-title-container .app-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

#resetConfirmDialog .dialog-content {
    margin-bottom: 24px;
    color: var(--text-color);
    line-height: 1.5;
}

#resetConfirmDialog .dialog-content p {
    margin: 0 0 12px 0;
}

#resetConfirmDialog .dialog-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    line-height: 1;
}

#resetConfirmDialog .dialog-close:hover {
    color: var(--text-color);
}

.dialog-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.dialog-buttons .button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.dialog-buttons .button .material-icons {
    margin-right: 8px;
    font-size: 18px;
}

.dialog-buttons .button.primary {
    background-color: var(--accent-color);
    color: var(--text-on-accent);
}

.dialog-buttons .button.primary:hover {
    background-color: var(--accent-hover);
}

.dialog-buttons .button.danger {
    background-color: var(--danger-color);
    color: white;
}

.dialog-buttons .button.danger:hover {
    background-color: #d32f2f;
}

.dialog-buttons .button.secondary {
    background-color: var(--button-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.dialog-buttons .button.secondary:hover {
    background-color: var(--button-hover-bg);
}


/* ==========================================================================
   Toast Notification
   ========================================================================== */

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: var(--card-bg);
    color: var(--text-color);
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
    pointer-events: none;
    max-width: 90%;
    text-align: center;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}


/* ==========================================================================
   Miscellaneous & Layout Styles
   ========================================================================== */

.category-separator,
.desktop-category-line {
    display: none; /* Hidden by default or used as needed */
    height: 3px;
    background-color: var(--border-color);
    margin: 8px 0;
    width: 100%;
}

.material-icons.context-menu-icon {
    font-size: 1.1rem;
    margin-right: 2px;
    width: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}




/* Desktop styles */
@media (min-width: 769px) {
    /* Hide all mobile-specific elements on desktop */
    .mobile-categories-flyout-container,
    .mobile-category-option,
    .back-to-top,
    .floating-action-button {
        display: none;
    }
    
    /* Show desktop category line on desktop */
    .desktop-category-line {
        display: block;
    }


}



/* Mobile-specific styles */
@media (max-width: 768px) {

    /**************************************************************
     * CORE LAYOUT & RESETS
     **************************************************************/

    /* Reset html and body for proper scrolling */
    html,
    body {
        height: auto;
        min-height: 100%;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background: var(--card-bg);
    }

    /* Adjust container for mobile */
    .container {
        padding: 0;
        max-width: 100%;
    }

    /* Main content area - size to content */
    main {
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    /* Hide desktop categories sidebar */
    .categories-container {
        display: none;
    }


    /**************************************************************
     * HEADER
     **************************************************************/

    /* Hide edit toggle in header on mobile */
    .header-controls .edit-toggle {
        display: none !important;
    }

    /* Mobile header layout */
    header {
        display: flex;
        flex-wrap: wrap;
        padding: 12px 0 12px 0;
        /* Remove horizontal padding to match shortcut container */
        gap: 8px 4px;
        width: 100%;
        box-sizing: border-box;
        background: var(--card-bg);
        /* Match search bar background */
        position: relative;
        z-index: 100;
    }

    .logo-title-container {
        display: none;
    }

    .header-controls {
        order: 2;
        display: flex;
        gap: 12px;
        flex: 0 0 auto;
        margin: 0;
        position: relative;
        z-index: 100;
    }

    .edit-toggle,
    .hamburger-menu {
        width: 50px;
        height: 50px;
        min-width: 40px;
        border-radius: 12px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;

        margin: 0;
    }

    .edit-toggle .material-icons,
    .hamburger-menu .material-icons {
        font-size: 25px;
    }


    /**************************************************************
     * SEARCH
     **************************************************************/

    /* Search container and related elements */
    .search-container {
        --search-container-z: 800;
        /* Lower than flyout (1000) and overlay (1000) */
        --search-bar-z: 801;
        /* Slightly above container */
        --search-results-z: 799;
        /* Below search bar */
        --search-section-z: 798;
        /* Below search results */
        z-index: var(--search-container-z);
        position: relative;
        padding: 0 12px;
        order: 3;
        width: 100%;
        margin: 8px 0;
        flex: 0 0 100%;
    }

    .search-bar {
        z-index: var(--search-bar-z);
        background: var(--bg-color);
        position: relative;
        width: 100%;
        border: none;
        border-radius: 40px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.24);
    }

    .search-bar:focus-within {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.24);
        outline: none;
    }

    .search-input {
        width: 100%;
        box-sizing: border-box;
        position: relative;
        border: none;
        background: transparent;
        padding: 10px 16px 10px 12px;
        border-radius: 12px;
        font-size: 14px;
    }

    .search-icon {
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 1;
        color: var(--text-secondary);
    }

    .search-results {
        z-index: 1999;
        /* Above search bar but below app settings flyout */
        border-radius: 20px !important;
        overflow: hidden;
        border: 0;
        padding: 0 8px;
        margin: 8px 0 0;
        width: 100%;
        box-sizing: border-box;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.24);
        background: var(--bg-color);
    }

    .search-section {
        z-index: var(--search-section-z);
    }


    /**************************************************************
     * SHORTCUTS & GRID
     **************************************************************/

    /* Shortcuts container - size to content */
    .shortcuts-container {
        height: auto;
        margin: 0;
        padding: 12px 12px 20px;
        border: none;
        background: var(--card-bg);
        border-top: 2px solid var(--border-color);
        width: 100%;
        box-sizing: border-box;
        border-radius: 0;
    }

    /* List layout for All category */
    .shortcuts-container.all-category {
        --shortcut-item-padding: 12px 16px;
        --shortcut-icon-size: 40px;
        --shortcut-favicon-size: 24px;
        --shortcut-gap: 12px;
    }

    .shortcuts-container.all-category .shortcuts-grid {
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding: 0 16px;
        width: 100%;
        max-width: 100%;
        overflow-x: visible;
    }

    .shortcuts-container.all-category .shortcut-item {
        display: flex;
        flex-direction: row !important;
        /* Override default column */
        align-items: center;
        width: 100%;
        padding: var(--shortcut-item-padding);
        border-radius: 8px;
        background: var(--card-bg);
        transition: background-color 0.2s, transform 0.1s;
        text-align: left;
        gap: var(--shortcut-gap);
        height: auto !important;
        /* Override fixed height */
        min-height: 64px;
        /* Minimum height to match icon */
        justify-content: flex-start;
        /* Align items to the left */
        max-width: 100%;
        /* Ensure it doesn't overflow */
        box-sizing: border-box;
        /* Include padding in width calculation */
    }

    .shortcuts-container.all-category .shortcut-item:hover {
        background-color: rgba(255, 255, 255, 0.05);
    }

    .shortcuts-container.all-category .shortcut-item:active {
        transform: scale(0.98);
    }

    .shortcuts-container.all-category .shortcut-icon {
        width: var(--shortcut-icon-size);
        height: var(--shortcut-icon-size);
        min-width: var(--shortcut-icon-size);
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.1);
        overflow: hidden;
        flex-shrink: 0;
    }

    .shortcuts-container.all-category .shortcut-favicon {
        width: var(--shortcut-favicon-size);
        height: var(--shortcut-favicon-size);
        object-fit: contain;
    }

    .shortcuts-container.all-category .shortcut-name {
        font-size: 1rem;
        color: var(--text-color);
        overflow: visible;
        word-break: break-word;
        flex: 1 1 auto;
        text-align: left;
        padding-right: 8px;
        min-width: 0;
    }

    .shortcuts-container.all-category .shortcut-menu-button {
        display: none;
        /* Hide by default */
        margin-left: auto;
        background: none;
        border: none;
        color: var(--text-color);
        opacity: 0.5;
        font-size: 1.2rem;
        line-height: 1;
        padding: 4px 24px;
        cursor: pointer;
        transition: opacity 0.2s;
    }

    .shortcuts-container.all-category .shortcut-menu-button:hover {
        opacity: 0.8;
    }

    .shortcuts-container.all-category .shortcut-actions {
        display: flex;
        gap: 8px;
    }

    .shortcuts-container.all-category .shortcut-actions .material-icons {
        font-size: 1.1rem;
        opacity: 0.7;
        transition: opacity 0.2s;
    }

    .shortcuts-container.all-category .shortcut-actions .material-icons:hover {
        opacity: 1;
    }

    /* Show the button only in edit mode */
    body.editing .shortcuts-container.all-category .shortcut-menu-button {
        display: block;
    }

    /* Adjust letter headers in list view */
    .shortcuts-container.all-category .letter-header-square {
        width: 40px;
        height: 40px;
        margin: 16px 0 8px 0;
        padding: 36px;
        background: var(--accent-color);
        color: white;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 3rem;
        font-weight: bold;
    }

    /* Make the star icon larger in the starred section header */
    .shortcuts-container.all-category .letter-header-square .material-icons {
        font-size: 2.5rem;
        width: 48px;
        height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Adjust general category/letter headers */
    .category-header {
        padding: 8px 16px;
        margin: 8px 0 4px;
    }

    .letter-header {
        margin: 16px 0 8px 16px;
        font-size: 0.9rem;
    }


    /**************************************************************
     * MOBILE CATEGORIES & FLYOUT MENU
     **************************************************************/

    /* Flyout Component Styles */
    .mobile-categories-flyout {
        --flyout-trigger-height: 40px;
        --flyout-trigger-padding-x: 16px;
        display: flex;
        margin: 0;
        z-index: 1000;
        width: 100%;
        box-sizing: border-box;
        justify-content: flex-start;
    }

    .mobile-categories-flyout-trigger {
        display: inline-flex;
        align-items: center;
        justify-content: space-between;
        background: var(--button-bg);
        border: 1px solid var(--border-color);
        border-radius: 20px;
        padding: 6px 16px 6px 10px;
        color: var(--text-color);
        font-size: 0.95rem;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        text-decoration: none;
        height: var(--flyout-trigger-height);
        margin: 0;
        width: auto;
    }

    .mobile-categories-flyout-trigger:hover {
        background: var(--button-hover-bg);
        transform: translateX(2px);
    }

    .mobile-categories-flyout-trigger:active {
        transform: scale(0.98) translateX(2px);
        background: var(--button-active-bg);
    }

    .mobile-categories-flyout-trigger .material-icons {
        font-size: 20px;
        margin-left: 6px;
        transition: transform 0.2s ease;
    }

    .mobile-categories-flyout-trigger:hover .material-icons {
        transform: translateX(2px);
    }

    .mobile-categories-flyout-trigger-arrow {
        font-size: 0.7rem;
        margin-left: 8px;
        transition: transform 0.2s;
    }

    /* Flyout Overlay */
    .mobile-flyout-overlay {
        --overlay-bg: rgba(0, 0, 0, 0.5);
        --overlay-z-index: 1001;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--overlay-bg);
        z-index: var(--overlay-z-index);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        pointer-events: none; /* Disable pointer events when not active */
        display: block !important;
        touch-action: none; /* Prevent any touch actions */
        -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
    }

    .mobile-flyout-overlay.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto; /* Enable pointer events when active */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        overflow-y: scroll; /* Enable scrolling within the overlay if needed */
        touch-action: none; /* Prevent any touch actions on the overlay */
    }

    /* Flyout Menu */
    .mobile-categories-flyout-menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 85%;
        max-width: 320px;
        height: 100%;
        height: 100vh; /* Ensure full viewport height */
        background-color: var(--sidebar-bg);
        box-shadow: 2px 0 15px rgba(0,0,0,0.2);
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        z-index: 1002; /* Above overlay */
        display: flex;
        flex-direction: column;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        overflow-y: auto; /* Enable scrolling if content is taller than viewport */
        touch-action: pan-y; /* Only allow vertical panning */
    }

    .mobile-categories-flyout.active .mobile-categories-flyout-menu {
        transform: translateX(0);
    }

    .mobile-categories-flyout .mobile-categories-flyout-header {
        padding: 8px 8px 8px 0px;
        border-bottom: 1px solid var(--border-color);
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: var(--card-bg);
        position: sticky;
        top: 0;
        z-index: 2;
        min-height: 56px;
        gap: 12px; /* Add space between header items */
    }
    
    .mobile-categories-flyout-header .mobile-flyout-back {
        flex: 1; /* Allow back button to take available space */
        margin-right: 0; /* Remove any default margin */
    }
    
    .mobile-flyout-add-category {
        display: flex;
        position: relative;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background-color: var(--accent-color);
        color: white;
        border: none;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
        cursor: pointer;
        z-index: 2;
        align-items: center;
        justify-content: center;
        transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
    }
    
    .mobile-flyout-add-category:hover {
        background-color: var(--accent-hover);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    }
    
    .mobile-flyout-add-category:active {
        transform: translateY(0);
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    }
    
    .mobile-flyout-add-category .material-icons {
        font-size: 24px;
        color: white;
    }

    .mobile-categories-flyout .mobile-categories-flyout-options {
        flex-grow: 1;
        overflow-y: auto;
        padding-bottom: 70px; /* Add padding to account for the Add Category button */
    }

    .mobile-categories-flyout-option {
        display: flex;
        align-items: center;
        flex: 1;
        padding: 12px 16px;
        background: var(--card-bg);
        border: none;
        color: var(--text-color);
        font-size: 0.95rem;
        font-weight: 500;
        text-align: left;
        cursor: pointer;
        transition: background-color 0.15s ease;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-categories-flyout-option:last-child {
        border-bottom: none;
    }
    
    /* Style for the Add Category button in the flyout */



    .mobile-categories-flyout .mobile-categories-flyout-option:hover,
    .mobile-categories-flyout .mobile-categories-flyout-option.active {
        background-color: var(--accent-color);
        color: var(--text-on-accent);
    }

    .mobile-categories-flyout-option:active {
        background: var(--button-active-bg);
        transition-duration: 0.1s;
    }

    /* Mobile Category Item Styles (inside flyout) */
    .mobile-category-option {
        display: flex;
        align-items: stretch;
        width: 100%;
        position: relative;
        margin: 0;
        background: var(--card-bg);
        border: none;
        border-bottom: 1px solid var(--border-color);
        transition: all 0.2s ease, transform 0.2s, box-shadow 0.2s;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        touch-action: none;
        cursor: default;
    }

    .mobile-category-option.dragging {
        opacity: 0.9;
        background: var(--bg-color-hover);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        transform: scale(1.01);
        z-index: 1000;
        position: relative;
        transition: none; /* Disable transitions while dragging */
        border: 1px dashed var(--accent-color);
    }

    .mobile-category-option.drag-over {
        border-bottom: 2px solid var(--accent-color);
        margin-bottom: -1px;
        transform: translateY(1px);
        background-color: rgba(var(--accent-color-rgb), 0.05);
        transition: background-color 0.2s ease;
    }
    
    /* Hide the drag handle when dragging */
    .mobile-category-option.dragging .drag-handle {
        opacity: 0.3;
    }
    
    /* Prevent text selection during drag */
    .mobile-category-option {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }

    .mobile-category-option .drag-handle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        min-width: 44px;
        height: 100%;
        color: var(--text-secondary);
        opacity: 0.7;
        cursor: grab;
        transition: all 0.2s ease;
        border-radius: 4px;
        margin: 0 4px 0 0;
        padding: 0;
        background: none;
        border: none;
        outline: none;
        -webkit-tap-highlight-color: transparent;
        touch-action: none;
        position: relative;
        z-index: 2; /* Ensure it's above other elements */
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        pointer-events: auto; /* Ensure it can receive pointer events */
    }
    
    .mobile-category-option:hover .drag-handle {
        opacity: 0.9;
        background: rgba(0, 0, 0, 0.05);
    }

    .mobile-category-option .drag-handle:active {
        cursor: grabbing;
        opacity: 1;
        background: rgba(0, 0, 0, 0.1);
    }
    
    /* Make the drag handle more visible when dragging */
    .mobile-category-option.dragging .drag-handle {
        opacity: 1 !important;
        background: rgba(var(--accent-color-rgb), 0.15);
    }
    
    /* Hide the drag handle text when dragging */
    .mobile-category-option.dragging .drag-handle .material-icons {
        opacity: 1;
    }
    
    /* Visual feedback when dragging */
    body.category-dragging .mobile-category-option:not(.dragging) .drag-handle {
        opacity: 0.3;
    }
    
    body.category-dragging .mobile-category-option.dragging {
        background-color: rgba(var(--accent-color-rgb), 0.1);
        border: 1px dashed var(--accent-color);
        border-radius: 6px;
        opacity: 0.8;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .reorder-categories-btn {
        display: block;
        width: calc(100% - 32px);
        padding: 12px 16px;
        background-color: var(--accent-color);
        color: white;
        border: none;
        text-align: center;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s ease;
        margin: 16px;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    
    .reorder-categories-btn:hover {
        background-color: var(--accent-hover);
        transform: translateY(-1px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    }
    
    .reorder-categories-btn:active {
        transform: translateY(0);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    }
    
    .reorder-categories-btn.reordering {
        background-color: #4CAF50;
    }
    
    .reorder-categories-btn.reordering:hover {
        background-color: #43A047;
    }
    
    .mobile-category-option .drag-handle {
        cursor: move;
        cursor: -webkit-grab;
        opacity: 0.7;
        transition: opacity 0.2s, background-color 0.2s, transform 0.1s;
        display: none; /* Hidden by default, shown in reorder mode */
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 18px;
        margin-right: 8px;
        background: none;
        border: none;
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        pointer-events: auto;
        position: relative;
        z-index: 2;
        touch-action: none;
    }
    
    .mobile-category-option .drag-handle .material-icons {
        font-size: 20px;
        pointer-events: none;
    }
    
    .mobile-category-option .drag-handle:hover,
    .mobile-category-option .drag-handle:active {
        background-color: rgba(0, 0, 0, 0.08);
        opacity: 1;
    }
    
    .mobile-category-option .drag-handle:active {
        cursor: -webkit-grabbing;
        cursor: grabbing;
        background-color: rgba(0, 0, 0, 0.12);
        transform: scale(1.1);
    }
    
    .mobile-category-option.dragging {
        opacity: 0.8;
        background-color: rgba(0, 0, 0, 0.05);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        transition: none;
    }
    
    .mobile-category-option.drag-over {
        border-top: 2px solid var(--accent-color);
        background-color: rgba(0, 0, 0, 0.03);
        transition: none;
    }
    
    .mobile-category-option.drag-over {
        position: relative;
    }
    
    .mobile-category-option.drag-over::after {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        height: 2px;
        background-color: #007bff;
        z-index: 1;
    }
    
    .mobile-category-option.drag-over[data-drop-position="before"]::after {
        top: -1px;
    }
    
    .mobile-category-option.drag-over[data-drop-position="after"]::after {
        bottom: -1px;
    }

    .mobile-category-option:hover .drag-handle {
        opacity: 1;
    }

    .mobile-category-option.dragging .drag-handle {
        cursor: -webkit-grabbing;
        cursor: grabbing;
        opacity: 1;
    }

    .mobile-category-option .drag-handle .material-icons {
        font-size: 20px;
        pointer-events: none;
    }
    
    .mobile-category-option.dragging {
        opacity: 0.5;
        background: rgba(0, 0, 0, 0.05);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }

    .mobile-category-option {
        transition: transform 0.18s cubic-bezier(.4,0,.2,1);
    }
    
    .drag-placeholder {
        background: #e3f2fd;
        border-radius: 8px;
        border: 2px dashed #42a5f5;
        margin: 4px 0;
        height: 48px;
    }
    
    .mobile-category-option.drag-over {
        position: relative;
    }
    
    .mobile-category-option.drag-over::before {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        height: 2px;
        background: #007AFF;
        z-index: 1;
    }
    
    .mobile-category-option[data-drop-position="before"]::before {
        top: -1px;
    }
    
    .mobile-category-option[data-drop-position="after"]::before {
        bottom: -1px;
    }

    .mobile-category-option:not(.selected):hover {
        background-color: var(--hover-color);
    }

    .mobile-category-option:not(.selected):hover .mobile-categories-flyout-option {
        background-color: transparent;
    }

    .mobile-category-option.selected {
        background-color: var(--card-bg);
    }

    .mobile-category-option.selected .mobile-categories-flyout-option {
        background-color: transparent;
        color: var(--accent-color);
        font-weight: 500;
    }

    /* More Button (three dots) */
    .mobile-category-more {
        --more-button-bg: rgba(0, 0, 0, 0.04);
        --more-button-hover-bg: rgba(0, 0, 0, 0.1);
        --more-button-active-bg: rgba(0, 0, 0, 0.15);
        --more-button-border: 1px solid var(--border-color);
        --more-button-border-radius: 8px;
        --more-button-padding: 0 8px;
        --more-button-size: 32px;
        --more-button-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        
        background: var(--more-button-bg);
        border: var(--more-button-border);
        color: var(--text-color);
        cursor: pointer;
        font-size: 1.1rem;
        padding: var(--more-button-padding);
        height: var(--more-button-size);
        min-width: var(--more-button-size);
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 8px 12px 8px 0;
        border-radius: var(--more-button-border-radius);
        transition: var(--more-button-transition);
        flex-shrink: 0;
        position: relative;
        z-index: 2;
    }

    .mobile-category-more:hover {
        background: var(--more-button-hover-bg);
    }

    .mobile-category-more:active {
        transform: scale(0.98);
        background: var(--more-button-active-bg);
    }

    /* Make home category look the same as other categories */
    .mobile-category-option.home-category-option .mobile-categories-flyout-option {
        background: transparent;
        font-weight: 500;
    }

    .mobile-category-option.home-category-option .mobile-categories-flyout-option.selected {
        background: transparent;
        color: var(--accent-color);
    }

    .mobile-category-option.active {
        background: var(--accent-gradient, var(--accent-color));
        color: var(--text-on-accent);
        border-color: transparent;
        box-shadow: 0 4px 14px -2px rgba(var(--accent-rgb), 0.2);
    }

    .mobile-category-option.active:hover {
        box-shadow: 0 6px 16px -2px rgba(var(--accent-rgb), 0.25);
    }




    /* Add Category Button */


    /* Modern Back Button Styles */
    .mobile-flyout-back,
    .back-to-categories {
        --back-button-height: 42px;
        --back-button-padding: 0 16px;
        --back-button-icon-size: 20px;
        --back-button-icon-margin: 8px;
        --back-button-bg: var(--accent-color);
        --back-button-text: var(--text-on-accent);
        --back-button-hover-bg: var(--accent-hover);
        
        display: flex;
        align-items: center;
        background: var(--back-button-bg);
        color: var(--back-button-text);
        border: none;
        border-radius: 0 24px 24px 0;
        padding: var(--back-button-padding);
        font-size: 0.95rem;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        text-decoration: none;
        height: var(--back-button-height);
        box-shadow: 0 2px 10px -2px rgba(var(--accent-rgb), 0.3);
        position: relative;
        overflow: hidden;
    }

    .mobile-flyout-back:hover,
    .back-to-categories:hover {
        background: var(--back-button-hover-bg);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px -1px rgba(var(--accent-rgb), 0.35);
    }

    .mobile-flyout-back:active,
    .back-to-categories:active {
        transform: translateY(0) scale(0.98);
        box-shadow: 0 1px 6px -1px rgba(var(--accent-rgb), 0.25);
    }

    .mobile-flyout-back .material-icons,
    .back-to-categories .material-icons {
        font-size: var(--back-button-icon-size);
        margin-right: var(--back-button-icon-margin);
        transition: transform 0.2s ease;
        font-weight: bold;
    }

    /* Ripple effect on click */
    .mobile-flyout-back::after,
    .back-to-categories::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 5px;
        height: 5px;
        background: rgba(255, 255, 255, 0.5);
        opacity: 0;
        border-radius: 100%;
        transform: scale(1, 1) translate(-50%, -50%);
        transform-origin: 50% 50%;
    }

    .mobile-flyout-back:focus:not(:active)::after,
    .back-to-categories:focus:not(:active)::after {
        animation: ripple 0.6s ease-out;
    }

    @keyframes ripple {
        0% {
            transform: scale(0, 0);
            opacity: 0.5;
        }
        100% {
            transform: scale(20, 20);
            opacity: 0;
        }
    }

    /* Update the trigger button to match the new style */
    .mobile-categories-flyout-trigger {
        background: var(--accent-color);
        color: var(--text-on-accent);
        border: none;
        border-radius: 0 24px 24px 0;
        padding: 0 20px 0 16px;
        height: 42px;
        display: flex;
        align-items: center;
        font-size: 0.95rem;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 2px 10px -2px rgba(var(--accent-rgb), 0.3);
    }

    .mobile-categories-flyout-trigger:hover {
        background: var(--accent-hover);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px -1px rgba(var(--accent-rgb), 0.35);
    }

    .mobile-categories-flyout-trigger:active {
        transform: translateY(0) scale(0.98);
        box-shadow: 0 1px 6px -1px rgba(var(--accent-rgb), 0.25);
    }

    .mobile-categories-flyout-trigger .material-icons {
        margin-left: 8px;
        transition: transform 0.2s ease;
        font-size: 1.1em;
    }

    .mobile-categories-flyout-trigger:hover .material-icons {
        transform: translateX(2px);
    }
    
    /* Ensure text and icons are properly centered in all buttons */
    .mobile-categories-flyout-trigger,
    .mobile-flyout-back,
    .back-to-categories {
        text-align: left;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        width: 100%;
        margin: 8px 0;
        padding: 0 16px;
        box-sizing: border-box;
    }

    .mobile-flyout-back{
        margin: 12.3px 0 !important;
    }
    
    /* Adjust icon positioning */
    .mobile-categories-flyout-trigger .material-icons,
    .mobile-flyout-back .material-icons,
    .back-to-categories .material-icons {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }


    /**************************************************************
     * DIALOGS & MODALS
     **************************************************************/

    .dialog-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        -webkit-overflow-scrolling: touch;
        z-index: 1001;
        /* Above everything except app settings flyout */
    }

    .dialog {
        width: 90%;
        max-width: 400px;
        max-height: 80vh;
        margin: 10vh auto;
    }

    .dialog-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .dialog-buttons button {
        width: 100%;
        margin: 0;
    }

    #welcomeDialog .dialog {
        width: 90%;
        max-width: 100%;
        margin: 0 16px;
        padding: 20px;
    }

    #welcomeDialog .welcome-options {
        flex-direction: column;
        gap: 12px;
    }

    #welcomeDialog .welcome-option {
        width: 100%;
        margin: 0;
    }

    #welcomeDialog .dialog-buttons {
        flex-direction: column;
        gap: 8px;
    }

    #welcomeDialog .dialog-button {
        width: 100%;
        text-align: center;
    }


    /**************************************************************
     * GENERAL COMPONENTS & ELEMENTS
     **************************************************************/

    /* Back to Top Button */
    .back-to-top {
        display: flex;
        position: fixed;
        bottom: 120px; /* Position above the edit button */
        right: 20px;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background-color: var(--accent-color);
        color: white;
        border: none;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
        cursor: pointer;
        z-index: 9999;
        align-items: center;
        justify-content: center;
        opacity: 0;
        visibility: hidden;
        transform: translateY(20px);
        transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
    }

    .back-to-top.visible {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .back-to-top .material-icons {
        font-size: 28px;
    }

    .back-to-top:active {
        transform: scale(0.95) translateY(0);
    }

    /* Floating Edit Button */
    #floatingEditBtn {
        display: flex;
        position: fixed;
        bottom: 35px; /* Position at the bottom */
        right: 20px;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        background-color: var(--accent-color);
        color: white;
        border: none;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
        cursor: pointer;
        z-index: 100;
        align-items: center;
        justify-content: center;
        opacity: 1;
        visibility: visible;
        transition: all 0.3s ease;
    }

    #floatingEditBtn .material-icons {
        position: absolute;
        font-size: 24px;
        transition: all 0.3s ease;
    }

    #floatingEditBtn .edit-icon {
        opacity: 1;
        transform: rotate(0deg);
    }

    #floatingEditBtn .done-icon {
        opacity: 0;
        transform: rotate(-90deg);
    }

    body.editing #floatingEditBtn .edit-icon {
        opacity: 0;
        transform: rotate(90deg);
    }

    body.editing #floatingEditBtn .done-icon {
        opacity: 1;
        transform: rotate(0deg);
    }

    #floatingEditBtn:active {
        transform: scale(0.95);
    }

    /* Input and Form Elements */
    input[type="text"],
    input[type="search"],
    input[type="url"],
    textarea,
    select {
        font-size: 16px !important;
        /* Prevent iOS zoom */
    }

    /* Adjust jump navigation for mobile */
    .jump-navigation {
        display: none;
        /* Hide on mobile */
    }
}