/* components.css - Component-specific styles */

/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: 4rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1rem 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
    margin-bottom: 2rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.footer-logo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
}

.footer-info h3 {
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.footer-info p {
    color: var(--text-secondary);
    margin: 0;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.footer-section h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.footer-section a {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    transition: var(--transition);
}

.footer-section a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.footer-bottom p {
    color: var(--text-muted);
    margin: 0;
}

.footer-social {
    display: flex;
    gap: 1rem;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: var(--transition);
}

.social-link:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* Hero Section */
.hero {
    padding: 4rem 0;
    text-align: center;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Dashboard */
.dashboard-header {
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.dashboard-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Binder Grid */
.binders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.binder-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
}

.binder-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.binder-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.binder-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.binder-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.binder-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.binder-actions {
    padding: 1rem 1.5rem;
    display: flex;
    gap: 0.5rem;
}

.binder-action {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.binder-action:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.binder-action.primary {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.binder-action.primary:hover {
    background: var(--primary-hover);
}

/* Binder Viewer */
.binder-viewer {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 0;
    height: calc(100vh - 80px);
    background: var(--bg-primary);
}

.binder-sidebar {
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 1rem 0;
}

.binder-sidebar-header {
    padding: 0 1rem 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.binder-sidebar-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.binder-sidebar-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.document-list {
    list-style: none;
}

.document-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.document-item:hover {
    background: var(--bg-tertiary);
}

.document-item.active {
    background: var(--bg-tertiary);
    border-left-color: var(--primary-color);
}

.document-item-title {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.document-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.binder-content {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.binder-toolbar {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
}

.binder-nav {
    display: flex;
    gap: 0.5rem;
}

.binder-nav-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.binder-nav-btn:hover:not(:disabled) {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.binder-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.binder-viewport {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

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

.document-header {
    text-align: center;
    margin-bottom: 2rem;
}

.document-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.document-intro {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
}

.document-body {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

.document-outro {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* PDF Viewer */
.pdf-viewer {
    width: 100%;
    height: 600px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

/* Image Viewer */
.image-viewer {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

/* Rich Text Editor */
.rich-text-editor {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    overflow: hidden;
    transition: var(--transition);
}

.rich-text-editor:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
}

.toolbar-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.toolbar-btn.active {
    background: var(--primary-color);
    color: white;
}

.toolbar-btn[data-command="formatBlock"] {
    width: auto;
    padding: 0 0.5rem;
    font-size: 0.75rem;
}

.toolbar-separator {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 0.25rem;
}

.editor-content {
    min-height: 300px;
    padding: 1rem;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    line-height: 1.6;
    outline: none;
    overflow-y: auto;
}

.editor-content:empty:before {
    content: attr(placeholder);
    color: var(--text-muted);
    font-style: italic;
}

.editor-content h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem 0;
    color: var(--text-primary);
}

.editor-content h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0.75rem 0 0.5rem 0;
    color: var(--text-primary);
}

.editor-content h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0.5rem 0 0.25rem 0;
    color: var(--text-primary);
}

.editor-content ul,
.editor-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.editor-content li {
    margin: 0.25rem 0;
}

.editor-content p {
    margin: 0.5rem 0;
}

.editor-content strong {
    font-weight: 600;
}

.editor-content em {
    font-style: italic;
}

.editor-content u {
    text-decoration: underline;
}

/* Rich Text Content Display */
.rich-text-content {
    line-height: 1.6;
    color: var(--text-primary);
}

.rich-text-content h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 1rem 0 0.5rem 0;
    color: var(--text-primary);
}

.rich-text-content h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0.75rem 0 0.5rem 0;
    color: var(--text-primary);
}

.rich-text-content h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0.5rem 0 0.25rem 0;
    color: var(--text-primary);
}

.rich-text-content ul,
.rich-text-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.rich-text-content li {
    margin: 0.25rem 0;
}

.rich-text-content p {
    margin: 0.5rem 0;
}

.rich-text-content strong {
    font-weight: 600;
}

.rich-text-content em {
    font-style: italic;
}

.rich-text-content u {
    text-decoration: underline;
}

.rich-text-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* Text Editor (fallback) */
.text-editor {
    width: 100%;
    min-height: 400px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    line-height: 1.6;
    resize: vertical;
}

.text-editor:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

/* File Upload */
.file-upload {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.file-upload:hover {
    border-color: var(--primary-color);
    background: var(--bg-tertiary);
}

.file-upload.dragover {
    border-color: var(--primary-color);
    background: var(--bg-tertiary);
}

.file-upload-icon {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.file-upload-text {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.file-upload-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Loading States */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--border-color) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

/* Drag and Drop Styles */
.document-item {
    cursor: grab;
    transition: var(--transition);
    user-select: none; /* Prevent text selection */
}

.document-item:hover {
    background: var(--bg-tertiary);
}

.document-item:active {
    cursor: grabbing;
}

.document-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
    z-index: 1000;
    position: relative;
    cursor: grabbing;
}

.document-item.drag-over {
    border-top: 3px solid var(--primary-color);
    background: var(--bg-tertiary);
}

.drag-handle {
    cursor: grab;
    color: var(--text-muted);
    padding: 0.5rem;
    margin-right: 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    min-height: 24px;
}

.drag-handle:hover {
    color: var(--primary-color);
    background: var(--bg-tertiary);
}

.drag-handle:active {
    cursor: grabbing;
}

/* Prevent text selection during drag */
body.dragging {
    user-select: none;
}

body.dragging * {
    user-select: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .footer-links {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .binders-grid {
        grid-template-columns: 1fr;
    }
    
    .binder-viewer {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .binder-sidebar {
        height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .binder-content {
        height: calc(100vh - 280px);
    }
}
