/**
 * Smart OCR - Purple Theme Styles
 * Clean and minimal design with purple accent
 */

/* ==================== Global Styles ==================== */
:root {
    --primary: #7c3aed;
    --primary-dark: #6d28d9;
    --primary-light: #c084fc;
    --primary-bg: #f5f3ff;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text-dark: #1f2937;
    --text-muted: #6b7280;
    --bg-light: #faf5ff;
    --border-color: rgba(124, 58, 237, 0.2);
}

* {
    -webkit-tap-highlight-color: transparent;
}

body {
    background: white;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-dark);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 14px;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

footer {
    margin-top: auto;
}

/* ==================== Header Styles ==================== */
header {
    background: var(--primary) !important;
    color: white;
    box-shadow: 0 4px 6px -1px rgba(124, 58, 237, 0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* ==================== Card Styles ==================== */
.card {
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    background: white;
}

.card:hover {
    box-shadow: 0 4px 6px -1px rgba(124, 58, 237, 0.1);
}

/* ==================== Button Styles ==================== */
.btn {
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 0.375rem;
    border: 1px solid transparent;
}

.btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn:focus:not(:focus-visible) {
    outline: none;
}

.btn-primary {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: white !important;
}

.btn-primary:hover {
    background-color: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
    color: white !important;
}

.btn-outline-primary {
    background-color: transparent !important;
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

.btn-outline-primary:hover {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: white !important;
}

/* ==================== Preview Styles ==================== */
#previewImg {
    max-height: 300px;
    width: 100%;
    object-fit: contain;
}

#removeImageBtn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background-color: var(--primary) !important;
    color: white !important;
    border: none;
    border-radius: 50%;
}

#removeImageBtn:hover {
    transform: rotate(90deg);
    background-color: var(--primary-dark) !important;
}

/* ==================== Processing Styles ==================== */
.spinner-border {
    width: 2rem;
    height: 2rem;
    border-width: 0.2rem;
    border-color: var(--primary) !important;
    border-right-color: transparent !important;
}

.progress {
    border-radius: 0.25rem;
    overflow: hidden;
    background-color: #e5e7eb;
}

.progress-bar {
    background-color: var(--primary) !important;
    transition: width 0.3s ease;
}

/* ==================== Results Styles ==================== */
#resultsCard {
    display: flex;
    flex-direction: column;
}

#resultsCard .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#resultText {
    background: var(--primary-bg);
    padding: 1rem;
    border-radius: 0.375rem;
    min-height: 100px;
    /* Remove fixed max-height to allow full height usage */
    max-height: none;
    /* Change overflow to visible to prevent internal scrolling */
    overflow-y: visible;
    line-height: 1.6;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid var(--border-color);
    flex: 1;
}

/* Full height text container */
.full-height-text {
    height: auto;
    max-height: none;
    overflow-y: visible;
}

/* Results card that expands */
#resultsCard {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#resultsCard .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#resultsCard #resultText {
    flex: 1;
}

/* Results text scroll */
#resultText::-webkit-scrollbar {
    width: 8px;
}

#resultText::-webkit-scrollbar-track {
    background: var(--bg-light);
}

#resultText::-webkit-scrollbar-thumb {
    background: var(--primary-light);
}

#resultText::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ==================== Badge Styles ==================== */
.badge {
    background-color: var(--primary-bg) !important;
    color: var(--primary) !important;
}

.bg-primary-subtle {
    background-color: var(--primary-bg) !important;
    color: var(--primary) !important;
}

.bg-success-subtle {
    background-color: #d1fae5 !important;
    color: var(--success) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-primary {
    color: var(--primary) !important;
}

/* ==================== Toast Styles ==================== */
.toast {
    border-radius: 0.375rem;
    box-shadow: 0 10px 15px -3px rgba(124, 58, 237, 0.2);
    min-width: 200px;
    font-size: 0.875rem;
    background-color: var(--primary) !important;
    color: white !important;
    border: none;
}

.toast-body {
    padding: 0.75rem 1rem;
    font-weight: 500;
}

.btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* ==================== Error Styles ==================== */
.border-danger {
    border-color: var(--danger) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.btn-danger {
    background-color: var(--danger) !important;
    border-color: var(--danger) !important;
}

.btn-danger:hover {
    background-color: #dc2626 !important;
    border-color: #dc2626 !important;
}

/* ==================== Responsive Design ==================== */
@media (max-width: 575px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    #resultText {
        padding: 0.75rem;
        font-size: 0.85rem;
        flex: 1;
    }
    
    h5 {
        font-size: 1rem;
    }
    
    h6 {
        font-size: 0.85rem;
    }
    
    /* Ensure results card expands properly on mobile */
    #resultsCard {
        flex: 1;
        display: flex;
        flex-direction: column;
    }
    
    #resultsCard .card-body {
        flex: 1;
        display: flex;
        flex-direction: column;
    }
}

/* ==================== Print Styles ==================== */
@media print {
    header,
    #uploadCard,
    #previewCard,
    .btn,
    footer {
        display: none !important;
    }

    body {
        background: white;
    }

    #resultText {
        max-height: none;
        background: white;
        border: 1px solid #ddd;
    }
}

/* ==================== Reduced motion support ==================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}