/* General Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    line-height: 1.6;
    padding: 0;
    /* Updated background to a blue tech gradient */
    background: linear-gradient(135deg, #0d324d 0%, #17527a 50%, #2a8a9f 100%);
    color: #333; /* Default text color for elements on light backgrounds */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Language Switcher */
#languageSwitcher {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: rgba(255, 255, 255, 0.85); /* Slightly more opaque for better readability on new bg */
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1000;
}

#languageSwitcher button {
    background: none;
    border: none;
    color: #0056b3; /* Slightly darker blue for button text */
    cursor: pointer;
    padding: 5px 8px;
    font-size: 0.9em;
    font-weight: 500;
    margin: 0 3px;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
}

#languageSwitcher button:hover {
    background-color: #e0e0e0;
}

#languageSwitcher button.active {
    background-color: #0056b3; /* Matching darker blue */
    color: white;
    font-weight: bold;
}

/* Page Top Header (Main Title and Subtitle) */
.page-top-header {
    text-align: center;
    padding: 60px 20px 30px 20px;
    /* Text colors updated for dark background */
    color: #E0E0E0; /* Default light color for this section */
}

.page-top-header h1 {
    font-size: 2.8em;
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
    color: #FFFFFF; /* Bright white for main heading */
}

.page-top-header p {
    font-size: 1.1em;
    color: #C0C0C0; /* Softer light grey for sub-heading */
    max-width: 700px;
    margin: 0 auto 20px auto;
}


/* Features Section Styles (Now at the top) */
.features-section {
    text-align: center;
    padding: 20px 20px 40px 20px; /* Padding top, horizontal, bottom */
}

.features-section > h2 { /* Targeting direct child h2 */
    font-size: 2em;
    /* Text color updated for dark background */
    color: #FFFFFF;
    margin-bottom: 30px;
    font-weight: 500;
    max-width: 1100px; /* Ensures this heading aligns with the grid below it */
    margin-left: auto;
    margin-right: auto;
}

.features-grid {
    display: flex;
    justify-content: space-around;
    gap: 25px;
    flex-wrap: wrap;
    max-width: 1100px; /* Constrain grid width */
    margin-left: auto;
    margin-right: auto;
}

.feature-card {
    background-color: #ffffff;
    border-radius: 10px;
    padding: 25px 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.07);
    flex-basis: calc(33.333% - 30px); /* Adjust for gap */
    min-width: 260px;
    text-align: center;
    transition: transform 0.25s ease-in-out, box-shadow 0.25s ease-in-out;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.feature-icon {
    font-size: 2.8em;
    margin-bottom: 15px;
    line-height: 1;
}
#feature1IconDisplay { color: #ffc107; } /* Gift - Yellow/Orange */
#feature2IconDisplay { color: #28a745; } /* Shield - Green */
#feature3IconDisplay { color: #dc3545; } /* Rocket - Red */


.feature-card h3 {
    font-size: 1.25em;
    color: #333;
    margin-bottom: 10px;
    font-weight: 500;
}

.feature-card p {
    font-size: 0.9em;
    color: #666;
    line-height: 1.5;
    flex-grow: 1; /* Helps align content if card heights vary */
}


/* Main Container Layout (White Box) */
.container {
    max-width: 1100px; /* Ensures this container aligns with the features grid on wider screens */
    width: 100%; /* Makes it responsive to smaller screens, taking available width up to max-width */
    margin: 0 auto 40px auto; /* Top margin is 0, features-section handles spacing. Auto for L/R centering */
    background: rgba(255, 255, 255, 0.97); /* Slightly more opaque white */
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    flex-grow: 1;
    display: flex;
    gap: 30px;
}

/* Usage Steps Side Panel */
#usageStepsPanel {
    flex: 0 0 250px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background-color: #fdfdfd;
    height: fit-content;
}

#usageStepsPanel h3 {
    font-size: 1.2em;
    color: #2c3e50;
    margin-bottom: 15px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

#usageStepsPanel ol {
    list-style-type: decimal;
    padding-left: 20px; /* Indent list items */
}

#usageStepsPanel li {
    margin-bottom: 10px;
    font-size: 0.95em;
    color: #555;
}

/* Main Content Area (Tool area within the white box) */
.main-content-area {
    flex-grow: 1;
    min-width: 0; /* Important for flex items to prevent overflow issues */
}

.upload-section, .status-section, .results-section {
    margin-bottom: 30px;
    padding: 25px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background-color: #fdfdfd;
}

.upload-section #uploadInstruction {
    display: block;
    margin-bottom: 12px;
    font-weight: 500;
    color: #444;
}

.file-upload-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

#customFileUploadButton {
    padding: 10px 15px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    transition: background-color 0.2s ease;
    flex-shrink: 0; /* Prevent button from shrinking */
}

#customFileUploadButton:hover {
    background-color: #5a6268;
}

#selectedFileNameDisplay {
    font-size: 0.9em;
    color: #555;
    background-color: #f8f9fa;
    padding: 8px 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
    flex-grow: 1;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    min-width: 0; /* Allow shrinking if needed */
}

button {
    border: none;
    padding: 12px 28px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 1em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease-out;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    margin: 5px 0;
}
#customFileUploadButton:hover {
    transform: none;
    box-shadow: none;
    background-color: #5a6268;
}

