body {
    font-family: sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align top */
    min-height: 100vh;
    background-color: #f0f0f0;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

.container {
    text-align: center;
    background-color: #fff;
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    max-width: 1100px;
    width: 95%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    margin-top: 0;
    margin-bottom: 25px;
    color: #333;
    font-size: 1.8em;
    width: 100%;
}

h2 {
    margin-top: 20px;
    margin-bottom: 15px;
    color: #444;
    font-size: 1.3em;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    width: 100%;
    text-align: center;
}

/* --- PREVIEW CANVAS STYLES --- */
.preview-container {
    text-align: center;
    margin-bottom: 30px;
    border: 1px solid #ddd;
    padding: 20px;
    border-radius: 5px;
    background-color: #f9f9f9;
    width: 100%;
    max-width: 500px;
    box-sizing: border-box;
}

.preview-container h2 {
    margin-top: 0;
    border-bottom: none;
}

#previewCanvas {
    display: block;
    margin: 0 auto 15px auto;
    width: 100%;
    max-width: 450px;
    height: auto;
    border: 1px solid #ccc;
    background-color: #e0e0e0;
}
.preview-container .loading-text {
    color: #666;
    font-style: italic;
    margin-bottom: 15px;
}

#downloadPreviewBtn {
    padding: 10px 20px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}
#downloadPreviewBtn:hover {
    background-color: #218838;
}


/* Controls Styling (General) */
.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 450px;
    box-sizing: border-box;
}
.controls label {
    font-weight: bold;
    color: #555;
    margin-bottom: -10px; /* Adjust negative margin to align labels above inputs */
    width: 90%;
    text-align: left;
}

/* Image Specific Controls (Portrait Upload Only) */
.controls.image-controls {
    border: 1px solid #e0e0e0;
    padding: 20px;
    border-radius: 5px;
    background-color: #fafafa;
    margin-top: 20px; /* Added margin */
}
.controls.image-controls > label {
     margin-bottom: 5px;
}

/* General File Input */
.controls input[type="file"] {
     padding: 8px;
     border: 1px solid #ccc;
     border-radius: 4px;
     width: 90%;
     box-sizing: border-box;
     background-color: #f9f9f9;
     cursor: pointer;
     font-size: 0.9em;
     color: #555;
     margin-top: 5px;
     text-align: left;
}
.controls input[type="file"]::file-selector-button {
     padding: 6px 12px;
     margin-right: 10px;
     background-color: #e9ecef;
     border: 1px solid #ced4da;
     border-radius: 3px;
     cursor: pointer;
     font-size: 0.9em;
     color: #495057;
}
.controls input[type="file"]:hover::file-selector-button {
     background-color: #dee2e6;
}

/* Download Button Container (Above Editor Canvas) */
.download-button-container {
    margin-bottom: 20px;
    margin-top: 20px; /* Added margin */
    text-align: center;
    width: 100%;
    max-width: 450px;
}

/* Shared style for the primary download button */
#downloadBtn {
    padding: 12px 25px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}
#downloadBtn:hover {
    background-color: #0056b3;
}

/* Editor Canvas Section */
.editor-section {
    width: 100%;
    max-width: 450px;
    margin-bottom: 20px;
    margin-top: 10px; /* Added margin */
}
.editor-section h2 {
     margin-bottom: 10px;
}

/* Canvas Wrapper - Load SVG via CSS */
.canvas-wrapper {
    position: relative;
    width: 400px; /* Match businessCardCanvas width */
    height: 700px; /* Match businessCardCanvas height */
    margin: 0 auto;
    border: 1px solid #ccc;
    background-image: url('card_background.svg');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-color: #f8f8f8; /* Fallback color if SVG fails */
}

/* Business Card Canvas Styles - Absolute Position & Transparent */
#businessCardCanvas {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    background-color: transparent; /* Crucial for seeing the CSS background */
    /* border is handled by the wrapper */
}

/* Text Controls (Below Canvas) */
.controls.text-controls {
    border: 1px solid #e0e0e0;
    padding: 20px;
    border-radius: 5px;
    background-color: #fafafa;
    margin-bottom: 0; /* Removed bottom margin */
    max-height: none; /* Ensure content isn't clipped */
    overflow-y: visible; /* Ensure content isn't clipped */
}
.controls.text-controls h2 {
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: none;
}

/* Specific Input Type Styles within text-controls */
.controls.text-controls input[type="text"] {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 90%;
    box-sizing: border-box;
    text-align: left;
    margin-bottom: 5px; /* Reduced margin */
}
.controls.text-controls input[type="file"] {
     margin-top: 10px;
     margin-bottom: 5px; /* Reduced margin */
}

/* Style for the Color Picker */
.controls.text-controls input[type="color"] {
    padding: 5px; /* Add some padding inside the color box */
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 90%; /* Match other inputs */
    box-sizing: border-box;
    cursor: pointer;
    height: 40px; /* Give it a reasonable height */
    margin-top: 0px; /* Align with label more closely */
    margin-bottom: 5px; /* Space below the color picker */
    background-color: #ffffff; /* Ensure it has a background */
}

/* --- REMOVED CSS for .overlay-controls (If any were present) --- */