/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #1f2937;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: white;
    border-radius: 16px;
    padding: 24px 32px;
    margin-bottom: 32px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

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

.logo i {
    font-size: 32px;
    color: #4F46E5;
}

.logo h1 {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #4F46E5;
    color: white;
}

.btn-primary:hover {
    background: #4338CA;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    background: #E5E7EB;
    color: #374151;
}

.btn-secondary:hover {
    background: #D1D5DB;
}

.btn-secondary i.fa-vial {
    color: #10B981;
}

.btn-success {
    background: #10B981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #EF4444;
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Main Content */
.main-content {
    min-height: 400px;
}

/* Help Banner */
.help-banner {
    background: linear-gradient(135deg, #f59e0b 0%, #dc2626 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }
    50% {
        box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
    }
}

.help-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
}

.help-content i {
    font-size: 24px;
    opacity: 0.95;
    margin-top: 2px;
}

.help-content > div {
    flex: 1;
}

.help-content strong {
    font-size: 15px;
    display: block;
    margin-bottom: 4px;
}

.help-content small {
    font-size: 13px;
    opacity: 0.9;
    line-height: 1.4;
}

.help-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s;
    flex-shrink: 0;
}

.help-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

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

/* Topic Card */
.topic-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.topic-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--topic-color, #4F46E5);
}

.topic-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -4px rgba(0, 0, 0, 0.15);
}

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

.topic-info h3 {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.topic-info p {
    font-size: 14px;
    color: #6B7280;
}

.topic-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: #6B7280;
}

.icon-btn:hover {
    background: #F3F4F6;
    color: #111827;
}

.icon-btn.delete:hover {
    background: #FEE2E2;
    color: #DC2626;
}

/* Bookmarks List */
.bookmarks-list {
    margin: 16px 0;
    max-height: 300px;
    overflow-y: auto;
}

.bookmark-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #F9FAFB;
    transition: all 0.2s;
}

.bookmark-item:hover {
    background: #F3F4F6;
}

.bookmark-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.bookmark-info i {
    color: var(--topic-color, #4F46E5);
    font-size: 14px;
}

.bookmark-details {
    flex: 1;
    min-width: 0;
}

.bookmark-title {
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bookmark-url {
    font-size: 12px;
    color: #6B7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bookmark-actions {
    display: flex;
    gap: 4px;
}

.empty-bookmarks {
    text-align: center;
    padding: 32px 16px;
    color: #9CA3AF;
}

.empty-bookmarks i {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* Topic Footer */
.topic-footer {
    display: flex;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid #E5E7EB;
}

.topic-footer .btn {
    flex: 1;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 64px 32px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.empty-state i {
    font-size: 64px;
    color: #D1D5DB;
    margin-bottom: 16px;
}

.empty-state h2 {
    font-size: 24px;
    color: #111827;
    margin-bottom: 8px;
}

.empty-state p {
    color: #6B7280;
    margin-bottom: 24px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

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

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

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #6B7280;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #F3F4F6;
    color: #111827;
}

.modal-body {
    padding: 24px;
}

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

.form-group label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

textarea.form-control {
    resize: vertical;
}

/* Color Picker */
.color-picker {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.color-picker input[type="radio"] {
    display: none;
}

.color-picker label {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 3px solid transparent;
}

.color-picker input[type="radio"]:checked + label {
    border-color: #111827;
    transform: scale(1.1);
}

/* Modal Actions */
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 2000;
    animation: slideInRight 0.3s ease-out;
}

.notification.show {
    display: flex;
}

.notification.success {
    border-left: 4px solid #10B981;
}

.notification.error {
    border-left: 4px solid #EF4444;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Scrollbar Styles */
.bookmarks-list::-webkit-scrollbar {
    width: 6px;
}

.bookmarks-list::-webkit-scrollbar-track {
    background: #F3F4F6;
    border-radius: 3px;
}

.bookmarks-list::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 3px;
}

.bookmarks-list::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .header {
        padding: 16px;
    }

    .header-content {
        flex-direction: column;
        align-items: stretch;
    }

    .header-content > div {
        width: 100%;
    }

    .header-content button {
        width: 100%;
        justify-content: center;
    }

    .logo {
        justify-content: center;
        margin-bottom: 8px;
    }

    .logo h1 {
        font-size: 22px;
    }

    .topics-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .topic-card {
        padding: 16px;
    }

    .modal-content {
        max-width: 100%;
    }

    .notification {
        right: 12px;
        left: 12px;
        top: 12px;
    }
}
