/* Define Color Variables */
:root {
  --primary-color: #b6121b; /* The requested red */
  --primary-hover-color: #9d0f16; /* A slightly darker red for hover */
  --button-text-color: white;
  --disabled-bg-color: #cccccc;
  --disabled-text-color: #666666;
  --edit-active-bg-color: #e0e0e0; /* Light gray for active edit */
  --edit-active-text-color: #333333;
}


body {
    font-family: sans-serif;
    margin: 0;
    padding: 20px;
    /* Changed background color */
    background-color: var(--primary-color);
    display: flex;
    justify-content: center;
}

.container {
    width: 95%;
    max-width: 1400px;
    background-color: #fff; /* Keep container white */
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); /* Adjusted shadow slightly */
}

/* Styles for the new header container */
.header-container {
    display: flex; /* Use flexbox for logo and title alignment */
    align-items: center; /* Vertically align items in the middle */
    gap: 15px; /* Space between logo and title */
    margin-bottom: 20px; /* Space below the header */
}

.app-logo {
    height: 50px; /* Adjust logo height as needed */
    width: auto; /* Maintain aspect ratio */
}

/* Removed text-align: center from H1 - now aligned by flex container */
h1 {
    color: #333;
    margin: 0; /* Remove default margins */
}


.input-section {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background-color: #eee;
    border-radius: 5px;
    flex-wrap: wrap;
}

.input-section .file-input-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* General Button Styling using variables */
button {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background-color: var(--primary-color);
    color: var(--button-text-color);
    transition: background-color 0.3s ease;
    font-weight: bold; /* Make text bolder */
}

button:hover:not(:disabled) {
    background-color: var(--primary-hover-color);
}

button:disabled {
    background-color: var(--disabled-bg-color);
    color: var(--disabled-text-color);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Specific button overrides if needed - using same base style for now */
#convertBtn {
     /* Optional: Make convert stand out more? For now, uses default red. */
     /* background-color: #some-other-shade; */
}

/* Special styling for Edit button when active */
#editBtn.editing {
    background-color: var(--edit-active-bg-color);
    color: var(--edit-active-text-color);
}
#editBtn.editing:hover {
     background-color: darken(var(--edit-active-bg-color), 10%); /* Slightly darker gray on hover */
}


.input-section input[type="text"] {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    flex-grow: 1;
    min-width: 150px;
}

#fileName {
    font-style: italic;
    color: #555;
}

.display-section {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    height: 60vh;
    min-height: 450px; /* Increased min-height slightly */
}

.view-window {
    /* flex: 1;  <-- REMOVED THIS LINE */
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 10px;
    overflow-y: auto;
    background-color: #fdfdfd;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* --- ADDED RULES FOR WINDOW WIDTH --- */
#pdfViewContainer {
    flex: 3; /* Takes 3 parts of the available space (3/4 total) */
}

#csvViewContainer {
    flex: 1; /* Takes 1 part of the available space (1/4 total) */
}
/* --- END OF ADDED RULES --- */

.view-window h2 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 10px;
    color: #555;
    font-size: 1.1em;
    flex-shrink: 0;
}

/* PDF Canvas Styling for Resolution */
#pdfCanvas {
    /* Canvas element scales to fit container */
    width: 100%;
    height: auto; /* Maintain aspect ratio based on width */
    border: 1px dashed #eee;
    flex-grow: 1;
    object-fit: contain; /* Ensure content fits */
    display: block; /* Ensure it behaves like a block element */
}


#pdfViewContainer #pdfLoading,
#csvViewContainer #apiLoading,
#pdfPlaceholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.8);
    padding: 15px;
    border-radius: 5px;
    text-align: center;
    z-index: 10;
}

#pdfNav {
    text-align: center;
    margin-top: 10px;
    flex-shrink: 0;
}

/* Navigation buttons also use primary colors */
#pdfNav button {
    padding: 5px 10px;
    margin: 0 5px;
}


#csvTextArea {
    width: 100%;
    height: 100%;
    flex-grow: 1;
    border: none;
    padding: 5px;
    box-sizing: border-box;
    font-family: monospace;
    font-size: 0.9em;
    resize: none;
    background-color: #fdfdfd;
    color: #333;
}

#csvTextArea:read-only {
   background-color: #f0f0f0;
}


.action-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Action buttons use primary colors */
.csv-actions button {
   /* Base button style applies */
}