/* CSS Variables & Theme Definition */
:root {
    /* Color Palette */
    --bg-dark: #090a12;
    --panel-bg: rgba(18, 20, 36, 0.45);
    --panel-bg-hover: rgba(24, 27, 47, 0.55);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-hover: rgba(255, 255, 255, 0.16);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Elegant Accents */
    --primary: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.35);
    --primary-dark: #7c3aed;
    
    --accent-purple: #a855f7;
    --accent-blue: #3b82f6;
    --accent-pink: #ec4899;
    --accent-gold: #f59e0b;
    --accent-red: #ef4444;
    --accent-cyan: #06b6d4;
    --accent-green: #10b981;
    --accent-teal: #14b8a6;
    --accent-orange: #f97316;
    
    /* Layout & Glassmorphism Spec */
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;
    --radius-pill: 50px;
    --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: all 0.2s ease;
    --glass-blur: 24px;
    --glass-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
}

/* Base Setup */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background: radial-gradient(circle at 50% 50%, #0c0d1b 0%, #06070c 100%);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    position: relative;
}

/* Ambient Moving Background */
.bg-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(130px);
    opacity: 0.35;
    animation: moveBlob 25s infinite alternate ease-in-out;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--accent-purple) 0%, rgba(168, 85, 247, 0) 70%);
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 55vw;
    height: 55vw;
    background: radial-gradient(circle, var(--accent-blue) 0%, rgba(59, 130, 246, 0) 70%);
    animation-delay: -5s;
    animation-duration: 30s;
}

.blob-3 {
    top: 40%;
    left: 50%;
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, var(--accent-pink) 0%, rgba(236, 72, 153, 0) 70%);
    animation-delay: -10s;
    animation-duration: 20s;
}

.blob-4 {
    bottom: 20%;
    left: -10%;
    width: 35vw;
    height: 35vw;
    background: radial-gradient(circle, var(--accent-teal) 0%, rgba(20, 184, 166, 0) 70%);
    animation-delay: -15s;
    animation-duration: 28s;
}

@keyframes moveBlob {
    0% {
        transform: translate(0, 0) scale(1) rotate(0deg);
    }
    33% {
        transform: translate(10vw, 5vh) scale(1.15) rotate(120deg);
    }
    66% {
        transform: translate(-5vw, 15vh) scale(0.9) rotate(240deg);
    }
    100% {
        transform: translate(0, 0) scale(1) rotate(360deg);
    }
}

/* Glassmorphism Panel style */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    box-shadow: var(--glass-shadow);
    transition: var(--transition-smooth);
}

.glass-panel:hover {
    border-color: var(--border-color-hover);
}

/* Container */
.container {
    width: 100%;
    max-width: 1280px;
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    z-index: 10;
}

/* Header Component */
.header {
    border-radius: var(--radius-lg);
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

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

.logo-icon-wrapper {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.3);
}

.logo-icon {
    width: 26px;
    height: 26px;
    color: var(--primary);
    filter: drop-shadow(0 0 8px var(--primary));
}

.logo-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.logo-title span {
    background: linear-gradient(to right, #a78bfa, #c084fc, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 400;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 8px 20px -6px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -4px var(--primary-glow);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-color-hover);
    transform: translateY(-2px);
}

.btn i {
    width: 18px;
    height: 18px;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    align-items: center;
    gap: 24px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
    padding: 16px 24px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

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

.stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-divider {
    width: 1px;
    height: 28px;
    background: rgba(255, 255, 255, 0.06);
}

/* Controls (Search & Category list) */
.controls {
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Search Box */
.search-box {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    pointer-events: none;
    transition: var(--transition-fast);
}

.search-box #searchInput {
    width: 100%;
    padding: 16px 20px 16px 52px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition-fast);
    outline: none;
}

.search-box #searchInput:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 15px -3px rgba(139, 92, 246, 0.2);
}

.search-box #searchInput:focus + .search-icon {
    color: var(--primary);
}

.clear-btn {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition-fast);
}

.clear-btn i {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

/* Categories List */
.categories-wrapper {
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
}

.categories-wrapper::-webkit-scrollbar {
    display: none; /* Safari/Chrome */
}

.categories-list {
    display: flex;
    gap: 10px;
    padding-bottom: 2px;
}

.category-tab {
    padding: 10px 18px;
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: var(--transition-smooth);
    white-space: nowrap;
}

.category-tab:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    transform: scale(1.03);
}

.category-tab.active {
    background: rgba(139, 92, 246, 0.15);
    border-color: var(--primary);
    color: #c084fc;
    box-shadow: 0 4px 15px -4px rgba(139, 92, 246, 0.3);
}

