/* PDF操作工具專屬樣式 */

.hero {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    text-align: center;
    padding: 3rem 2rem;
    border-radius: var(--border-radius);
    margin: 2rem 0;
    box-shadow: 0 4px 20px var(--shadow-color);
}

.hero h1 { font-size: 2.5rem; margin-bottom: 1rem; }
.hero p { font-size: 1.2rem; opacity: 0.95; }

.upload-section { margin: 2rem 0; }

.upload-container {
    border: 3px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    text-align: center;
    background: var(--light-gray);
    transition: var(--transition);
    cursor: pointer;
}

.upload-container:hover, .upload-container.dragover {
    border-color: var(--primary-color);
    background: rgba(247, 147, 26, 0.05);
    transform: translateY(-2px);
}

.upload-icon { font-size: 4rem; display: block; margin-bottom: 1rem; }
.upload-content h3 { color: var(--text-color); margin-bottom: 0.5rem; }
.upload-content p { color: var(--text-color); opacity: 0.7; margin-bottom: 1.5rem; }
.upload-hint { font-size: 0.9rem; opacity: 0.6; margin-top: 1rem; }

.pdf-section { margin: 2rem 0; }

.pdf-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    min-height: 600px;
}

.info-panel, .main-panel {
    background: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 3px 15px var(--shadow-color);
    border: 1px solid var(--border-color);
}

.info-panel h3 {
    color: var(--text-color);
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.info-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-label {
    font-size: 0.85rem;
    color: var(--text-color);
    opacity: 0.7;
    font-weight: 600;
}

.info-value {
    font-size: 0.95rem;
    color: var(--text-color);
    word-break: break-word;
}

.info-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    opacity: 0.6;
    transition: var(--transition);
    margin-bottom: -2px;
}

.tab-btn:hover {
    opacity: 0.8;
}

.tab-btn.active {
    opacity: 1;
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
}

.tab-content {
    display: none;
}

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

.text-extract-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.extract-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.extract-header h3 {
    color: var(--text-color);
    font-size: 1.1rem;
}

.extract-stats {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.7;
}

.extract-progress {
    padding: 1rem;
    background: var(--light-gray);
    border-radius: 8px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.3s ease;
}

#progressText {
    font-size: 0.9rem;
    color: var(--text-color);
}

.extracted-text {
    width: 100%;
    min-height: 400px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    background: var(--light-gray);
}

.extracted-text:focus {
    outline: none;
    border-color: var(--primary-color);
}

.extract-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.preview-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-header h3 {
    color: var(--text-color);
    font-size: 1.1rem;
}

.preview-header p {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.7;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.preview-item {
    position: relative;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}

.preview-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.preview-item canvas {
    width: 100%;
    height: auto;
    display: block;
}

.preview-item .page-number {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.85rem;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    background: white;
    padding: 2rem 3rem;
    border-radius: var(--border-radius);
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.loading-content p {
    color: var(--text-color);
    font-size: 1rem;
    margin: 0;
}

/* 模態窗口 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 2rem;
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

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

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

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

.modal-close:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.modal-body {
    flex: 1;
    overflow: auto;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-gray);
}

.modal-body canvas {
    max-width: 100%;
    max-height: 100%;
    display: block;
    box-shadow: 0 4px 12px var(--shadow-color);
}

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

#pageInfo {
    font-size: 1rem;
    color: var(--text-color);
    font-weight: 600;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    background: var(--light-gray);
    color: var(--text-color);
    border: 2px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.feature-card {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: 0 3px 15px var(--shadow-color);
    text-align: center;
    border: 1px solid var(--border-color);
}

.feature-icon { font-size: 3rem; display: block; margin-bottom: 1rem; }
.feature-card h3 { color: var(--text-color); margin-bottom: 1rem; }
.feature-card p { color: var(--text-color); opacity: 0.8; line-height: 1.6; }

.tutorial, .faq {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    margin: 3rem 0;
    box-shadow: 0 3px 15px var(--shadow-color);
    border: 1px solid var(--border-color);
}

.tutorial h2, .faq h2 { color: var(--text-color); margin-bottom: 1.5rem; }
.tutorial ol { margin-left: 1.5rem; margin-bottom: 1rem; }
.tutorial li { margin-bottom: 0.75rem; line-height: 1.6; color: var(--text-color); }

.faq-item { margin-bottom: 2rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border-color); }
.faq-item:last-child { border-bottom: none; }
.faq-item h3 { color: var(--text-color); margin-bottom: 1rem; }
.faq-item p { color: var(--text-color); opacity: 0.85; line-height: 1.7; }

.tool-info {
    text-align: center;
    padding: 2rem;
    background: var(--light-gray);
    border-radius: var(--border-radius);
    margin: 3rem 0;
}

.tool-info a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

@media (max-width: 992px) {
    .pdf-container {
        grid-template-columns: 1fr;
    }
    .preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .hero h1 { font-size: 1.8rem; }
    .extract-actions { flex-direction: column; }
    .preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

/* 暗色主題 */
[data-theme="dark"] .upload-container {
    background: #1a1a1a;
    border-color: #333;
}

[data-theme="dark"] .info-panel,
[data-theme="dark"] .main-panel,
[data-theme="dark"] .feature-card,
[data-theme="dark"] .tutorial,
[data-theme="dark"] .faq {
    background: #1a1a1a;
    border-color: #333;
}

[data-theme="dark"] .extracted-text {
    background: #2a2a2a;
    border-color: #444;
    color: #fff;
}

[data-theme="dark"] .extract-progress {
    background: #2a2a2a;
}

[data-theme="dark"] .btn {
    background: #2a2a2a;
    color: #fff;
    border-color: #444;
}

[data-theme="dark"] .loading-content {
    background: #1a1a1a;
}

[data-theme="dark"] .tool-info {
    background: #1a1a1a;
}

[data-theme="dark"] .preview-item {
    border-color: #444;
}

[data-theme="dark"] .modal-content {
    background: #1a1a1a;
}

[data-theme="dark"] .modal-body {
    background: #2a2a2a;
}
