/* General Body and Font Styles */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f0f4f8;
    /* Light gray background */
    color: #333;
    /* display: flex; */
    justify-content: center;
    align-items: flex-start;
    /* Align to top to avoid pushing content off screen on smaller devices */
    min-height: 100vh;
    /* Minimum full height */
    margin: 0;
    /* padding: 20px; */
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Main Container */
.container {
    background-color: #ffffff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
    margin-top: 50px;
    /* Space from the top */
    margin-bottom: 50px;
    /* Space from the bottom */
}

/* Headings */
h1 {
    color: #009999;
    /* Siemens blue-green */
    margin-bottom: 10px;
    font-size: 2.5em;
    font-weight: 700;
}

.tagline {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 30px;
}

/* Drop Area for File Upload */
.drop-area {
    border: 3px dashed #b0e0e6;
    /* Lighter Siemens blue-green */
    border-radius: 10px;
    padding: 50px 20px;
    text-align: center;
    background-color: #faffff;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 30px;
}

.drop-area:hover,
.drop-area.highlight {
    border-color: #009999;
    background-color: #e6f7f7;
    /* Lighter hover background */
}

.drop-area p {
    font-size: 1.2em;
    color: #555;
    margin-bottom: 20px;
}

/* Upload Button (linked to input) */
.upload-button {
    display: inline-block;
    background-color: #009999;
    /* Siemens blue-green */
    color: white;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 153, 153, 0.3);
    border: none;
    /* Remove default button border */
}

.upload-button:hover {
    background-color: #007a7a;
    /* Darker Siemens blue-green on hover */
    transform: translateY(-2px);
}

.upload-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 153, 153, 0.4);
}

/* Controls Area */
.controls-area {
    background-color: #e6f7f7;
    /* Light background for status */
    border: 1px solid #b0e0e6;
    border-radius: 10px;
    padding: 25px;
    margin-top: 20px;
    text-align: left;
    transition: opacity 0.3s ease, height 0.3s ease;
    overflow: hidden;
    /* Hide overflow when animating height */
}

.controls-area.hidden {
    opacity: 0;
    height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border: none;
    margin-top: 0;
}

.file-name {
    font-weight: 600;
    color: #009999;
    margin-bottom: 20px;
    font-size: 1.1em;
    word-wrap: break-word;
    /* Ensure long file names wrap */
    text-align: center;
}

.control-group {
    display: flex;
    flex-wrap: wrap;
    /* Allow items to wrap on smaller screens */
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
    /* Space between label and input */
    justify-content: center;
    /* Center controls */
}

.control-group label {
    flex: 0 0 auto;
    /* Don't grow, don't shrink, base on content */
    width: 150px;
    /* Fixed width for labels for alignment */
    font-weight: 600;
    color: #555;
    text-align: right;
}

.control-group select {
    flex: 1 1 200px;
    /* Allow input to grow, shrink, with a base of 200px */
    padding: 10px;
    border: 1px solid #b0e0e6;
    border-radius: 6px;
    font-size: 1em;
    box-sizing: border-box;
}

/* Action Buttons */
.action-button {
    background-color: #009999;
    color: white;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, opacity 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 153, 153, 0.3);
    width: auto;
    border: none;
    display: block;
    /* Make buttons block level */
    margin: 20px auto;
    /* Center buttons */
}

.action-button:hover:not(:disabled) {
    background-color: #007a7a;
    transform: translateY(-2px);
}

.action-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
}

.action-button.hidden {
    display: none;
}

/* Status Area & Progress */
.status-area {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    background-color: #f0fbfb;
    border: 1px solid #c9eded;
}

.status-message {
    font-size: 1em;
    color: #444;
    margin-bottom: 15px;
    text-align: center;
    min-height: 20px;
    /* Reserve space */
}

.status-message.error {
    color: #d9534f;
    /* Red for errors */
    font-weight: 600;
}

.status-message.success {
    color: #5cb85c;
    /* Green for success */
    font-weight: 600;
}

.progress-bar-container {
    width: 100%;
    margin-top: 15px;
}

.progress-bar {
    width: 100%;
    background-color: #ddd;
    border-radius: 5px;
    height: 15px;
    margin-bottom: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background-color: #009999;
    /* Siemens blue-green */
    border-radius: 5px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 5px;
}

/* OCR Preview Area */
.preview-area {
    margin-top: 30px;
    padding: 20px;
    background-color: #f0fbfb;
    border: 1px solid #c9eded;
    border-radius: 10px;
    text-align: center;
}

.preview-area h2 {
    color: #007a7a;
    font-size: 1.5em;
    margin-bottom: 15px;
}

#ocr-preview-canvas {
    border: 1px solid #ddd;
    max-width: 100%;
    height: auto;
    display: block;
    /* Ensures no extra space below canvas */
    margin: 0 auto;
    /* Center the canvas */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.preview-note {
    font-size: 0.85em;
    color: #888;
    margin-top: 15px;
}

.hidden {
    display: none !important;
}


/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 25px;
        margin-top: 20px;
        margin-bottom: 20px;
    }

    h1 {
        font-size: 2em;
    }

    .tagline {
        font-size: 1em;
    }

    .drop-area {
        padding: 40px 15px;
    }

    .drop-area p {
        font-size: 1em;
    }

    .upload-button,
    .action-button {
        padding: 10px 20px;
        font-size: 0.95em;
    }

    .controls-area {
        padding: 20px;
    }

    .control-group {
        flex-direction: column;
        /* Stack label and select vertically */
        align-items: flex-start;
        /* Align stacked items to start */
    }

    .control-group label {
        width: 100%;
        /* Full width for labels when stacked */
        text-align: left;
        margin-bottom: 5px;
        /* Add space below label */
    }

    .control-group select {
        width: 100%;
        /* Full width for select when stacked */
    }

    .preview-area {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 1.8em;
    }

    .tagline {
        font-size: 0.9em;
    }

    .drop-area {
        padding: 30px 10px;
    }
}