/* General Body and Font Styles */
body {
    font-family: 'Inter', sans-serif;
    background-color: #f0f4f8;
    /* Light gray background */
    color: #333;
    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;
    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: 700px;
    /* Slightly smaller for this app */
    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.2em;
    font-weight: 700;
}

.tagline {
    color: #666;
    font-size: 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.1em;
    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: 15px;
    gap: 10px;
    /* Space between label and input */
}

.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,
.control-group input[type="number"],
.control-group input[type="text"],
.control-group input[type="color"] {
    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;
}

.control-group input[type="color"] {
    padding: 5px;
    /* Adjust padding for color picker */
    height: 40px;
    /* Consistent height for color picker */
}

.checkbox-group {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    justify-content: center;
    /* Center checkbox and label */
}

.checkbox-group input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.2);
    /* Slightly larger checkbox */
}

.checkbox-group label {
    font-weight: normal;
    /* Normal weight for checkbox label */
    width: auto;
    /* Auto width for checkbox label */
    text-align: left;
}

/* Preview Area */
.preview-area {
    background-color: #f0fbfb;
    border: 1px solid #c9eded;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    margin-bottom: 25px;
    text-align: center;
}

.preview-area p {
    margin-bottom: 10px;
    color: #555;
}

#page-number-preview {
    display: inline-block;
    padding: 5px 10px;
    background-color: #d9edf7;
    /* Light blue for preview text background */
    border: 1px dashed #a7d9ee;
    border-radius: 4px;
    color: #007a7a;
    font-weight: bold;
    font-size: 1.2em;
    min-width: 50px;
    /* Ensure a minimum width */
}

.preview-note {
    font-size: 0.85em;
    color: #888;
    margin-top: 10px;
}


/* 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: 15px 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 Message */
.status-message {
    font-size: 1em;
    color: #444;
    margin-top: 20px;
    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;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 25px;
        margin-top: 20px;
        margin-bottom: 20px;
    }

    h1 {
        font-size: 1.8em;
    }

    .tagline {
        font-size: 0.9em;
    }

    .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 input 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,
    .control-group input {
        width: 100%;
        /* Full width for inputs when stacked */
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 1.6em;
    }

    .tagline {
        font-size: 0.8em;
    }

    .drop-area {
        padding: 30px 10px;
    }
}