/**
 * Home4j - Custom Styles
 * ========================
 */

/* ==========================================
   CSS Variables
   ========================================== */
:root {
    --hero-height: 200px;
    --card-transition: all 0.2s ease;
    --drawer-width: 400px;
}

/* ==========================================
   Background Image Support
   ========================================== */
.background-layer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    background-color: rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.hero-background {
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.hero-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    z-index: -1;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, var(--overlay-opacity, 0.5));
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
}

/* ==========================================
   Bookmark Card Styles
   ========================================== */
.bookmark-card {
    transition: var(--card-transition);
    cursor: pointer;
}

.bookmark-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

/* Icon View Card */
.bookmark-card-icon {
    min-height: 120px;
}

.bookmark-card-icon .bookmark-icon {
    font-size: 2.5rem;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--fallback-b3, oklch(var(--b3)));
}

.bookmark-card-icon .bookmark-icon img,
.bookmark-card-icon .bookmark-icon svg {
    width: 32px;
    height: 32px;
}

/* List View Card */
.bookmark-card-list {
    padding: 0.75rem 1rem;
}

.bookmark-card-list .bookmark-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--fallback-b3, oklch(var(--b3)));
}

.bookmark-card-list .bookmark-icon img,
.bookmark-card-list .bookmark-icon svg {
    width: 20px;
    height: 20px;
}

/* ==========================================
   Group Styles
   ========================================== */
.group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    cursor: pointer;
    user-select: none;
}

.group-header:hover {
    opacity: 0.8;
}

.group-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.group-toggle {
    transition: transform 0.2s ease;
}

.group-toggle.collapsed {
    transform: rotate(-90deg);
}

.group-content {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.group-content.collapsed {
    max-height: 0 !important;
    opacity: 0;
}

.group-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.group-header:hover .group-actions,
.edit-mode .group-actions {
    opacity: 1;
}

/* ==========================================
   Edit Mode Styles
   ========================================== */
.edit-mode .bookmark-card {
    position: relative;
}

.edit-mode .bookmark-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px dashed transparent;
    border-radius: inherit;
    pointer-events: none;
    transition: border-color 0.2s ease;
}

.edit-mode .bookmark-card:hover::after {
    border-color: var(--fallback-p, oklch(var(--p)));
}

.bookmark-card.editing {
    box-shadow: 0 0 0 3px var(--fallback-p, oklch(var(--p)));
}

.bookmark-edit-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: none;
    gap: 0.25rem;
}

.edit-mode .bookmark-edit-actions {
    display: flex;
}

/* ==========================================
   Drawer Styles
   ========================================== */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.drawer-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--drawer-width);
    max-width: 90vw;
    background: var(--fallback-b1, oklch(var(--b1)));
    z-index: 101;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.drawer-panel.open {
    transform: translateX(0);
}

.drawer-side {
    z-index: 100;
}

.drawer-content-wrapper {
    width: var(--drawer-width);
    max-width: 90vw;
    background: var(--fallback-b1, oklch(var(--b1)));
    height: 100vh;
    overflow-y: auto;
}

/* ==========================================
   Icon Picker Styles
   ========================================== */
.icon-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.icon-picker-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.icon-picker-item:hover {
    background: var(--fallback-b3, oklch(var(--b3)));
}

.icon-picker-item.selected {
    background: var(--fallback-p, oklch(var(--p)));
    color: var(--fallback-pc, oklch(var(--pc)));
}

/* ==========================================
   Theme Switcher
   ========================================== */
.theme-switcher {
    position: relative;
}

.theme-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    min-width: 150px;
    z-index: 50;
}

/* ==========================================
   View Mode Toggle
   ========================================== */
.view-toggle {
    display: flex;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--fallback-b3, oklch(var(--b3)));
}

.view-toggle button {
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.view-toggle button.active {
    background: var(--fallback-p, oklch(var(--p)));
    color: var(--fallback-pc, oklch(var(--pc)));
}

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

.toast {
    animation: slideIn 0.3s ease;
}

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

/* ==========================================
   Responsive Adjustments
   ========================================== */
@media (max-width: 768px) {
    :root {
        --drawer-width: 100%;
    }
    
    .icon-picker-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 480px) {
    .icon-picker-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* ==========================================
   Skeleton Loading
   ========================================== */
.skeleton-card {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ==========================================
   Empty State
   ========================================== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

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

/* ==========================================
   FAB (Floating Action Button)
   ========================================== */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 50;
}

.fab-menu {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: all 0.2s ease;
}

.fab-menu.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