button:hover:not(#customFileUploadButton) {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

button:active:not(#customFileUploadButton) {
    transform: translateY(0px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: translateY(0);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

#processButton {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
}
#processButton:hover:not(:disabled) {
    background: linear-gradient(135deg, #0069d9 0%, #004085 100%);
}

#downloadButton {
    background: linear-gradient(135deg, #ff7e5f 0%, #feb47b 100%);
    color: white;
}
#downloadButton:hover:not(:disabled) {
    background: linear-gradient(135deg, #f86a43 0%, #fea05b 100%);
}

#statusMessage {
    font-style: italic;
    color: #555;
    padding: 10px;
    border-radius: 5px;
    background-color: #f9f9f9;
    border-left: 3px solid #007bff;
}

.results-section h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    font-weight: 500;
}

.category {
    margin-bottom: 20px;
}

.category h3 {
    background-color: #f0f4f8;
    padding: 10px 15px;
    border-radius: 6px;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.15em;
    font-weight: 500;
    color: #2c3e50;
    border-left: 4px solid #007bff;
}

.category ul { list-style-type: none; padding-left: 0; }
.category li { padding: 8px 5px; border-bottom: 1px dashed #eee; transition: background-color 0.2s ease; }
.category li:last-child { border-bottom: none; }
.category li:hover { background-color: #f9f9f9; }
.category li a { text-decoration: none; color: #0066cc; font-weight: 500; }
.category li a:hover { text-decoration: underline; color: #004085; }

footer {
    text-align: center;
    padding: 25px 20px;
    margin-top: auto;
    font-size: 0.9em;
    color: #D0D0D0; /* Light grey footer text for dark background */
    background-color: rgba(0, 0, 0, 0.1); /* Semi-transparent dark footer background */
    border-top: 1px solid rgba(255,255,255,0.1); /* Light border on dark bg */
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .container {
        flex-direction: column;
        /* max-width is NOT overridden here, it inherits 1100px or fits viewport */
        /* It will naturally become as wide as the content allows or the viewport width minus its own horizontal padding/margins */
    }
    #usageStepsPanel {
        flex: 1 1 auto; /* Allow it to take full width when stacked */
        margin-bottom: 30px;
        order: -1; /* Place steps panel above main content on mobile if desired */
    }
    .page-top-header h1 { font-size: 2.5em; }
    .page-top-header p { font-size: 1em; }
    .features-section > h2 { font-size: 1.8em; }
    .feature-card {
        flex-basis: calc(50% - 20px); /* Two cards per row */
        min-width: 240px;
    }
}


@media (max-width: 768px) {
    #languageSwitcher { top: 10px; right: 10px; padding: 6px 8px; }
    #languageSwitcher button { font-size: 0.85em; }

    .page-top-header { padding: 50px 20px 20px 20px; }
    .page-top-header h1 { font-size: 2.2em; }
    .page-top-header p { font-size: 1em; max-width: 90%;}

    .features-section { padding: 20px 20px 30px 20px; }
    .features-section > h2 { font-size: 1.7em; }
    .feature-card {
        flex-basis: calc(100% - 20px); /* One card per row on smaller screens */
        max-width: 380px;
        margin-left: auto;
        margin-right: auto;
    }
    .feature-icon { font-size: 2.5em; }
    .feature-card h3 { font-size: 1.15em; }
    .feature-card p { font-size: 0.85em; }

    .container { 
        margin-left: 20px; /* Adjust L/R margin for smaller screens */
        margin-right: 20px;
        margin-bottom: 20px;
        padding: 20px; 
        border-radius: 10px; 
        gap: 20px; 
        max-width: none; /* Allow container to take full width within its margins */
        width: auto; /* Let it be determined by its content and margins */
    }
    
    .upload-section, .status-section, .results-section { padding: 20px; }
    
    .file-upload-wrapper { flex-direction: column; align-items: stretch; gap: 8px; }
    #customFileUploadButton { width: 100%; text-align: center; }
    #selectedFileNameDisplay { width: 100%; text-align: left; }
    
    button:not(#customFileUploadButton) { font-size: 0.95em; padding: 12px 20px; } 
    #customFileUploadButton { font-size: 0.95em; } 

    .upload-section { display: flex; flex-direction: column; align-items: stretch; }
    #processButton, #downloadButton { display: block; width: 100%; margin-top: 10px; margin-bottom: 10px; }
    .results-section #downloadButton { width: auto; display: block; margin-left: auto; margin-right: auto; max-width: 300px; }
    .category h3 { font-size: 1.1em; }
    .category li a { font-size: 0.95em; }
}

@media (max-width: 480px) {
    .page-top-header { padding: 40px 15px 15px 15px; }
    .page-top-header h1 { font-size: 1.8em; }
    .page-top-header p { font-size: 0.9em; }

    .features-section { padding: 15px 15px 25px 15px; }
    .features-section > h2 { font-size: 1.5em; margin-bottom: 20px; }
    .feature-card { padding: 20px 15px; }
    .feature-icon { font-size: 2.2em; }
    .feature-card h3 { font-size: 1.1em; }

    .container { 
        margin-left: 10px; /* Further adjust L/R margin for very small screens */
        margin-right: 10px;
        margin-bottom: 10px;
        padding: 15px; 
    }
    .upload-section, .status-section, .results-section { padding: 15px; }
    #usageStepsPanel { padding: 15px; }
    #usageStepsPanel h3 { font-size: 1.1em; }
    #usageStepsPanel li { font-size: 0.9em; }
}