/* Bookmarks App Styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #f3f4f6;
    min-height: 100vh;
    line-height: 1.5;
    color: #1f2937;
}

.container {
    max-width: 56rem;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
header {
    margin-bottom: 2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

header p {
    color: #6b7280;
}

/* Sync Controls */
.sync-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sync-indicator {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.sync-indicator.syncing {
    background-color: #fef3c7;
    color: #92400e;
}

.sync-indicator.synced {
    background-color: #d1fae5;
    color: #065f46;
}

.sync-indicator.offline {
    background-color: #e5e7eb;
    color: #6b7280;
}

.sync-indicator.error {
    background-color: #fee2e2;
    color: #991b1b;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    gap: 0.375rem;
}

.btn-sm svg {
    flex-shrink: 0;
}

/* Sync pending indicator on bookmark cards */
.sync-pending {
    color: #f59e0b;
    font-size: 0.625rem;
    margin-left: 0.25rem;
}

/* Cards */
.card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 1rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.25rem;
}

.form-row {
    display: flex;
    gap: 0.5rem;
}

input[type="text"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

textarea {
    resize: vertical;
    min-height: 4rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: #2563eb;
    color: white;
}

.btn-primary:hover {
    background-color: #1d4ed8;
}

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

.btn-secondary:hover {
    background-color: #d1d5db;
}

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

.btn-danger:hover {
    background-color: #b91c1c;
}

.btn-icon {
    padding: 0.5rem;
    background: transparent;
    color: #6b7280;
}

.btn-icon:hover {
    color: #2563eb;
}

.btn-icon.delete:hover {
    color: #dc2626;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
}

/* Search and Filter Bar */
.filter-bar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 640px) {
    .filter-bar {
        flex-direction: row;
    }
}

.filter-bar .search-input {
    flex: 1;
}

.filter-bar select {
    width: auto;
}

.active-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.active-filter .filter-tag {
    padding: 0.25rem 0.5rem;
    background-color: #dbeafe;
    color: #1e40af;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.active-filter .clear-btn {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    padding: 0 0.25rem;
}

.active-filter .clear-btn:hover {
    color: #374151;
}

/* Bookmark Cards */
.bookmarks-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.bookmark-card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.bookmark-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.bookmark-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

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

.bookmark-title {
    font-size: 1.125rem;
    font-weight: 500;
    color: #2563eb;
    text-decoration: none;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookmark-title:hover {
    color: #1e40af;
    text-decoration: underline;
}

.bookmark-domain {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bookmark-description {
    color: #4b5563;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bookmark-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.bookmark-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

/* Tags */
.tag {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background-color: #dbeafe;
    color: #1e40af;
    font-size: 0.75rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background-color 0.15s;
    border: none;
}

.tag:hover {
    background-color: #bfdbfe;
}

.bookmark-date {
    font-size: 0.75rem;
    color: #9ca3af;
}

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

.empty-state svg {
    width: 4rem;
    height: 4rem;
    margin: 0 auto;
    color: #9ca3af;
}

.empty-state h3 {
    margin-top: 1rem;
    font-size: 1.125rem;
    font-weight: 500;
    color: #1f2937;
}

.empty-state p {
    margin-top: 0.5rem;
    color: #6b7280;
}

/* Stats */
.stats {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.875rem;
    color: #6b7280;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    padding: 1.5rem;
    margin: 1rem;
    max-width: 32rem;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 1rem;
}

.modal-content p {
    color: #4b5563;
    margin-bottom: 1rem;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Loading Spinner */
.loading-spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
    display: inline-block;
}

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

/* Notification */
.notification {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    transition: opacity 0.3s;
}

.notification.success {
    background-color: #22c55e;
    color: white;
}

.notification.error {
    background-color: #ef4444;
    color: white;
}

.notification.info {
    background-color: #1f2937;
    color: white;
}

/* Utility */
.hidden {
    display: none !important;
}

.flex-1 {
    flex: 1;
}

/* Auth Screen */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
}

.auth-container {
    text-align: center;
    width: 100%;
    max-width: 400px;
}

.auth-container h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
}

.auth-card {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.auth-tab {
    flex: 1;
    padding: 0.75rem;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab:hover {
    background: #e5e7eb;
}

.auth-tab.active {
    background: #2563eb;
    color: white;
}

.auth-form {
    text-align: left;
}

.auth-form .form-group {
    margin-bottom: 1.5rem;
}

.auth-error {
    background: #fee2e2;
    color: #991b1b;
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.auth-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.auth-hint svg {
    flex-shrink: 0;
}

/* Header Actions */
.header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

@media (min-width: 640px) {
    .header-actions {
        flex-direction: row;
        align-items: center;
        gap: 1rem;
    }
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-name {
    font-size: 0.875rem;
    color: #4b5563;
    font-weight: 500;
}

/* Form Header */
.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.editing-notice {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background-color: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 0.375rem;
    color: #92400e;
    font-size: 0.875rem;
}

.editing-notice.hidden {
    display: none;
}
