/* --- General Body & Typography --- */
@font-face {
    font-family: 'DejaVu Sans';
    src: url('../fonts/DejaVuSans.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: #171c20; /* Dark background */
    color: #f0f0f0; /* Light text for readability */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Header --- */
header {
    background-color: #1f2429; /* Slightly lighter than body */
    padding: 25px 50px;
    border-bottom: 1px solid #baa361;
    text-align: center;
}

header h1 {
    margin: 0;
    color: #baa361; /* Gold accent for the title */
    font-size: 2.2em;
    font-weight: 600;
}

/* --- Main Content --- */
main {
    flex: 1;
    padding: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 50px; /* Increased gap for better separation */
}

/* --- Section Styling --- */
.controls-section, .canvas-section, .generation-section, .output-section {
    background-color: #1f2429;
    padding: 40px;
    border-radius: 10px;
    border: 1px solid #333;
    width: 95%;
    max-width: none; /* allow full width */
    margin-left: auto; /* 2.5% margins total via width:95% */
    margin-right: auto;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.controls-section {
    display: flex;
    gap: 30px;
}

.upload-section, .placeholders-section {
    flex-basis: 50%;
    display: flex;
    flex-direction: column;
}

.placeholders-section .btn {
    margin-bottom: 15px;
}

h2 {
    color: #baa361;
    margin-top: 0;
    border-bottom: 1px solid #444;
    padding-bottom: 20px;
    margin-bottom: 30px;
    font-size: 1.5em;
    font-weight: 500;
}

/* --- Editor (Two-column) --- */
.editor-section {
    background-color: #1f2429;
    padding: 40px;
    border-radius: 10px;
    border: 1px solid #333;
    width: 95%;
    max-width: none;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.canvas-pane {
    flex: 2 1 0;
    min-width: 0; /* allow canvas to shrink */
}

.sidebar-pane {
    flex: 1 1 0;
    min-width: 260px;
    background: #1a1f24;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 16px;
    position: sticky;
    top: 24px;
    overflow: auto;
}

.btn-group-vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.sample-panel {
    border-top: 1px dashed #333;
    padding-top: 16px;
}

.subheading {
    color: #baa361;
    margin: 0 0 12px 0;
    font-weight: 500;
}

.sample-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

@media (max-width: 900px) {
    .editor-section {
        flex-direction: column;
    }
    .sidebar-pane {
        position: static;
        width: 100%;
    }
}

/* --- Canvas & Placeholders --- */
#canvas-container {
    position: relative;
    display: inline-block;
    border: 1px solid #baa361;
    padding: 10px;
    background-color: #171c20;
    border-radius: 4px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#certificate-canvas {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
}

/* Sidebar controls refinement */
.sidebar-pane .btn {
    width: 100%;
}

.sidebar-pane input[type="text"],
.sidebar-pane input[type="number"],
.sidebar-pane textarea,
.sidebar-pane select {
    box-sizing: border-box;
}

.placeholder {
    position: absolute;
    width: 14px;
    height: 14px;
    background: transparent;
    border: 2px dashed #baa361; /* subtle handle */
    border-radius: 50%;
    cursor: move;
    user-select: none;
    transform: translate(-50%, -50%);
    z-index: 2; /* above canvas */
    opacity: 0.35;
    transition: opacity 0.15s ease;
}

.placeholder:hover {
    opacity: 0.9;
}

/* --- Output & Footer --- */
#coordinates-output {
    font-family: "SF Mono", "Fira Code", monospace;
    white-space: pre;
    background-color: #171c20;
    padding: 20px;
    border-radius: 5px;
    border: 1px solid #333;
    color: #baa361;
    font-size: 1.1em;
}

footer {
    background-color: #1f2429;
    color: #baa361;
    text-align: center;
    padding: 25px 50px;
    margin-top: auto;
    border-top: 1px solid #baa361;
}

footer p {
    margin: 0;
    font-weight: 500;
}
