/* Variables for light mode */
:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --accent-color: #e74c3c;
    --background-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-color: #333333;
    --border-color: #eaeaea;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
    --hover-shadow: 0 7px 14px rgba(0, 0, 0, 0.12), 0 3px 6px rgba(0, 0, 0, 0.08);
    --header-bg: rgba(255, 255, 255, 0.95);
}

/* Variables for dark mode */
[data-theme="dark"] {
    --primary-color: #4dabf7;
    --secondary-color: #a5d8ff;
    --accent-color: #ff6b6b;
    --background-color: #1e1e2e;
    --card-bg: #2d2d3f;
    --text-color: #e0e0e0;
    --border-color: #444444;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
    --hover-shadow: 0 7px 14px rgba(0, 0, 0, 0.4), 0 3px 6px rgba(0, 0, 0, 0.3);
    --header-bg: rgba(30, 30, 46, 0.95);
}

/* General Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    padding: 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 20px;
    z-index: 100;
    backdrop-filter: blur(10px);
    background-color: var(--header-bg);
}

h1 {
    color: var(--secondary-color);
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 20px;
}

/* Theme Toggle Button */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    background-color: var(--card-bg);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.theme-toggle:hover {
    transform: translateY(-2px);
    box-shadow: var(--hover-shadow);
}

/* Search Bar Styles */
.search-container {
    margin: 20px 0;
    position: relative;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

#search {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 30px;
    font-size: 16px;
    outline: none;
    background-color: var(--card-bg);
    color: var(--text-color);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#search:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-color);
    opacity: 0.5;
}

/* Loader for search */
.loader {
    position: absolute;
    right: 50px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

@keyframes spin {
    to {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* Grid Layout for Bookmarks */
.bookmarks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

/* Category Card Styles */
.category {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    animation: fadeIn 0.5s ease-out forwards;
    opacity: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category:hover {
    transform: translateY(-5px);
    box-shadow: var(--hover-shadow);
}

.category h2 {
    color: var(--secondary-color);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-icon {
    color: var(--primary-color);
}

/* Bookmark List Styles */
.bookmark-list {
    list-style-type: none;
}

.bookmark-list li {
    margin-bottom: 10px;
    position: relative;
}

.bookmark-list a {
    display: block;
    color: var(--primary-color);
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

.bookmark-list a:hover {
    background-color: rgba(52, 152, 219, 0.1);
    padding-left: 15px;
}

.bookmark-list a:before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background-color: var(--primary-color);
    opacity: 0.2;
    transition: width 0.2s ease;
}

.bookmark-list a:hover:before {
    width: 5px;
}

/* Favorite icon for bookmarked links */
.bookmark-list a.favorite:after {
    content: "★";
    position: absolute;
    right: 10px;
    color: var(--accent-color);
}

/* Footer Styles */
footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: var(--text-color);
    opacity: 0.7;
    font-size: 14px;
}

/* Scroll to Top Button */
.scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    z-index: 1000;
}

.scroll-top.visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-top:hover {
    transform: translateY(-5px);
}

/* Tooltip Styles */
.tooltip {
    position: relative;
}

.tooltip:hover:after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--secondary-color);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 100;
    box-shadow: var(--shadow);
}

.tooltip:hover:before {
    content: "";
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) translateY(50%);
    border-width: 5px;
    border-style: solid;
    border-color: var(--secondary-color) transparent transparent transparent;
    z-index: 100;
}

/* New badge */
.new-badge {
    background-color: var(--accent-color);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-right: 5px;
    display: inline-block;
    vertical-align: middle;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .bookmarks-grid {
        grid-template-columns: 1fr;
    }

    header {
        padding: 15px;
        position: relative;
        top: 0;
    }

    .theme-toggle {
        top: 15px;
        right: 15px;
    }

    .scroll-top {
        width: 40px;
        height: 40px;
        bottom: 20px;
        right: 20px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .category {
        padding: 15px;
    }

    .tooltip:hover:after,
    .tooltip:hover:before {
        display: none;
    }
}

/* Animation for category cards */
.category:nth-child(1) { animation-delay: 0.05s; }
.category:nth-child(2) { animation-delay: 0.1s; }
.category:nth-child(3) { animation-delay: 0.15s; }
.category:nth-child(4) { animation-delay: 0.2s; }
.category:nth-child(5) { animation-delay: 0.25s; }
.category:nth-child(6) { animation-delay: 0.3s; }
.category:nth-child(7) { animation-delay: 0.35s; }
.category:nth-child(8) { animation-delay: 0.4s; }
.category:nth-child(9) { animation-delay: 0.45s; }
.category:nth-child(10) { animation-delay: 0.5s; } 