/* ========================================
   CSS Variables - Light & Dark Theme
   ======================================== */
:root {
    --category-title-size: 10px;
    --category-icon-size: 13px;
    --category-icon-font: 9px;
    --bookmark-title-size: 12px;
    --bookmark-icon-size: 18px;
    --bookmark-icon-img: 14px;
    --bookmark-columns: 4;
    /* Widget Scales */
    --weather-widget-scale: 1;
    --clock-widget-scale: 1;
    --currency-widget-scale: 1;
    --stock-widget-scale: 1;
    --search-widget-scale: 1;
    --footer-widget-scale: 1;
}

:root[data-theme="light"] {
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8ecf1;
    --bg-hover: #f0f4f8;
    --modal-bg: #fafbfc;
    
    --text-primary: #1a1a2e;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --success-color: #10b981;
}

:root[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-hover: #2d3748;
    --modal-bg: #2a3548;
    
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    
    --border-color: #334155;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    
    --primary-color: #60a5fa;
    --primary-hover: #3b82f6;
    --danger-color: #f87171;
    --danger-hover: #ef4444;
    --success-color: #34d399;
}

/* ========================================
   Global Styles
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    background-image: var(--bg-image, none);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

/* ========================================
   Header
   ======================================== */
.header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.header-content {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    min-height: fit-content;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo i {
    font-size: 28px;
    color: var(--primary-color);
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Search */
.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-container i {
    position: absolute;
    left: 16px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-input {
    padding: 10px 16px 10px 44px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    width: 300px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Theme Toggle */
.theme-toggle {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 8px;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background-color: var(--bg-hover);
    transform: scale(1.05);
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

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

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

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

/* ========================================
   Widgets
   ======================================== */
/* Common Widget Styles */
.widget {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    cursor: pointer;
    padding: 8px 16px;
    background-color: var(--bg-tertiary);
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.widget:hover {
    background-color: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.widget.drag-over {
    border-color: #10b981;
    background-color: rgba(16, 185, 129, 0.1);
    transform: scale(1.05);
}

.widget-settings-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border: none;
    background-color: rgba(0, 0, 0, 0.1);
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
}

.widget:hover .widget-settings-btn {
    opacity: 1;
}

.widget-settings-btn:hover {
    background-color: var(--primary-color);
    color: white;
    transform: rotate(90deg);
}

/* Weather Widget */
.weather-widget {
    transform: scale(var(--weather-widget-scale));
    transform-origin: left center;
}

.weather-widget:hover {
    transform: scale(var(--weather-widget-scale)) translateY(-2px);
}

.weather-compact {
    display: flex;
    align-items: center;
    gap: 8px;
}

.weather-compact > i {
    font-size: 24px;
    color: var(--primary-color);
    flex-shrink: 0;
}

.weather-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.weather-temp {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.weather-location {
    font-size: 12px;
    color: var(--text-secondary);
}

.weather-extra {
    display: flex;
    gap: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

.weather-extra span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.weather-extra i {
    font-size: 10px;
}

/* Weather Detail Modal */
.weather-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.weather-detail-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background-color: var(--bg-tertiary);
    border-radius: 12px;
}

.weather-detail-item i {
    font-size: 24px;
    color: var(--primary-color);
}

.detail-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.detail-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.weather-forecast {
    margin-top: 24px;
}

/* Clock Widget */
.clock-widget {
    flex-direction: column;
    align-items: center;
    padding: 8px 24px;
    transform: scale(var(--clock-widget-scale));
    transform-origin: center;
}

.clock-time {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Inter', monospace;
}

.clock-time.blink .colon {
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 49% {
        opacity: 1;
    }
    50%, 100% {
        opacity: 0;
    }
}

.clock-date {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Currency Widget */
.currency-widget {
    display: flex;
    gap: 12px;
    padding: 8px 16px;
    background-color: var(--bg-tertiary);
    border-radius: 12px;
    transform: scale(var(--currency-widget-scale));
    transform-origin: center;
}

.currency-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.currency-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
}

.currency-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
}

/* Stock Widget */
.stock-widget {
    display: flex;
    gap: 12px;
    padding: 8px 16px;
    background-color: var(--bg-tertiary);
    border-radius: 12px;
    transform: scale(var(--stock-widget-scale));
    transform-origin: center;
}

.stock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stock-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
}

.stock-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
}

.stock-value.up {
    color: #ef4444;
}

.stock-value.down {
    color: #3b82f6;
}

/* Search Widget */
.search-widget {
    flex: 1;
    max-width: 600px;
    display: flex;
    gap: 8px;
    padding: 6px;
    background-color: var(--bg-tertiary);
    border-radius: 12px;
    transform: scale(var(--search-widget-scale));
    transform-origin: center;
}

.search-engine-favicon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
    margin-left: 4px;
}

.search-engine-select {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    min-width: 100px;
}

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

.search-engine-select:focus {
    background-color: var(--bg-hover);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-engine-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.search-engine-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.search-engine-item input {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
}

.search-engine-item button {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background-color: var(--danger);
    color: white;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

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

.stock-symbol-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.stock-symbol-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.stock-symbol-item input {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
}

.stock-symbol-item button {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background-color: var(--danger);
    color: white;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.stock-symbol-item button:hover {
    background-color: var(--danger-hover);
}

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

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

.search-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    background-color: var(--primary-hover);
    transform: scale(1.05);
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
    padding: 16px;
    min-height: calc(100vh - 100px);
}

.categories-wrapper {
    column-count: 2; /* 2컬럼 Masonry 레이아웃 */
    column-gap: 16px;
    padding-bottom: 16px;
}

/* Category Card */
.category-card {
    position: relative;
    break-inside: avoid; /* Masonry: 카드가 컬럼 중간에 잘리지 않게 */
    page-break-inside: avoid;
    margin-bottom: 16px; /* 카드 사이 간격 */
    background-color: var(--category-bg, var(--bg-secondary));
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 8px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    cursor: move;
}

.category-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.category-card.dragging {
    opacity: 0.4;
}

/* 다크모드에서 카테고리 카드 텍스트 색상 강제 적용 */
:root[data-theme="dark"] .category-card {
    color: var(--text-primary);
}

:root[data-theme="dark"] .category-card .category-title h2 {
    color: var(--text-primary) !important;
}

:root[data-theme="dark"] .category-card .bookmark-title {
    color: var(--text-primary) !important;
}

.category-card.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    user-select: none;
}

.category-title {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
}

.category-icon {
    width: var(--category-icon-size) !important;
    height: var(--category-icon-size) !important;
    border-radius: 4px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--category-icon-font) !important;
}

.category-title h2 {
    font-size: var(--category-title-size) !important;
    font-weight: 600;
    color: var(--text-primary);
}

.category-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.category-card:hover .category-actions {
    opacity: 1;
}

.icon-btn {
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 4px;
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    transition: all 0.3s ease;
}

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

.collapse-btn {
    transition: transform 0.3s ease;
}

.collapse-btn.collapsed {
    transform: rotate(-90deg);
}

/* Bookmarks Grid */
.bookmarks-grid {
    display: grid;
    grid-template-columns: repeat(var(--bookmark-columns), 1fr);
    gap: 4px;
    transition: all 0.3s ease;
}

.bookmarks-grid.collapsed {
    display: none;
}

/* Bookmark Card */
.bookmark-card {
    background-color: var(--bg-primary);
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 4px 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.bookmark-card.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

/* 드래그 앤 드롭 시각적 피드백 */
.category-card.drag-over-category {
    border: 2px dashed var(--primary-color);
    background-color: var(--bg-hover);
}

.bookmarks-grid.drag-over-grid {
    background-color: rgba(79, 70, 229, 0.05);
    border: 2px dashed var(--primary-color);
    border-radius: 8px;
    min-height: 80px;
}

:root[data-theme="dark"] .bookmarks-grid.drag-over-grid {
    background-color: rgba(79, 70, 229, 0.15);
}

.bookmark-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
    background-color: var(--bg-hover);
}

.bookmark-content {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bookmark-favicon {
    width: var(--bookmark-icon-size) !important;
    height: var(--bookmark-icon-size) !important;
    border-radius: 3px;
    background-color: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.bookmark-favicon img {
    width: var(--bookmark-icon-img) !important;
    height: var(--bookmark-icon-img) !important;
}

.bookmark-info {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.bookmark-title {
    font-size: var(--bookmark-title-size) !important;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.bookmark-description {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bookmark-actions {
    position: absolute;
    top: 2px;
    right: 2px;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bookmark-card:hover .bookmark-actions {
    opacity: 1;
}

.bookmark-actions .icon-btn {
    width: 20px;
    height: 20px;
    font-size: 9px;
}

/* Add Bookmark Button */
.add-bookmark-btn {
    background-color: var(--bg-secondary);
    border: 1px dashed var(--border-color);
    border-radius: 4px;
    padding: 4px 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-tertiary);
    font-weight: 500;
    font-size: 9px;
    min-height: 26px;
}

.add-bookmark-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: var(--bg-hover);
    border-style: solid;
}

.add-bookmark-btn i {
    font-size: 10px;
}

/* Add Category Card */
.add-category-card {
    background-color: var(--bg-secondary);
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 24px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 120px;
}

.add-category-card:hover {
    border-color: var(--primary-color);
    background-color: var(--bg-hover);
    border-style: solid;
    transform: translateY(-2px);
}

.add-category-card i {
    font-size: 24px;
    color: var(--text-tertiary);
    transition: all 0.3s ease;
}

.add-category-card:hover i {
    color: var(--primary-color);
    transform: scale(1.1);
}

.add-category-card span {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.add-category-card:hover span {
    color: var(--primary-color);
}

/* ========================================
   Modal
   ======================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: var(--modal-bg);
    border: 2px solid var(--primary-color);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

.modal-small {
    max-width: 400px;
}

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

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

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.3s ease;
}

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

.modal-body {
    padding: 24px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Form */
.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-group small {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.form-group small a {
    color: var(--primary-color);
    text-decoration: none;
}

.form-input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Color Picker */
.color-picker {
    width: 50px;
    height: 38px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.color-picker:hover {
    border-color: var(--primary-color);
}

/* Font Size Slider */
.font-slider {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    outline: none;
    -webkit-appearance: none;
}

.font-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.font-slider::-webkit-slider-thumb:hover {
    background: var(--primary-hover);
    transform: scale(1.2);
}

.font-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.font-slider::-moz-range-thumb:hover {
    background: var(--primary-hover);
    transform: scale(1.2);
}

/* Icon Picker Grid */
.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.icon-option {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
    color: var(--text-primary);
}

.icon-option:hover {
    background-color: var(--bg-hover);
    transform: scale(1.1);
    border-color: var(--primary-color);
}

.icon-option.selected {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.icon-option.selected::after {
    content: "✓";
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10px;
    background: white;
    color: var(--primary-color);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Color Palette */
.color-palette {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.color-option {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.color-option:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.color-option.selected {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.color-option.selected::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 16px;
    font-weight: bold;
    text-shadow: 0 0 3px rgba(0,0,0,0.5);
}

/* Background Preset Grid */
.bg-preset-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 8px;
}

.bg-preset {
    aspect-ratio: 16/9;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.bg-preset span {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-primary);
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    z-index: 1;
    padding: 4px 8px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.bg-preset:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.bg-preset.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.bg-preset.selected::after {
    content: "✓";
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* ========================================
   Footer Bookmark Bar
   ======================================== */
.footer-bookmark-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(var(--bg-secondary-rgb), 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    padding: calc(12px * var(--footer-widget-scale)) calc(24px * var(--footer-widget-scale));
    display: flex;
    justify-content: center;
    align-items: center;
    gap: calc(12px * var(--footer-widget-scale));
    z-index: 999;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
    transform-origin: bottom center;
    transition: all 0.3s ease;
}

/* RGB 변수 추가 (다크모드 대응) */
:root[data-theme="light"] {
    --bg-secondary-rgb: 255, 255, 255;
}

:root[data-theme="dark"] {
    --bg-secondary-rgb: 30, 41, 59;
}

.footer-bookmarks {
    display: flex;
    gap: calc(8px * var(--footer-widget-scale));
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-bookmark-item {
    position: relative;
    width: calc(48px * var(--footer-widget-scale));
    height: calc(48px * var(--footer-widget-scale));
    border-radius: calc(12px * var(--footer-widget-scale));
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.footer-bookmark-item:hover {
    background-color: var(--bg-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.footer-bookmark-item img {
    width: calc(28px * var(--footer-widget-scale));
    height: calc(28px * var(--footer-widget-scale));
    border-radius: calc(6px * var(--footer-widget-scale));
}

.footer-bookmark-delete {
    position: absolute;
    top: calc(-6px * var(--footer-widget-scale));
    right: calc(-6px * var(--footer-widget-scale));
    width: calc(20px * var(--footer-widget-scale));
    height: calc(20px * var(--footer-widget-scale));
    border-radius: 50%;
    background-color: var(--danger);
    border: 2px solid var(--bg-primary);
    color: white;
    font-size: calc(10px * var(--footer-widget-scale));
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
}

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

.footer-bookmark-delete:hover {
    background-color: var(--danger-hover);
    transform: scale(1.2);
}

.footer-settings-btn {
    width: calc(40px * var(--footer-widget-scale));
    height: calc(40px * var(--footer-widget-scale));
    border-radius: calc(10px * var(--footer-widget-scale));
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: calc(16px * var(--footer-widget-scale));
}

.footer-settings-btn:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: rotate(90deg);
}

.footer-add-btn {
    width: calc(48px * var(--footer-widget-scale));
    height: calc(48px * var(--footer-widget-scale));
    border-radius: calc(12px * var(--footer-widget-scale));
    background-color: var(--primary-color);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.footer-add-btn:hover {
    background-color: var(--primary-hover);
    transform: scale(1.1);
}

.footer-add-btn i {
    font-size: calc(18px * var(--footer-widget-scale));
}

/* Main Content Padding (푸터 공간 확보) */
.main-content {
    padding-bottom: 80px;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 1200px) {
    .categories-wrapper {
        grid-template-columns: 1fr;
    }
    
    .search-widget {
        max-width: 500px;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .widget {
        width: 100%;
    }
    
    .search-widget {
        max-width: 100%;
        order: 4;
    }
    
    .header-actions {
        width: auto;
        flex-wrap: nowrap;
    }
    
    .weather-widget {
        order: 1;
    }
    
    .clock-widget {
        order: 2;
    }
    
    .bookmarks-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .clock-time {
        font-size: 24px;
    }
    
    .weather-detail-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-bookmarks {
        gap: 6px;
    }
    
    .footer-bookmark-item {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .bookmarks-grid {
        grid-template-columns: 1fr;
    }
    
    .category-title h2 {
        font-size: 18px;
    }
    
    .clock-time {
        font-size: 20px;
    }
    
    .clock-date {
        font-size: 11px;
    }
    
    .weather-temp {
        font-size: 16px;
    }
    
    .weather-detail-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Drag and Drop Styles
   ======================================== */
.drag-over {
    border: 2px dashed var(--primary-color);
    background-color: var(--bg-hover);
}

.draggable {
    cursor: move;
}

.draggable:active {
    cursor: grabbing;
}