/* Arabic OCR - Black & Muted Red Theme */

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

body {
    font-family: 'Cairo', sans-serif;
    background: #0a0a0a;
    color: #f0f0f0;
    min-height: 100vh;
    line-height: 1.6;
}

/* Hide background effects */
.background-effects {
    display: none;
}

/* Container - centered */
.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    color: #a85555;
}

.logo h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
}

.subtitle {
    color: #888;
    font-size: 1rem;
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Upload Section - centered */
.upload-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.upload-zone {
    background: #111;
    border: 2px dashed #333;
    border-radius: 1rem;
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    width: 100%;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: #a85555;
    background: rgba(168, 85, 85, 0.05);
}

.upload-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: #a85555;
    border-radius: 50%;
    margin-bottom: 1rem;
}

.upload-icon {
    width: 28px;
    height: 28px;
    color: white;
}

.upload-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.upload-subtitle {
    color: #888;
    margin-bottom: 1rem;
}

.supported-formats {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.format-badge {
    padding: 0.25rem 0.75rem;
    background: #1a1a1a;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    color: #888;
}

/* File Info */
.file-info {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #111;
    border-radius: 0.5rem;
    border: 1px solid #222;
    width: 100%;
}

.file-info.visible {
    display: flex;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-icon {
    width: 20px;
    height: 20px;
    color: #a85555;
}

.file-name {
    font-weight: 500;
}

.remove-file {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    color: #888;
    transition: color 0.2s;
}

.remove-file:hover {
    color: #c77;
}

.remove-file svg {
    width: 16px;
    height: 16px;
}

/* Process Button */
.process-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    background: #a85555;
    border: none;
    border-radius: 0.5rem;
    color: white;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    width: 100%;
    max-width: 300px;
}

.process-btn:hover:not(:disabled) {
    background: #8f4747;
}

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

.process-btn.loading .btn-text {
    opacity: 0;
}

.process-btn.loading .btn-loader {
    display: flex;
}

.btn-loader {
    position: absolute;
    display: none;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* Result Section */
.result-section {
    display: none;
    background: #111;
    border-radius: 0.75rem;
    border: 1px solid #222;
    overflow: hidden;
    width: 100%;
}

.result-section.visible {
    display: block;
}

.summary-section {
    display: none;
    background: #111;
    border-radius: 0.75rem;
    border: 1px solid #222;
    overflow: hidden;
    width: 100%;
}

.summary-section.visible {
    display: block;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #222;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.result-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.result-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    background: #1a1a1a;
    border: none;
    border-radius: 0.375rem;
    color: #aaa;
    font-family: 'Cairo', sans-serif;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
}

.action-btn:hover {
    background: #252525;
    color: #fff;
}

.action-btn svg {
    width: 16px;
    height: 16px;
}

.result-content {
    padding: 1rem;
}

#resultText {
    width: 100%;
    min-height: 250px;
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 0.5rem;
    padding: 1rem;
    color: #f0f0f0;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    line-height: 1.8;
    resize: vertical;
    direction: rtl;
}

#resultText:focus {
    outline: none;
    border-color: #a85555;
}

#summaryText {
    width: 100%;
    min-height: 180px;
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 0.5rem;
    padding: 1rem;
    color: #f0f0f0;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    line-height: 1.8;
    resize: vertical;
    direction: rtl;
}

#summaryText:focus {
    outline: none;
    border-color: #a85555;
}

.result-stats {
    padding: 0.75rem 1rem;
    background: #0a0a0a;
    color: #666;
    font-size: 0.875rem;
    text-align: center;
}

/* Error Message */
.error-message {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(168, 85, 85, 0.1);
    border: 1px solid #a85555;
    border-radius: 0.5rem;
    color: #c99;
    width: 100%;
}

.error-message.visible {
    display: flex;
}

.error-message svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem 0 1rem;
    color: #555;
    font-size: 0.875rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: #16a34a;
    color: white;
    border-radius: 0.5rem;
    font-weight: 500;
    opacity: 0;
    transition: transform 0.25s, opacity 0.25s;
    z-index: 1000;
}

.toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast svg {
    width: 18px;
    height: 18px;
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    .upload-zone {
        padding: 2rem 1rem;
    }

    .result-header {
        flex-direction: column;
        align-items: stretch;
    }

    .result-actions {
        justify-content: center;
    }
}