/* OneFav Reading App - Custom Styles */

/* View Mode Buttons */
.view-btn {
    color: #9ca3af;
    transition: all 0.2s ease;
}

.view-btn:hover {
    color: #6366f1;
    background-color: rgba(99, 102, 241, 0.1);
}

.view-btn.active {
    color: #6366f1;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Filter Buttons */
.filter-btn {
    color: #6b7280;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    background-color: #f3f4f6;
    color: #1f2937;
}

.filter-btn.active {
    background-color: #eef2ff;
    color: #6366f1;
}

.filter-btn.active i {
    color: #6366f1 !important;
}

.filter-btn.active span:last-child {
    background-color: #6366f1;
    color: white;
}

/* Type Buttons */
.type-btn {
    color: #6b7280;
    transition: all 0.2s ease;
}

.type-btn:hover {
    background-color: #f9fafb;
}

.type-btn.active {
    background-color: #f3f4f6;
    color: #1f2937;
}

/* Sort Options */
.sort-option {
    color: #6b7280;
    transition: all 0.2s ease;
}

.sort-option:hover {
    color: #1f2937;
}

.sort-option.active {
    background-color: #eef2ff;
    color: #6366f1;
}

.sort-option.active i {
    color: #6366f1 !important;
}

/* Tag Buttons */
.tag-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    background-color: #f3f4f6;
    color: #4b5563;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid transparent;
}

.tag-btn:hover {
    background-color: #e5e7eb;
    color: #1f2937;
}

.tag-btn.active {
    background-color: #eef2ff;
    color: #6366f1;
    border-color: #c7d2fe;
}

/* Items Grid View */
.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* Items List View */
.list-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Items Masonry View */
.masonry-view {
    column-count: 3;
    column-gap: 1.5rem;
}

.masonry-view .reading-card {
    break-inside: avoid;
    margin-bottom: 1.5rem;
}

@media (max-width: 1280px) {
    .masonry-view {
        column-count: 2;
    }
}

@media (max-width: 768px) {
    .masonry-view {
        column-count: 1;
    }
}

/* Items Headlines View */
.headlines-view {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Reading Card */
.reading-card {
    background: white;
    border-radius: 1rem;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
}

.reading-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-color: #c7d2fe;
}

/* Card Thumbnail */
.card-thumbnail {
    position: relative;
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
}

.card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.3));
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.reading-card:hover .card-thumbnail-overlay {
    opacity: 1;
}

.card-star-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    color: #fbbf24;
    font-size: 1.25rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.card-time-badge {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    color: white;
    padding: 0.25rem 0.625rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Card Content */
.card-content {
    padding: 1rem;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.5;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.card-tag {
    background-color: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    padding: 0.25rem 0.625rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.card-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: #9ca3af;
    padding-top: 0.75rem;
    border-top: 1px solid #f3f4f6;
}

/* Card Actions */
.card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1rem 1rem 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.reading-card:hover .card-actions {
    opacity: 1;
}

.card-action-btn {
    flex: 1;
    padding: 0.5rem;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

.card-action-btn:hover {
    background-color: #f3f4f6;
    color: #1f2937;
    border-color: #d1d5db;
}

.card-action-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.card-action-btn.primary:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* List View Card Styles */
.list-view .reading-card {
    display: flex;
    padding: 1rem;
}

.list-view .card-thumbnail {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 0.5rem;
    margin-right: 1rem;
}

.list-view .card-content {
    flex: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.list-view .card-title {
    margin-bottom: 0.25rem;
    -webkit-line-clamp: 1;
}

.list-view .card-actions {
    opacity: 1;
    padding: 0;
    margin-left: 1rem;
}

/* Headlines View Styles */
.headlines-view .reading-card {
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.headlines-view .card-thumbnail {
    display: none;
}

.headlines-view .card-content {
    flex: 1;
    padding: 0;
}

.headlines-view .card-title {
    margin-bottom: 0.25rem;
    -webkit-line-clamp: 1;
}

.headlines-view .card-tags,
.headlines-view .card-info {
    display: none;
}

.headlines-view .card-actions {
    opacity: 1;
    padding: 0;
    margin-left: 1rem;
}

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

.empty-state i {
    font-size: 4rem;
    color: #e5e7eb;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

/* Checkbox for bulk select */
.item-checkbox {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 0.375rem;
    border: 2px solid white;
    background-color: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.bulk-mode .item-checkbox {
    display: flex;
}

.item-checkbox input[type="checkbox"] {
    display: none;
}

.item-checkbox i {
    color: white;
    font-size: 0.875rem;
}

.item-checkbox.checked {
    background-color: #6366f1;
    border-color: #6366f1;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Scrollbar Styling */
aside::-webkit-scrollbar,
main::-webkit-scrollbar {
    width: 8px;
}

aside::-webkit-scrollbar-track,
main::-webkit-scrollbar-track {
    background: #f3f4f6;
}

aside::-webkit-scrollbar-thumb,
main::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

aside::-webkit-scrollbar-thumb:hover,
main::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Responsive */
@media (max-width: 1024px) {
    .grid-view {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .grid-view {
        grid-template-columns: 1fr;
    }
    
    aside {
        display: none;
    }
    
    /* Show mobile menu when needed */
    aside.mobile-open {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
    }
}

/* Context Menu */
#contextMenu {
    min-width: 200px;
}

.context-menu-item {
    transition: all 0.2s ease;
}

.context-menu-item:hover i {
    transform: scale(1.1);
}

/* Toast Notifications */
.toast {
    background: white;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    animation: slideInRight 0.3s ease;
}

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast.info {
    border-left: 4px solid #3b82f6;
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.875rem;
}

.toast-message {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.125rem;
}

.toast-close {
    color: #9ca3af;
    cursor: pointer;
    transition: color 0.2s ease;
}

.toast-close:hover {
    color: #4b5563;
}

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

/* Modal Backdrop */
.modal-backdrop {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Notes Textarea */
#notesTextarea {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
}

/* Loading Spinner */
.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #6366f1;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Confirm Dialog */
.confirm-dialog {
    animation: scaleIn 0.2s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}
