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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

header h1 {
    font-size: 3em;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.card h2 {
    margin-bottom: 20px;
    color: #667eea;
}

/* Forms */
form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

input, textarea, select {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #667eea;
}

button {
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background: #5568d3;
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Discovery Section */
.discovery {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.discovery h2 {
    color: white;
}

.discovery-form {
    display: flex;
    gap: 10px;
}

.discovery-form input {
    flex: 1;
}

/* Search Box */
#searchBox {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
}

#searchBox:focus {
    border-color: #667eea;
    outline: none;
}

/* Categories Grid */
.categories-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.category-card {
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    color: #333;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.category-card:hover {
    background: #f0f0f0;
    border-color: #667eea;
}

.category-card.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.category-name {
    font-weight: 500;
}

.category-count {
    color: #666;
    font-size: 14px;
}

.category-card.active .category-count {
    color: rgba(255,255,255,0.9);
}

/* Bookmarks Header */
.bookmarks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#clearFilterBtn {
    background: #999;
    padding: 8px 16px;
    font-size: 14px;
}

/* New Bookmarks Section */
.new-section-title {
    color: #f5576c;
    margin-bottom: 15px;
    font-size: 1.2em;
}

/* Bookmarks - WHITE BACKGROUND */
.bookmark {
    background: white;
    padding: 15px;
    border: 2px solid #f0f0f0;
    border-radius: 8px;
    margin-bottom: 12px;
    transition: border-color 0.3s;
}

.bookmark:hover {
    border-color: #667eea;
}

.bookmark.new {
    border: 2px solid #f5576c;
    background: linear-gradient(to right, #fff5f7 0%, white 100%);
    position: relative;
    animation: highlightFade 3s ease-in-out;
}

.bookmark.new::before {
    content: "NEW!";
    position: absolute;
    top: 10px;
    right: 10px;
    background: #f5576c;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: bold;
}

@keyframes highlightFade {
    0%, 50% { box-shadow: 0 0 15px rgba(245, 87, 108, 0.4); }
    100% { box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
}

.bookmark-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 8px;
}

.bookmark-title {
    font-weight: bold;
    color: #667eea;
    text-decoration: none;
    font-size: 1.1em;
}

.bookmark-title:hover {
    text-decoration: underline;
}

.bookmark-url {
    color: #999;
    font-size: 0.9em;
    margin-bottom: 8px;
    word-break: break-all;
}

.bookmark-notes {
    color: #666;
    margin-top: 8px;
}

.bookmark-summary {
    background: #f0f7ff;
    padding: 10px;
    border-radius: 6px;
    margin-top: 8px;
    font-size: 0.95em;
    line-height: 1.5;
    color: #333;
}

.bookmark-relevance {
    background: #fff4e6;
    padding: 10px;
    border-radius: 6px;
    margin-top: 8px;
    font-size: 0.95em;
    line-height: 1.5;
    color: #333;
}

.bookmark-meta {
    display: flex;
    gap: 15px;
    margin-top: 8px;
    font-size: 0.9em;
    color: #999;
}

.edit-btn {
    background: #667eea;
    padding: 6px 12px;
    font-size: 14px;
    margin-right: 8px;
}

.edit-btn:hover {
    background: #5568d3;
}

.delete-btn {
    background: #f5576c;
    padding: 6px 12px;
    font-size: 14px;
}

.delete-btn:hover {
    background: #e04555;
}

/* Tags Display */
.bookmark-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.tag {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    display: inline-block;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* Loading */
.loading {
    text-align: center;
    padding: 20px;
    color: #999;
}

.success {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

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

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    animation: slideIn 0.3s;
}

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

.close {
    color: #999;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover {
    color: #333;
}

/* Details/Summary for collapsible form */
details summary {
    cursor: pointer;
    user-select: none;
}

details summary:hover {
    color: #667eea;
}

@media (max-width: 768px) {
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    
    .discovery-form {
        flex-direction: column;
    }
}

/* Popular Tags */
.popular-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag.clickable {
    cursor: pointer;
    transition: transform 0.2s;
}

.tag.clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.tag.clickable.active {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.tag.no-tags {
    background: #ffc107;
    color: #333;
}

/* Compact bookmark for dashboard */
.bookmark.compact {
    padding: 10px 15px;
    margin-bottom: 8px;
}

.bookmark.compact .bookmark-title {
    font-size: 1em;
}

/* Pin button */
.pin-btn {
    background: #ffc107;
    padding: 6px 12px;
    font-size: 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.pin-btn:hover {
    background: #ffb300;
}
