/* ===================== CSS VARIABLES ===================== */
:root {
    /* Light mode colors */
    --bg-primary: #ffffff;
    --bg-secondary: linear-gradient(135deg, #f5f7fa 0%, #e4e8eb 100%);
    --bg-card: #ffffff;
    --bg-hover: #f9fafb;
    --bg-input: #ffffff;
    
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    
    --border-color: #dddddd;
    --border-light: #eeeeee;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
    
    --purple-primary: #7C3AED;
    --purple-hover: #6D28D9;
    --purple-light: #EEF2FF;
    
    --red-primary: #DC2626;
    --red-hover: #B91C1C;
    
    --green-primary: #10B981;
}

/* Dark mode colors */
.dark-mode {
    --bg-primary: #1a1a1a;
    --bg-secondary: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    --bg-card: #2d2d2d;
    --bg-hover: #3a3a3a;
    --bg-input: #2d2d2d;
    
    --text-primary: #e5e5e5;
    --text-secondary: #b0b0b0;
    --text-tertiary: #808080;
    
    --border-color: #404040;
    --border-light: #333333;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.4);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.5);
    
    --purple-primary: #8B5CF6;
    --purple-hover: #7C3AED;
    --purple-light: #2d2440;
    
    --red-primary: #EF4444;
    --red-hover: #DC2626;
    
    --green-primary: #10B981;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    min-height: 100vh;
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease;
}

.header {
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

.logo svg {
    width: 32px;
    height: 32px;
    color: #4F46E5;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu {
    position: relative;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #4F46E5;
}

.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 50px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 200px;
    overflow: hidden;
}

.user-dropdown.active {
    display: block;
}

.user-info {
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.user-name {
    font-weight: 600;
    color: #333;
}

.user-email {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.25rem;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    display: block;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: #f9fafb;
}

.dropdown-item.logout {
    color: #EF4444;
}

.add-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #4F46E5;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
    text-decoration: none;
}

.add-btn:hover {
    background: #4338CA;
}

.search-filter {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.view-toggle {
    display: flex;
    gap: 0.25rem;
    background: #F3F4F6;
    padding: 0.25rem;
    border-radius: 8px;
}

.view-btn {
    background: none;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    color: #6B7280;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn:hover {
    color: #4F46E5;
    background: #E5E7EB;
}

.view-btn.active {
    background: white;
    color: #4F46E5;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.search-box input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 2.5rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

.clear-search-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.clear-search-btn:hover {
    background: #F3F4F6;
    color: #DC2626;
}

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

.filter-box select {
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    background: white;
    min-width: 150px;
}

.sort-box select {
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    background: white;
    min-width: 150px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.sort-box select:hover,
.filter-box select:hover {
    border-color: #7C3AED;
}

.sort-box select:focus,
.filter-box select:focus {
    outline: none;
    border-color: #7C3AED;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
    width: 100%;
}

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

/* ===================== TABLE/LIST VIEW STYLES ===================== */
.bookmarks-table {
    display: block !important;
    width: 100%;
    overflow-x: auto;
}

.table-header,
.table-row {
    min-width: 1050px;
    width: 100%;
}

.table-header {
    display: grid !important;
    grid-template-columns: 200px 350px 350px 150px 100px !important;
    gap: 1rem;
    background: #F9FAFB;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
    border: 1px solid #E5E7EB;
    margin-bottom: 0.75rem;
}

.table-row {
    display: grid !important;
    grid-template-columns: 200px 350px 350px 150px 100px !important;
    gap: 1rem;
    background: white;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    align-items: start;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 0.75rem;
}

.table-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.table-cell {
    min-width: 0;
    overflow: hidden;
}

.table-header .thumbnail-cell,
.table-row .thumbnail-cell {
    width: 200px !important;
    flex-shrink: 0;
}

.table-row .thumbnail-cell img {
    width: 200px !important;
    height: 100px !important;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.table-header .title-url-cell,
.table-row .title-url-cell {
    width: 350px !important;
}

.table-row .title-url-cell {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.table-row .title-url-cell .bookmark-title-link {
    color: #333;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-row .title-url-cell .bookmark-title-link:hover {
    color: #4F46E5;
}

.table-row .title-url-cell .bookmark-url-link {
    color: #6B7280;
    text-decoration: none;
    font-size: 0.85rem;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-row .title-url-cell .bookmark-url-link:hover {
    color: #4F46E5;
    text-decoration: underline;
}

.table-header .description-cell,
.table-row .description-cell {
    width: 350px !important;
}

.table-row .description-cell {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.table-header .tags-cell,
.table-row .tags-cell {
    width: 150px !important;
}

.table-row .tags-cell {
    color: #4F46E5;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.table-header .actions-cell,
.table-row .actions-cell {
    width: 100px !important;
}

.table-row .actions-cell {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-shrink: 0;
}

/* ===================== GRID VIEW STYLES ===================== */
.bookmark-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.bookmark-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.bookmark-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: #f0f0f0;
}

.bookmark-content {
    padding: 0.875rem;
}

.bookmark-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bookmark-title:hover {
    color: #4F46E5;
}

.bookmark-description {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bookmark-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    background: #EEF2FF;
    color: #4F46E5;
    border-radius: 9999px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}

.tag:hover {
    background: #E0E7FF;
}

.bookmark-link {
    color: #4F46E5;
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.icon-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    color: #6B7280;
    transition: all 0.2s;
    border-radius: 4px;
}

.icon-action-btn:hover {
    background: #F3F4F6;
    color: #4F46E5;
}

.icon-action-btn.delete:hover {
    background: #FEE2E2;
    color: #DC2626;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    padding: 1rem;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

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

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
}

.modal-body {
    padding: 1.5rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.url-input-group {
    display: flex;
    gap: 0.5rem;
}

.url-input-group input {
    flex: 1;
}

.fetch-btn {
    padding: 0.75rem 1.5rem;
    background: #4F46E5;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
}

.fetch-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.preview-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.preview-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.preview-content {
    padding: 1rem;
}

.preview-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.preview-description {
    color: #666;
    font-size: 0.9rem;
}

.tags-input-container {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0.5rem;
    min-height: 60px;
}

.tags-input-container:focus-within {
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #EEF2FF;
    color: #4F46E5;
    border-radius: 9999px;
    font-size: 0.9rem;
}

.remove-tag {
    background: none;
    border: none;
    cursor: pointer;
    color: #4F46E5;
    padding: 0;
    font-size: 1rem;
}

.tags-input-container input {
    border: none;
    outline: none;
    padding: 0.5rem;
    width: 100%;
}

.tag-suggestions {
    margin-top: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.tag-suggestion {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.tag-suggestion:hover {
    background: #f9fafb;
}

.tag-suggestion:last-child {
    border-bottom: none;
}

.tag-suggestion.create-new {
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    color: #4F46E5;
    font-weight: 600;
    border-left: 3px solid #4F46E5;
}

.tag-suggestion.create-new:hover {
    background: linear-gradient(135deg, #E0E7FF 0%, #C7D2FE 100%);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.save-btn {
    flex: 1;
    padding: 1rem;
    background: #4F46E5;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
}

.cancel-btn {
    padding: 1rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: #ccc;
    margin-bottom: 1rem;
}

.empty-state p {
    color: #666;
    font-size: 1.1rem;
}

.loading-indicator {
    text-align: center;
    padding: 2rem;
    display: none;
}

.loading-indicator.active {
    display: block;
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4F46E5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* ===================== PRINT STYLES ===================== */
@media print {
    body {
        background: white;
    }
    
    .header {
        position: static;
        box-shadow: none;
        border-bottom: 2px solid #000;
    }
    
    .user-section,
    .add-btn,
    .search-filter,
    .view-toggle,
    .icon-action-btn,
    .modal {
        display: none !important;
    }
    
    .container {
        max-width: 100%;
        margin: 0;
        padding: 0;
    }
    
    .bookmarks-grid {
        display: block;
    }
    
    .bookmark-card {
        page-break-inside: avoid;
        break-inside: avoid;
        margin-bottom: 1rem;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .bookmarks-table {
        overflow-x: visible;
    }
    
    .table-row {
        page-break-inside: avoid;
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    min-height: 100vh;
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease;
}

.header {
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

.logo svg {
    width: 32px;
    height: 32px;
    color: #4F46E5;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu {
    position: relative;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #4F46E5;
}

.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 50px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 200px;
    overflow: hidden;
}

.user-dropdown.active {
    display: block;
}

.user-info {
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.user-name {
    font-weight: 600;
    color: #333;
}

.user-email {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.25rem;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    color: #333;
    text-decoration: none;
    display: block;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: #f9fafb;
}

.dropdown-item.logout {
    color: #EF4444;
}

.add-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #4F46E5;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
    text-decoration: none;
}

.add-btn:hover {
    background: #4338CA;
}

.search-filter {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.view-toggle {
    display: flex;
    gap: 0.25rem;
    background: #F3F4F6;
    padding: 0.25rem;
    border-radius: 8px;
}

.view-btn {
    background: none;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    color: #6B7280;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn:hover {
    color: #4F46E5;
    background: #E5E7EB;
}

.view-btn.active {
    background: white;
    color: #4F46E5;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.filter-box select {
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    background: white;
    min-width: 150px;
}

.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
    width: 100%;
}

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

/* ===================== TABLE/LIST VIEW STYLES ===================== */
.bookmarks-table {
    display: block !important;
    width: 100%;
    overflow-x: auto;
}

.table-header,
.table-row {
    min-width: 1050px;
    width: 100%;
}

.table-header {
    display: grid !important;
    grid-template-columns: 200px 350px 350px 150px !important;
    gap: 1rem;
    background: #F9FAFB;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
    border: 1px solid #E5E7EB;
    margin-bottom: 0.75rem;
}

.table-row {
    display: grid !important;
    grid-template-columns: 200px 350px 350px 150px !important;
    gap: 1rem;
    background: white;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    align-items: start;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 0.75rem;
}

.table-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.table-cell {
    min-width: 0;
    overflow: hidden;
}

.table-header .thumbnail-cell,
.table-row .thumbnail-cell {
    width: 200px !important;
    flex-shrink: 0;
}

.table-row .thumbnail-cell img {
    width: 200px !important;
    height: 100px !important;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.table-header .title-url-cell,
.table-row .title-url-cell {
    width: 350px !important;
}

.table-row .title-url-cell {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.table-row .title-url-cell .bookmark-title-link {
    color: #333;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-row .title-url-cell .bookmark-title-link:hover {
    color: #4F46E5;
}

.table-row .title-url-cell .bookmark-url-link {
    color: #6B7280;
    text-decoration: none;
    font-size: 0.85rem;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-row .title-url-cell .bookmark-url-link:hover {
    color: #4F46E5;
    text-decoration: underline;
}

.table-header .description-cell,
.table-row .description-cell {
    width: 350px !important;
}

.table-row .description-cell {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.table-header .tags-cell,
.table-row .tags-cell {
    width: 150px !important;
}

.table-row .tags-cell {
    color: #4F46E5;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.table-header .actions-cell,
.table-row .actions-cell {
    width: 100px !important;
}

.table-row .actions-cell {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-shrink: 0;
}

/* ===================== GRID VIEW STYLES ===================== */
.bookmark-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.bookmark-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.bookmark-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: #f0f0f0;
}

.bookmark-content {
    padding: 0.875rem;
}

.bookmark-title {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bookmark-title:hover {
    color: #4F46E5;
}

.bookmark-description {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bookmark-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    background: #EEF2FF;
    color: #4F46E5;
    border-radius: 9999px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}

.tag:hover {
    background: #E0E7FF;
}

.bookmark-link {
    color: #4F46E5;
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.icon-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    color: #6B7280;
    transition: all 0.2s;
    border-radius: 4px;
}

.icon-action-btn:hover {
    background: #F3F4F6;
    color: #4F46E5;
}

.icon-action-btn.delete:hover {
    background: #FEE2E2;
    color: #DC2626;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    padding: 1rem;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

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

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
}

.modal-body {
    padding: 1.5rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.url-input-group {
    display: flex;
    gap: 0.5rem;
}

.url-input-group input {
    flex: 1;
}

.fetch-btn {
    padding: 0.75rem 1.5rem;
    background: #4F46E5;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
}

.fetch-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.preview-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.preview-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.preview-content {
    padding: 1rem;
}

.preview-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.preview-description {
    color: #666;
    font-size: 0.9rem;
}

.tags-input-container {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0.5rem;
    min-height: 60px;
}

.tags-input-container:focus-within {
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #EEF2FF;
    color: #4F46E5;
    border-radius: 9999px;
    font-size: 0.9rem;
}

.remove-tag {
    background: none;
    border: none;
    cursor: pointer;
    color: #4F46E5;
    padding: 0;
    font-size: 1rem;
}

.tags-input-container input {
    border: none;
    outline: none;
    padding: 0.5rem;
    width: 100%;
}

.tag-suggestions {
    margin-top: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.tag-suggestion {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.tag-suggestion:hover {
    background: #f9fafb;
}

.tag-suggestion:last-child {
    border-bottom: none;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.save-btn {
    flex: 1;
    padding: 1rem;
    background: #4F46E5;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
}

.cancel-btn {
    padding: 1rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: #ccc;
    margin-bottom: 1rem;
}

.empty-state p {
    color: #666;
    font-size: 1.1rem;
}

.loading-indicator {
    text-align: center;
    padding: 2rem;
    display: none;
}

.loading-indicator.active {
    display: block;
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4F46E5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===================== PRINT STYLES ===================== */
@media print {
    body {
        background: white;
    }
    
    .header {
        position: static;
        box-shadow: none;
        border-bottom: 2px solid #000;
    }
    
    .user-section,
    .add-btn,
    .search-filter,
    .view-toggle,
    .icon-action-btn,
    .modal {
        display: none !important;
    }
    
    .container {
        max-width: 100%;
        margin: 0;
        padding: 0;
    }
    
    .bookmarks-grid {
        display: block;
    }
    
    .bookmark-card {
        page-break-inside: avoid;
        break-inside: avoid;
        margin-bottom: 1rem;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .bookmarks-table {
        overflow-x: visible;
    }
    
    .table-row {
        page-break-inside: avoid;
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}


/* ===================== TAGS MANAGER SPECIFIC STYLES ===================== */
.tags-page-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.add-tag-section {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.add-tag-form {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.add-tag-form input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.add-tag-form input:focus {
    outline: none;
    border-color: #7C3AED;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.btn-add-tag {
    padding: 0.75rem 1.5rem;
    background: #7C3AED;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-add-tag:hover {
    background: #6D28D9;
}

.tags-list {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

.tags-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

.tags-header h2 {
    font-size: 1.5rem;
    color: #333;
    margin: 0;
}

.stats {
    color: #666;
    font-size: 0.9rem;
}

.tags-table {
    width: 100%;
    border-collapse: collapse;
}

.tags-table thead {
    background: #F9FAFB;
}

.tags-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
}

.tags-table td {
    padding: 1rem;
    border-top: 1px solid #f0f0f0;
}

.tags-table tr:hover {
    background: #f9fafb;
}

.tag-name {
    font-weight: 600;
    color: #7C3AED;
}

.tag-count {
    color: #666;
    background: #F3F4F6;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.85rem;
}

.tag-date {
    color: #666;
    font-size: 0.9rem;
}

.tag-actions {
    display: flex;
    gap: 0.5rem;
}

.tag-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    color: #6B7280;
    transition: all 0.2s;
    border-radius: 4px;
}

.tag-action-btn:hover {
    background: #F3F4F6;
    color: #7C3AED;
}

.tag-action-btn.delete:hover {
    background: #FEE2E2;
    color: #DC2626;
}

/* Alert Messages */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideDown 0.3s;
}

.alert-success {
    background: #D1FAE5;
    color: #065F46;
}

.alert-error {
    background: #FEE2E2;
    color: #991B1B;
}

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

/* ===================== RESPONSIVE - TAGS MANAGER ===================== */

/* ===================== RESPONSIVE MOBILE STYLES ===================== */

/* Tablet: 768px - 1024px */
@media (max-width: 1024px) {
    .header-content {
        padding: 0.75rem;
    }
    
    .container {
        padding: 0.75rem;
    }
    
    .bookmarks-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* Mobile: up to 768px */
@media (max-width: 768px) {
    /* ===== HEADER FIXES ===== */
    .header-content {
        padding: 0.75rem;
    }
    
    .header-top {
        flex-direction: column;
        gap: 0.75rem;
        margin-bottom: 1rem;
        align-items: stretch;
    }
    
    .logo {
        font-size: 1.25rem;
        align-self: flex-start;
    }
    
    .logo svg {
        width: 24px;
        height: 24px;
    }
    
    /* User section: buttons + avatar in one row */
    .user-section {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
        flex-wrap: nowrap;
    }
    
    /* Make buttons same size and fit in row */
    .add-btn {
        padding: 0.65rem 1rem;
        font-size: 0.9rem;
        flex: 1;
        justify-content: center;
        white-space: nowrap;
        min-width: 0;
    }
    
    .add-btn span {
        display: inline;
    }
    
    .add-btn svg {
        width: 18px;
        height: 18px;
        flex-shrink: 0;
    }
    
    .user-menu {
        margin-left: 0;
        flex-shrink: 0;
    }
    
    .user-avatar {
        width: 40px;
        height: 40px;
    }
    
    .user-dropdown {
        right: 0;
        left: auto;
    }
    
    /* ===== SEARCH AND FILTERS ===== */
    .search-filter {
        flex-direction: column;
        gap: 0.75rem;
    }

    .search-box {
        width: 100%;
        min-width: 100%;
    }
    
    .search-box input {
        font-size: 0.95rem;
        padding: 0.65rem 0.65rem 0.65rem 2.5rem;
    }
    
    .clear-search-btn {
        right: 0.65rem;
    }
    
    .filter-box {
        width: 100%;
    }
    
    .filter-box select {
        width: 100%;
        font-size: 0.95rem;
        padding: 0.65rem;
    }
    
    .sort-box {
        width: 100%;
    }
    
    .sort-box select {
        width: 100%;
        font-size: 0.95rem;
        padding: 0.65rem 2rem 0.65rem 0.65rem;
    }

    /* View toggle buttons */
    .view-toggle {
        width: 100%;
        justify-content: center;
        gap: 0.5rem;
    }
    
    .view-btn {
        flex: 1;
        max-width: 100px;
        padding: 0.65rem;
    }
    
    /* ===== GRID VIEW ===== */
    .bookmarks-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
        padding: 1rem 0;
    }
    
    .bookmark-card {
        padding: 1rem;
    }
    
    .bookmark-thumbnail {
        height: 140px;
    }
    
    .bookmark-title {
        font-size: 0.95rem;
    }
    
    .bookmark-description {
        font-size: 0.85rem;
    }
    
    .bookmark-url {
        font-size: 0.8rem;
    }
    
    .bookmark-tag {
        font-size: 0.8rem;
        padding: 0.35rem 0.65rem;
    }
    
    .icon-action-btn {
        width: 36px;
        height: 36px;
    }

    /* ===== TABLE/LIST VIEW ===== */
    .table-header {
        display: none !important;
    }
    
    .table-row {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
        min-width: 0 !important;
        padding: 1rem;
    }

    .table-row .thumbnail-cell img {
        width: 100% !important;
        height: 160px !important;
        object-fit: cover;
    }

    .table-row .title-url-cell .bookmark-title-link,
    .table-row .title-url-cell .bookmark-url-link,
    .table-row .description-cell,
    .table-row .tags-cell {
        white-space: normal;
    }

    .table-row .actions-cell {
        justify-content: flex-start;
        gap: 0.5rem;
    }
    
    /* ===== MODALS ===== */
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 1rem auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-header h2 {
        font-size: 1.25rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-actions {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }
    
    .modal-actions .save-btn,
    .modal-actions .cancel-btn {
        width: 100%;
        padding: 0.875rem;
    }
    
    .form-group label {
        font-size: 0.95rem;
    }
    
    .form-group input,
    .form-group select {
        font-size: 0.95rem;
        padding: 0.65rem;
    }
    
    /* ===== TAGS MANAGER PAGE ===== */
    .tags-page-container {
        padding: 0 0.75rem;
        margin: 1rem auto;
    }
    
    .add-tag-form {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .add-tag-form input {
        font-size: 0.95rem;
    }

    .btn-add-tag {
        width: 100%;
        padding: 0.875rem;
    }
    
    .tags-table {
        font-size: 0.9rem;
        display: block;
        overflow-x: auto;
    }

    .tags-table thead {
        display: none;
    }
    
    .tags-table tbody {
        display: block;
    }
    
    .tags-table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 1rem;
        background: white;
    }
    
    .tags-table td {
        display: block;
        text-align: left !important;
        padding: 0.5rem 0;
        border: none;
    }
    
    .tags-table td::before {
        content: attr(data-label);
        font-weight: 600;
        display: inline-block;
        width: 100px;
        color: #666;
    }
    
    .tag-actions {
        justify-content: flex-start;
        margin-top: 0.5rem;
    }
    
    /* ===== CONTAINER ===== */
    .container {
        padding: 0.5rem;
    }
    
    /* ===== EMPTY STATE ===== */
    .empty-state {
        padding: 3rem 1rem;
    }
    
    .empty-state svg {
        width: 48px;
        height: 48px;
    }
    
    .empty-state p {
        font-size: 0.95rem;
    }
}

/* Small mobile: up to 480px */
@media (max-width: 480px) {
    .header-content {
        padding: 0.5rem;
    }
    
    .header-top {
        gap: 0.5rem;
    }
    
    .logo {
        font-size: 1.1rem;
    }
    
    .logo span {
        display: inline;
    }
    
    /* Stack buttons vertically on very small screens */
    .user-section {
        flex-wrap: wrap;
    }
    
    .add-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        flex: 1 1 45%;
        min-width: 0;
    }
    
    .add-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .user-menu {
        flex: 0 0 auto;
        width: 100%;
        text-align: right;
        margin-top: 0.5rem;
    }
    
    .user-avatar {
        width: 36px;
        height: 36px;
    }
    
    /* Single column grid */
    .bookmarks-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .bookmark-card {
        padding: 0.875rem;
    }
    
    .bookmark-thumbnail {
        height: 180px;
    }
    
    .view-btn {
        padding: 0.5rem;
        max-width: 80px;
    }
    
    .view-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .search-box input {
        font-size: 0.9rem;
        padding: 0.6rem 0.6rem 0.6rem 2.25rem;
    }
    
    .search-icon {
        width: 18px;
        height: 18px;
        left: 0.6rem;
    }
    
    .filter-box select {
        font-size: 0.9rem;
        padding: 0.6rem;
    }
    
    .sort-box select {
        font-size: 0.9rem;
        padding: 0.6rem 2rem 0.6rem 0.6rem;
    }
    
    .modal-content {
        width: 98%;
        margin: 0.5rem auto;
    }
    
    .tags-page-container {
        padding: 0 0.5rem;
    }
}

/* Extra small: up to 360px */
@media (max-width: 360px) {
    .add-btn span {
        font-size: 0.8rem;
    }
    
    .logo {
        font-size: 1rem;
    }
    
    .bookmarks-grid {
        gap: 0.75rem;
    }
    
    .bookmark-card {
        padding: 0.75rem;
    }
    
    .view-toggle {
        gap: 0.25rem;
    }
    
    .view-btn {
        max-width: 70px;
        padding: 0.5rem 0.25rem;
    }
}

/* ===================== THEME TOGGLE BUTTON ===================== */
.theme-toggle {
    padding: 0.6rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--purple-primary);
}

.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
    transition: transform 0.3s ease;
}

.theme-toggle:hover .sun-icon,
.theme-toggle:hover .moon-icon {
    transform: rotate(20deg);
}

/* Initially hide sun icon (shown in dark mode) */
.theme-toggle .sun-icon {
    display: none;
}

/* ===================== DARK MODE OVERRIDES ===================== */

/* Cards and containers */
.bookmark-card,
.table-row,
.tags-page-container .add-tag-section,
.tags-list,
.modal-content {
    background: var(--bg-card);
    border-color: var(--border-color);
    box-shadow: var(--shadow-md);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.bookmark-card:hover,
.table-row:hover {
    box-shadow: var(--shadow-lg);
}

/* Text colors */
.bookmark-title,
.bookmark-title-link,
.tag-name,
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
}

.bookmark-description,
.bookmark-url,
.tag-count,
.tag-date,
.user-email,
p {
    color: var(--text-secondary);
}

/* Inputs and selects */
.search-box input,
.filter-box select,
.sort-box select,
.form-group input,
.form-group select,
.tags-input-container {
    background: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.search-box input::placeholder,
.form-group input::placeholder {
    color: var(--text-tertiary);
}

.search-box input:focus,
.filter-box select:focus,
.sort-box select:focus,
.form-group input:focus,
.tags-input-container:focus-within {
    border-color: var(--purple-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* Buttons */
.add-btn,
.view-btn,
.theme-toggle,
.icon-action-btn,
.tag-action-btn {
    background: var(--bg-primary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.add-btn:hover,
.view-btn:hover,
.icon-action-btn:hover,
.tag-action-btn:hover {
    background: var(--bg-hover);
}

/* Primary purple buttons */
.add-btn[style*="background: #7C3AED"],
.save-btn,
.btn-add-tag,
.fetch-btn {
    background: var(--purple-primary) !important;
    color: white !important;
}

.add-btn[style*="background: #7C3AED"]:hover,
.save-btn:hover,
.btn-add-tag:hover,
.fetch-btn:hover {
    background: var(--purple-hover) !important;
}

/* Delete buttons */
.icon-action-btn.delete,
.tag-action-btn.delete {
    color: var(--red-primary);
}

.icon-action-btn.delete:hover,
.tag-action-btn.delete:hover {
    background: var(--red-primary);
    color: white;
}

/* Tags */
.bookmark-tag,
.selected-tag {
    background: var(--purple-light);
    color: var(--purple-primary);
}

.tag-suggestion {
    background: var(--bg-primary);
    border-color: var(--border-light);
}

.tag-suggestion:hover {
    background: var(--bg-hover);
}

.tag-suggestion.create-new {
    background: var(--purple-light);
    color: var(--purple-primary);
    border-left-color: var(--purple-primary);
}

/* User dropdown */
.user-dropdown {
    background: var(--bg-card);
    border-color: var(--border-color);
    box-shadow: var(--shadow-lg);
}

.user-name {
    color: var(--text-primary);
}

.user-email {
    color: var(--text-secondary);
}

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

/* Empty state */
.empty-state {
    color: var(--text-secondary);
}

.empty-state svg {
    color: var(--text-tertiary);
}

/* Loading indicator */
.loading-indicator {
    color: var(--text-secondary);
}

/* Modal overlay */
.modal {
    background: rgba(0, 0, 0, 0.5);
}

.dark-mode .modal {
    background: rgba(0, 0, 0, 0.7);
}

/* View toggle active state */
.view-btn.active {
    background: var(--purple-primary);
    color: white;
}

/* Tables */
.tags-table {
    background: var(--bg-card);
}

.tags-table th {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.tags-table td {
    border-color: var(--border-light);
    color: var(--text-primary);
}

.tags-table tbody tr:hover {
    background: var(--bg-hover);
}

/* Alerts */
.alert {
    box-shadow: var(--shadow-md);
}

/* Links */
a {
    color: var(--purple-primary);
}

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

/* Smooth transitions for theme change */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Prevent transition on page load */
.no-transition * {
    transition: none !important;
}


/* ===================== MOBILE SWIPE GESTURES ===================== */

/* Wrapper for swipeable cards */
.bookmark-card-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

/* Swipe action buttons (hidden by default) */
.swipe-actions-left,
.swipe-actions-right {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.swipe-actions-left {
    left: 0;
    background: linear-gradient(90deg, var(--purple-primary) 0%, var(--purple-hover) 100%);
}

.swipe-actions-right {
    right: 0;
    background: linear-gradient(90deg, var(--red-hover) 0%, var(--red-primary) 100%);
}

/* Show action buttons when swiping */
.bookmark-card-wrapper.swiping-right .swipe-actions-left {
    opacity: 1;
}

.bookmark-card-wrapper.swiping-left .swipe-actions-right {
    opacity: 1;
}

/* Swipe action button styling */
.swipe-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: white;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.swipe-action-btn svg {
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

/* Swipeable card positioning */
.bookmark-card-wrapper .bookmark-card {
    position: relative;
    z-index: 2;
    background: var(--bg-card);
    transition: transform 0.3s ease;
    touch-action: pan-y; /* Allow vertical scrolling */
}

/* Prevent text selection during swipe */
.bookmark-card-wrapper .bookmark-card.swiping {
    user-select: none;
    -webkit-user-select: none;
}

/* Quick actions overlay (long press) */
.quick-actions-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.quick-actions-overlay.active {
    opacity: 1;
}

.quick-actions-menu {
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 500px;
    padding: 1.5rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
}

.quick-actions-overlay.active .quick-actions-menu {
    transform: translateY(0);
}

.quick-actions-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    text-align: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.quick-action-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.quick-action-btn:last-child {
    margin-bottom: 0;
}

.quick-action-btn:hover {
    background: var(--bg-primary);
    border-color: var(--purple-primary);
    transform: translateX(4px);
}

.quick-action-btn.delete-action {
    color: var(--red-primary);
}

.quick-action-btn.delete-action:hover {
    background: var(--red-primary);
    color: white;
    border-color: var(--red-primary);
}

.quick-action-btn svg {
    flex-shrink: 0;
}

/* Haptic feedback indicator */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.bookmark-card-wrapper .bookmark-card.long-press-active {
    animation: pulse 0.3s ease;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    /* Make swipe more prominent on mobile */
    .swipe-actions-left,
    .swipe-actions-right {
        width: 100px;
    }
    
    .swipe-action-btn {
        font-size: 0.75rem;
    }
}

/* Desktop: hide swipe actions */
@media (min-width: 769px) {
    .bookmark-card-wrapper {
        overflow: visible;
    }
    
    .swipe-actions-left,
    .swipe-actions-right {
        display: none;
    }
}

/* Smooth transition when card snaps back */
.bookmark-card[style*="transform"] {
    will-change: transform;
}

/* Prevent scroll during swipe on mobile */
body.swiping {
    overflow: hidden;
    touch-action: none;
}/* ============================================
   CONTACT FORM STYLES
   Add this to the end of custom.css
   ============================================ */

/* Contact Page Container */
.contact-container {
    max-width: 700px;
    margin: 40px auto;
    padding: 20px;
}

.contact-header {
    text-align: center;
    margin-bottom: 40px;
}

.contact-header h1 {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 700;
}

.contact-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Contact Form Card */
.contact-form-card {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Form Groups */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

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

.form-input:focus {
    outline: none;
    border-color: var(--purple-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

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

/* Textarea */
.form-textarea {
    min-height: 150px;
    resize: vertical;
    line-height: 1.6;
}

/* Character Counter */
.char-counter {
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-top: -4px;
}

/* Honeypot (spam protection) */
.honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* Submit Button */
.submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--purple-primary) 0%, var(--purple-hover) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

.submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

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

/* Loading spinner animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.submit-btn:disabled svg {
    animation: spin 1s linear infinite;
}

/* Alert Messages */
.alert {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-weight: 500;
    animation: slideDown 0.3s ease;
}

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

.alert svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.alert-success {
    background: #D1FAE5;
    color: #065F46;
    border: 2px solid var(--green-primary);
}

.alert-error {
    background: #FEE2E2;
    color: #991B1B;
    border: 2px solid var(--red-primary);
}

/* Dark mode alert adjustments */
.dark-mode .alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: #6EE7B7;
    border-color: var(--green-primary);
}

.dark-mode .alert-error {
    background: rgba(239, 68, 68, 0.15);
    color: #FCA5A5;
    border-color: var(--red-primary);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .contact-container {
        margin-top: 20px;
        padding: 16px;
    }
    
    .contact-header h1 {
        font-size: 2rem;
    }
    
    .contact-header p {
        font-size: 1rem;
    }
    
    .contact-form-card {
        padding: 24px;
    }
    
    .form-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .submit-btn {
        padding: 16px 24px;
        font-size: 1.05rem;
    }
}

@media (max-width: 480px) {
    .contact-header h1 {
        font-size: 1.75rem;
    }
    
    .contact-form-card {
        padding: 20px;
    }
    
    .form-input {
        padding: 14px;
    }
}

/* Tablet landscape */
@media (min-width: 769px) and (max-width: 1024px) {
    .contact-container {
        max-width: 650px;
    }
}

/* Extra focus states for accessibility */
.form-input:focus-visible {
    outline: 2px solid var(--purple-primary);
    outline-offset: 2px;
}

.submit-btn:focus-visible {
    outline: 2px solid var(--purple-primary);
    outline-offset: 2px;
}

/* Smooth transitions for dark mode */
.contact-form-card,
.form-input,
.alert {
    transition: all 0.3s ease;
}


/* ============================================
   MOBILE OPTIMIZATION FIXES
   Add these to the END of your custom.css file
   ============================================ */

/* Fix for mobile - reduce header height */
@media (max-width: 768px) {
    
    /* Compact header on mobile */
    .header {
        padding: 12px 16px !important;
        min-height: auto !important;
    }
    
    .logo-section h1 {
        font-size: 1.1rem !important;
    }
    
    .logo-icon {
        width: 24px !important;
        height: 24px !important;
    }
    
    /* Make user section more compact */
    .user-section {
        gap: 8px !important;
    }
    
    .add-btn {
        padding: 8px 12px !important;
        font-size: 0.85rem !important;
    }
    
    .add-btn svg {
        width: 16px !important;
        height: 16px !important;
    }
    
    .add-btn span {
        display: none !important; /* Hide text, show only icons on mobile */
    }
    
    .theme-toggle {
        width: 36px !important;
        height: 36px !important;
        padding: 8px !important;
    }
    
    .user-avatar {
        width: 36px !important;
        height: 36px !important;
    }
    
    /* Contact icon - keep it visible but smaller */
    .add-btn[href="contact.html"] {
        padding: 8px !important;
        min-width: 36px !important;
    }
    
    /* Reduce controls section height */
    .controls {
        padding: 12px 16px !important;
        gap: 8px !important;
        flex-wrap: wrap !important;
    }
    
    /* Make search box take full width on mobile */
    .search-box {
        width: 100% !important;
        order: 1;
        margin-bottom: 8px;
    }
    
    /* Make filter dropdowns smaller */
    .filter-select {
        font-size: 0.85rem !important;
        padding: 8px 12px !important;
        min-width: 100px !important;
    }
    
    /* View toggles on same line */
    .view-toggle {
        order: 3;
    }
    
    /* Reduce gap in view toggle */
    .view-toggle {
        gap: 4px !important;
        padding: 4px !important;
    }
    
    .view-btn {
        padding: 8px !important;
    }
    
    .view-btn svg {
        width: 18px !important;
        height: 18px !important;
    }
    
    /* CRITICAL: Ensure bookmarks grid shows on mobile */
    .bookmarks-grid {
        display: grid !important;
        grid-template-columns: 1fr !important; /* Single column on mobile */
        gap: 16px !important;
        padding: 16px !important;
        margin-top: 0 !important;
    }
    
    /* CRITICAL: Ensure bookmarks list shows on mobile */
    .bookmarks-list {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        padding: 16px !important;
    }
    
    /* Make bookmark cards full width and touch-friendly */
    .bookmark-card {
        width: 100% !important;
        min-height: 120px !important;
    }
    
    .bookmark-image {
        height: 140px !important; /* Slightly taller for mobile */
    }
    
    .bookmark-content {
        padding: 12px !important;
    }
    
    .bookmark-title {
        font-size: 0.95rem !important;
        line-height: 1.4 !important;
    }
    
    .bookmark-description {
        font-size: 0.85rem !important;
        line-height: 1.4 !important;
        max-height: 2.8em !important; /* 2 lines */
    }
    
    /* Touch-friendly action buttons */
    .bookmark-actions {
        padding: 12px !important;
        gap: 16px !important;
    }
    
    .bookmark-actions button,
    .bookmark-actions a {
        min-width: 44px !important; /* iOS minimum touch target */
        min-height: 44px !important;
        padding: 12px !important;
    }
    
    /* Ensure swipe gestures work */
    .bookmark-card {
        touch-action: pan-y !important; /* Allow vertical scroll, enable horizontal swipe */
        user-select: none !important;
    }
    
    /* Make sure container doesn't prevent scrolling */
    .container {
        padding: 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    /* List view optimizations */
    .table-row {
        padding: 12px !important;
        gap: 12px !important;
    }
    
    .table-row-image {
        width: 60px !important;
        height: 60px !important;
        flex-shrink: 0 !important;
    }
    
    .table-row-content {
        min-width: 0 !important;
        flex: 1 !important;
    }
    
    /* Modals - make them fullscreen on mobile */
    .modal-content {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        border-radius: 0 !important;
        margin: 0 !important;
    }
    
    .modal-header {
        padding: 16px !important;
    }
    
    .modal-body {
        padding: 16px !important;
    }
    
    /* Form inputs - prevent zoom on iOS */
    input[type="text"],
    input[type="url"],
    input[type="search"],
    textarea,
    select {
        font-size: 16px !important; /* Prevents iOS zoom */
    }
    
    /* Tag chips - make them wrap nicely */
    .tag-chips {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
    }
    
    .tag-chip {
        font-size: 0.8rem !important;
        padding: 4px 10px !important;
    }
}

/* Extra small phones (< 400px) */
@media (max-width: 400px) {
    .header {
        padding: 10px 12px !important;
    }
    
    .logo-section h1 {
        font-size: 1rem !important;
    }
    
    .user-section {
        gap: 6px !important;
    }
    
    .add-btn,
    .theme-toggle {
        width: 32px !important;
        height: 32px !important;
        padding: 6px !important;
    }
    
    .filter-select {
        min-width: 90px !important;
        font-size: 0.8rem !important;
    }
    
    .bookmarks-grid {
        padding: 12px !important;
        gap: 12px !important;
    }
}

/* Landscape mode on phones */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        padding: 8px 16px !important;
    }
    
    .controls {
        padding: 8px 16px !important;
    }
    
    .bookmark-image {
        height: 100px !important;
    }
}

/* ============================================
   SWIPE GESTURE VISUAL HINTS
   ============================================ */

/* Add swipe hint overlay for first-time users */
.swipe-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--purple-primary);
    color: white;
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
    display: none;
    align-items: center;
    gap: 8px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.swipe-hint.show {
    display: flex;
}

.swipe-hint svg {
    width: 20px;
    height: 20px;
}

/* Add subtle arrow indicators on bookmark cards */
.bookmark-card::before,
.bookmark-card::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.bookmark-card::before {
    left: 10px;
    border-width: 8px 12px 8px 0;
    border-color: transparent #EF4444 transparent transparent;
}

.bookmark-card::after {
    right: 10px;
    border-width: 8px 0 8px 12px;
    border-color: transparent transparent transparent #10B981;
}

.bookmark-card:hover::before,
.bookmark-card:hover::after {
    opacity: 0.3;
}

@media (max-width: 768px) {
    .bookmark-card:hover::before,
    .bookmark-card:hover::after {
        opacity: 0; /* Don't show on mobile hover */
    }
}

/* ============================================
   EMPTY STATE IMPROVEMENTS
   ============================================ */

.empty-state {
    padding: 60px 20px;
    text-align: center;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 1.25rem;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 0.95rem;
    line-height: 1.6;
}

.empty-state .add-btn {
    display: inline-flex;
}

@media (max-width: 768px) {
    .empty-state {
        padding: 40px 20px;
    }
    
    .empty-state-icon {
        font-size: 3rem;
    }
    
    .empty-state h3 {
        font-size: 1.1rem;
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Use GPU acceleration for animations */
.bookmark-card,
.modal-content,
.user-dropdown {
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Prevent pull-to-refresh on mobile */
body {
    overscroll-behavior-y: contain;
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */

/* Increase tap target sizes on mobile */
@media (max-width: 768px) {
    button,
    a,
    .clickable {
        min-width: 44px;
        min-height: 44px;
        padding: 12px;
    }
    
    /* Focus visible for keyboard navigation */
    *:focus-visible {
        outline: 2px solid var(--purple-primary);
        outline-offset: 2px;
    }
}

/* ============================================
/* ============================================
   ULTRA-COMPACT HEADER - All buttons on ONE line
   Add this to the END of custom.css
   This replaces the previous mobile header CSS
   ============================================ */

@media (max-width: 768px) {
    /* CRITICAL: Make header single line */
    .header {
        padding: 8px 12px !important;
        min-height: 0 !important;
    }
    
    .header-content {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    .header-top {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        gap: 8px !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Logo section - compact */
    .logo {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        flex-shrink: 1 !important;
        min-width: 0 !important;
    }
    
    .logo svg {
        width: 18px !important;
        height: 18px !important;
        flex-shrink: 0 !important;
    }
    
    .logo span {
        font-size: 0.9rem !important;
        font-weight: 600 !important;
        white-space: nowrap !important;
    }
    
    /* User section - all on one line */
    .user-section {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        flex-shrink: 0 !important;
    }
    
    /* All buttons same size - compact */
    .add-btn,
    .theme-toggle {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        min-height: 34px !important;
        padding: 7px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
        border-radius: 8px !important;
    }
    
    .add-btn svg,
    .theme-toggle svg {
        width: 16px !important;
        height: 16px !important;
        margin: 0 !important;
    }
    
    /* Hide button text */
    .add-btn span {
        display: none !important;
    }
    
    /* User avatar */
    .user-avatar {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        min-height: 34px !important;
        flex-shrink: 0 !important;
    }
    
    .user-menu {
        flex-shrink: 0 !important;
    }
    
    /* Search-filter section - ultra compact */
    .search-filter {
        padding: 8px 12px !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 6px !important;
    }
    
    /* Search box full width */
    .search-box {
        width: 100% !important;
        height: 36px !important;
        margin: 0 !important;
    }
    
    .search-box input {
        font-size: 14px !important;
        padding: 8px 12px 8px 34px !important;
        height: 36px !important;
    }
    
    .search-icon {
        left: 10px !important;
        width: 16px !important;
        height: 16px !important;
    }
    
    /* Filters and view toggle on one row */
    .filter-box,
    .sort-box,
    .view-toggle {
        display: inline-flex !important;
        align-items: center !important;
    }
    
    .filter-box,
    .sort-box {
        flex: 1 !important;
    }
    
    .filter-box select,
    .sort-box select {
        font-size: 13px !important;
        padding: 8px 26px 8px 10px !important;
        height: 36px !important;
        width: 100% !important;
    }
    
    .view-toggle {
        gap: 4px !important;
        padding: 3px !important;
        flex-shrink: 0 !important;
        margin-left: 6px !important;
    }
    
    .view-btn {
        width: 32px !important;
        height: 32px !important;
        padding: 6px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .view-btn svg {
        width: 16px !important;
        height: 16px !important;
    }
    
    /* CRITICAL: Reduce space above bookmarks */
    .container {
        padding: 0 !important;
        margin-top: 0 !important;
    }
    
    .bookmarks-grid {
        padding: 12px !important;
        padding-top: 8px !important;
        margin-top: 0 !important;
        gap: 12px !important;
    }
    
    .bookmarks-list {
        padding: 12px !important;
        padding-top: 8px !important;
        gap: 10px !important;
    }
}

/* Extra small phones - even more compact */
@media (max-width: 400px) {
    .header {
        padding: 6px 10px !important;
    }
    
    .logo svg {
        width: 16px !important;
        height: 16px !important;
    }
    
    .logo span {
        font-size: 0.85rem !important;
    }
    
    .add-btn,
    .theme-toggle,
    .user-avatar {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        min-height: 32px !important;
        padding: 6px !important;
    }
    
    .user-section {
        gap: 5px !important;
    }
    
    .search-filter {
        padding: 6px 10px !important;
    }
}

/* Ensure buttons don't wrap */
@media (max-width: 768px) {
    .header-top {
        flex-wrap: nowrap !important;
    }
    
    .user-section {
        flex-wrap: nowrap !important;
    }
    
    /* Make logo text shrink if needed */
    .logo {
        overflow: hidden !important;
    }
    
    .logo span {
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
}