/* Grid Container */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

/* Web Link Card */
.card {
    position: relative;
    border-radius: var(--radius-md);
    padding: 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
    height: 100%;
    overflow: hidden;
    /* We will use unique custom accent colors per card dynamically */
    --card-accent: var(--primary);
    --card-accent-glow: rgba(139, 92, 246, 0.15);
}

.card::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--card-accent-glow) 0%, rgba(255,255,255,0) 70%);
    pointer-events: none;
    z-index: 1;
    transition: var(--transition-smooth);
}

.card:hover {
    transform: translateY(-6px);
    background: var(--panel-bg-hover);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.8), 0 0 20px -5px var(--card-accent-glow);
    border-color: rgba(255, 255, 255, 0.2);
}

.card:hover::before {
    transform: scale(1.3);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    z-index: 2;
}

/* Icon Wrap */
.card-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--card-accent);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.05);
    transition: var(--transition-smooth);
}

.card:hover .card-icon-wrapper {
    border-color: var(--card-accent);
    box-shadow: 0 0 15px -3px var(--card-accent-glow);
    background: rgba(255, 255, 255, 0.05);
    transform: scale(1.05);
}

/* Category Pill */
.card-category {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.card:hover .card-category {
    border-color: rgba(255, 255, 255, 0.12);
}

/* Delete Button */
.delete-card-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: var(--transition-smooth);
    z-index: 5;
}

.delete-card-btn:hover {
    background: var(--accent-red);
    color: white;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.card:hover .delete-card-btn {
    opacity: 1;
    transform: scale(1);
}

.card-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    z-index: 2;
}

.card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: var(--text-primary);
}

.card-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    /* Limit to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 38px;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.tag-badge {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

/* Card Actions */
.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    position: relative;
    z-index: 2;
}

.card-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.card-btn-visit {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.card:hover .card-btn-visit {
    background: linear-gradient(135deg, var(--card-accent) 0%, rgba(255, 255, 255, 0.05) 150%);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 15px -4px var(--card-accent-glow);
}

.card-btn-copy {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 42px;
    flex-grow: 0;
}

.card-btn-copy:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: var(--border-color-hover);
}

.card-btn i {
    width: 14px;
    height: 14px;
}

/* Empty State Styling */
.empty-state {
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    max-width: 600px;
    margin: 40px auto;
}

.empty-icon-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.empty-icon {
    width: 38px;
    height: 38px;
    color: var(--text-muted);
}

.empty-state h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    max-width: 420px;
    line-height: 1.5;
    margin-bottom: 8px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 5, 10, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    width: 90%;
    max-width: 580px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    transform: translateY(30px) scale(0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

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

.modal-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-title i {
    color: var(--primary);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: var(--transition-fast);
}

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

.modal-body {
    padding: 32px;
    overflow-y: auto;
}

.modal-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.required {
    color: var(--accent-red);
}

input[type="text"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-fast);
}

input[type="text"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
}

select option {
    background-color: #121424;
    color: var(--text-primary);
}

/* Icon Selector component inside modal */
.icon-selector {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-top: 4px;
}

.icon-option {
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.icon-option input {
    display: none;
}

.icon-option i {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    transition: var(--transition-fast);
}

.icon-option:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color-hover);
}

.icon-option.selected {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--primary);
}

.icon-option.selected i {
    color: var(--primary);
    transform: scale(1.1);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 12px;
}



/* Toast System */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: rgba(18, 20, 36, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-left: 4px solid var(--primary);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    padding: 16px 20px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}

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

.toast-success {
    border-left-color: var(--accent-green);
}
.toast-success i {
    color: var(--accent-green);
}

.toast-info {
    border-left-color: var(--accent-blue);
}
.toast-info i {
    color: var(--accent-blue);
}

.toast-error {
    border-left-color: var(--accent-red);
}
.toast-error i {
    color: var(--accent-red);
}

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

.toast-content {
    font-size: 0.88rem;
    font-weight: 500;
}

/* Footer Section */
.footer {
    text-align: center;
    padding: 40px 0 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.footer-dots {
    display: flex;
    gap: 8px;
}

.footer-dots .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
}

.footer-dots .dot.active {
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.01);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* Responsive Overrides */
@media (max-width: 768px) {
    .container {
        padding: 20px 16px;
    }
    
    .header {
        padding: 24px;
    }
    
    .header-main {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    
    .stats-bar {
        flex-direction: row;
        justify-content: space-around;
        padding: 12px;
        gap: 12px;
    }
    
    .stat-divider {
        display: none;
    }
}
