/* Web-specific styles for PDF to Markdown converter */
/* This file should ONLY contain web-specific adjustments */
/* All main theming is handled by styles.css (BrewCode AMOLED theme) */

/* File input styling - web specific */
.file-input-hidden {
    display: none !important;
}

/* Tab functionality - ensure proper visibility */
.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Editor functionality */
.markdown-editor {
    resize: none;
}

/* Ensure textareas are always visible and properly styled */
#markdownEditor,
#markdownEditorSideBySide {
    width: 100% !important;
    height: 100% !important;
    border: 1px solid var(--border) !important;
    background: var(--surface) !important;
    color: var(--text-primary) !important;
    font-family: 'Fira Code', 'Monaco', 'Courier New', monospace !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    padding: 1rem !important;
    resize: none !important;
    outline: none !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 1 !important;
}

/* Resize handle for markdown editor */
.editor-resize-handle {
    width: 100%;
    height: 12px;
    background: var(--border);
    cursor: row-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    -webkit-user-select: none;
    user-select: none;
    position: relative;
}

.editor-resize-handle:hover {
    background: var(--border-accent);
}

.editor-resize-handle::before {
    content: '';
    width: 32px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 2px;
    transition: background-color 0.2s ease;
}

.editor-resize-handle:hover::before {
    background: var(--primary-color);
}

.editor-resize-handle.resizing {
    background: var(--border-strong);
}

.editor-resize-handle.resizing::before {
    background: var(--primary-color);
}

/* Resize overlay to prevent text selection during resize */
.resize-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: row-resize;
    z-index: 9999;
    -webkit-user-select: none;
    user-select: none;
    background: transparent;
}

/* Make sure edit tab content is properly displayed */
#editTab {
    display: none;
    min-height: 100%;
    height: auto; /* Allow dynamic height */
    flex-direction: column;
}

#editTab.active {
    display: flex !important;
}

/* Editor container adjustments for resizing */
.editor-container-single {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    height: auto; /* Allow dynamic height */
}

.editor-scrollbar-container {
    height: 400px; /* Default height, will be overridden by JavaScript */
    min-height: 200px;
    max-height: 2000px; /* Match iframe max height */
    overflow: hidden;
    position: relative;
    flex-shrink: 0; /* Don't shrink when parent grows */
}

/* Make sure preview tab content is properly displayed */
#previewTab {
    display: none;
    height: 100%;
    padding: 1rem;
    overflow-y: auto;
}

#previewTab.active {
    display: block !important;
}

/* Side-by-side layout fixes */
.markdown-editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.markdown-editor-container .editor-scrollbar-container {
    flex: 1;
    height: 100%;
}

.markdown-editor-container textarea {
    height: 100% !important;
    min-height: 400px;
}

/* Ensure side-by-side panels are equal size */
.side-by-side-layout .pdf-panel,
.side-by-side-layout .markdown-panel {
    flex: 1;
    min-height: 600px;
}

/* Web-specific spinning animation for large spinner */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal styles - BrewCode Style */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal:not(.hidden) {
    opacity: 1;
}

.modal-content {
    background: rgba(10, 10, 10, 0.95);
    -webkit-backdrop-filter: blur(30px);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 24px;
    padding: 0;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 212, 255, 0.1);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal:not(.hidden) .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 2rem 2rem 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(139, 92, 246, 0.1));
    position: relative;
}

.modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(135deg, #00d4ff, #8b5cf6);
    border-radius: 24px 24px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #00d4ff, #8b5cf6, #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-close {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #d4d4d4;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.modal-close:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: rgba(0, 212, 255, 0.3);
    color: #00d4ff;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    max-height: calc(80vh - 120px);
    color: #d4d4d4;
}

.help-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(10, 10, 10, 0.8);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h4 {
    color: #ffffff;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
    background: linear-gradient(135deg, #00d4ff, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.help-section ol,
.help-section ul {
    margin-left: 1.5rem;
    color: #d4d4d4;
}

.help-section li {
    margin-bottom: 0.75rem;
    line-height: 1.6;
    position: relative;
}

.help-section li::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 0.7rem;
    width: 4px;
    height: 4px;
    background: #00d4ff;
    border-radius: 50%;
    opacity: 0.6;
}

.help-section ol li::before {
    display: none;
}

/* Button enhancements for web */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover:before {
    left: 100%;
}

/* Responsive design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .logo-section {
        justify-content: center;
    }
    
    .logo-section h1 {
        font-size: 1.5rem;
    }
    
    .header-actions {
        justify-content: center;
    }
    
    .upload-area {
        padding: 2rem 1rem;
        margin: 1rem;
    }
    
    .upload-icon {
        font-size: 3rem;
    }
    
    .action-buttons {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }
    
    .side-by-side-layout {
        flex-direction: column;
        height: auto;
    }
    
    .left-panel,
    .right-panel {
        width: 100%;
        height: 400px;
    }
    
    .modal-content {
        margin: 1rem;
        width: calc(100% - 2rem);
    }
    
    .modal-body {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .logo-section h1 {
        font-size: 1.25rem;
    }
    
    .upload-area h2 {
        font-size: 1.5rem;
    }
    
    .accuracy-stats {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
}

/* Web-specific animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section:not(.hidden) {
    animation: fadeInUp 0.6s ease;
}

/* Print styles */
@media print {
    .app-header,
    .action-buttons,
    .modal,
    .toast-container {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .markdown-preview {
        background: white !important;
        box-shadow: none !important;
        border: none !important;
    }
}
