/* Apply border-box sizing to every element. */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Configure the main page appearance. */
body {
    font-family: Arial, Helvetica, sans-serif;
    background: #eef2f7;
    color: #263238;
    min-height: 100vh;
}

/* Configure the application main container. */
.application-container {
    width: 100%;
    max-width: 1600px;
    margin: auto;
    padding: 20px;
}

/* Style the application header. */
.application-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(120deg, #172554, #2563eb);
    color: white;
    padding: 25px;
    border-radius: 14px;
    margin-bottom: 20px;
    gap: 15px;
}

/* Style the application heading. */
.application-header h1 {
    font-size: 28px;
    margin-bottom: 8px;
}

/* Style the application description. */
.application-header p {
    color: #dbeafe;
    font-size: 14px;
}

/* Style the header label. */
.header-label {
    background: #ffffff25;
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
}

/* Arrange the editor and preview sections. */
.editor-layout {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

/* Style the customization panel. */
.control-panel {
    background: white;
    padding: 22px;
    border-radius: 14px;
    box-shadow: 0 5px 20px #0000000d;
}

/* Style panel heading. */
.control-panel h2 {
    font-size: 21px;
    margin-bottom: 22px;
    color: #172554;
}

/* Style form labels. */
.control-panel label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    margin-top: 16px;
    margin-bottom: 7px;
}

/* Style text inputs, dropdowns and text areas. */
.control-panel input[type="text"],
.control-panel select,
.control-panel textarea {
    width: 100%;
    padding: 11px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #ffffff;
    font-size: 14px;
    outline: none;
}

/* Highlight focused form controls. */
.control-panel input:focus,
.control-panel textarea:focus,
.control-panel select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px #2563eb20;
}

/* Style color selection controls. */
.control-panel input[type="color"] {
    width: 100%;
    height: 42px;
    padding: 3px;
    border: 1px solid #ddd;
    border-radius: 7px;
    cursor: pointer;
}

/* Style range controls. */
.control-panel input[type="range"] {
    width: 100%;
    accent-color: #2563eb;
    cursor: pointer;
}

/* Style uploaded image input. */
.control-panel input[type="file"] {
    width: 100%;
    font-size: 12px;
}

/* Arrange checkbox and its text. */
.control-panel .checkbox-label {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
}

/* Style checkbox input. */
.checkbox-label input {
    width: 17px;
    height: 17px;
    accent-color: #2563eb;
}

/* Shared button appearance. */
button {
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s ease;
}

/* Add hover animation to buttons. */
button:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

/* Style primary update button. */
.primary-button {
    width: 100%;
    padding: 13px;
    margin-top: 22px;
    border-radius: 8px;
    background: #2563eb;
    color: white;
    font-size: 14px;
}

/* Style reset button. */
.secondary-button {
    width: 100%;
    padding: 13px;
    margin-top: 10px;
    border-radius: 8px;
    background: #e5e7eb;
    color: #263238;
    font-size: 14px;
}

/* Style the preview section. */
.preview-section {
    background: white;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 5px 20px #0000000d;
    min-width: 0;
}

/* Arrange preview heading elements. */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
}

/* Style preview title. */
.preview-header h2 {
    font-size: 21px;
    color: #172554;
}

/* Style preview description. */
.preview-header span {
    color: #64748b;
    font-size: 12px;
}

/* Center the greeting canvas. */
.canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 300px;
    padding: 20px;
    border-radius: 12px;
    background-color: #e2e8f0;
    background-image:
        linear-gradient(45deg, #cbd5e1 25%, transparent 25%),
        linear-gradient(-45deg, #cbd5e1 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #cbd5e1 75%),
        linear-gradient(-45deg, transparent 75%, #cbd5e1 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

/* Style the actual greeting canvas. */
#greetingCanvas {
    display: block;
    width: 100%;
    max-width: 650px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 5px 25px #00000030;
}

/* Arrange download buttons. */
.download-controls {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* Style PNG download button. */
.download-button {
    flex: 1;
    padding: 14px;
    background: #15803d;
    color: white;
    border-radius: 8px;
    font-size: 14px;
}

/* Style transparent sticker button. */
.transparent-button {
    flex: 1;
    padding: 14px;
    background: #7c3aed;
    color: white;
    border-radius: 8px;
    font-size: 14px;
}

/* Style template section. */
.template-section {
    margin-top: 35px;
}

/* Style template heading. */
.template-section h2 {
    font-size: 19px;
    margin-bottom: 15px;
    color: #172554;
}

/* Create responsive template grid. */
.template-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

/* Style individual template cards. */
.template-card {
    min-height: 95px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    color: #334155;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 7px;
}

/* Style template emojis. */
.template-card span {
    font-size: 30px;
}

/* Highlight template cards on hover. */
.template-card:hover {
    background: #dbeafe;
    border-color: #2563eb;
}

/* Style application footer. */
.application-footer {
    text-align: center;
    padding: 25px 10px;
    color: #64748b;
    font-size: 12px;
}

/* Adapt the application for tablets. */
@media (max-width: 1000px) {
    .editor-layout {
        grid-template-columns: 290px minmax(0, 1fr);
    }

    .template-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Adapt the application for mobile phones. */
@media (max-width: 700px) {
    .application-container {
        padding: 10px;
    }

    .application-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
    }

    .application-header h1 {
        font-size: 22px;
    }

    .editor-layout {
        grid-template-columns: 1fr;
    }

    .control-panel {
        padding: 18px;
    }

    .preview-section {
        padding: 12px;
    }

    .canvas-container {
        padding: 8px;
        min-height: 200px;
    }

    .download-controls {
        flex-direction: column;
    }

    .preview-header h2 {
        font-size: 18px;
    }

    .template-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Adapt the application for very small mobile screens. */
@media (max-width: 380px) {
    .application-header h1 {
        font-size: 19px;
    }

    .template-grid {
        grid-template-columns: 1fr 1fr;
    }

    .preview-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Style the greeting share button. */
.share-button {
    flex: 1;
    padding: 14px;
    background: #0891b2;
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
}

/* Add hover effect to the share button. */
.share-button:hover {
    background: #0e7490;
    transform: translateY(-2px);
}

/* Arrange download and share buttons on smaller screens. */
@media (max-width: 700px) {

    /* Stack all download and share buttons vertically. */
    .download-controls {
        flex-direction: column;
    }

    /* Make all action buttons full width. */
    .download-controls button {
        width: 100%;
    }
}




/* Style the export settings container. */
.export-settings {
    margin-top: 25px;
    padding: 18px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

/* Style export section headings. */
.export-settings h3 {
    margin: 18px 0 12px;
    color: #172554;
    font-size: 17px;
}

/* Remove unnecessary top margin from the first heading. */
.export-settings h3:first-child {
    margin-top: 0;
}

/* Style export settings labels. */
.export-settings label {
    display: block;
    margin-top: 13px;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: bold;
}

/* Style export dropdowns. */
.export-settings select {
    width: 100%;
    padding: 11px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: white;
}

/* Style export range controls. */
.export-settings input[type="range"] {
    width: 100%;
    accent-color: #2563eb;
}

/* Style animation preview button. */
.animation-button {
    width: 100%;
    padding: 13px;
    margin-top: 15px;
    background: #2563eb;
    color: white;
    border-radius: 8px;
}

/* Style stop animation button. */
.stop-animation-button {
    width: 100%;
    padding: 13px;
    margin-top: 10px;
    background: #475569;
    color: white;
    border-radius: 8px;
}

/* Style animated GIF download button. */
.animated-download-button {
    width: 100%;
    padding: 14px;
    margin-top: 10px;
    background: #9333ea;
    color: white;
    border-radius: 8px;
}

/* Style disabled animation buttons. */
.animation-button:disabled,
.stop-animation-button:disabled,
.animated-download-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Display animation progress information. */
.animation-status {
    margin-top: 12px;
    color: #475569;
    font-size: 12px;
    text-align: center;
}

/* Ensure export settings fit small screens. */
@media (max-width: 700px) {
    .export-settings {
        padding: 13px;
    }

    .export-settings h3 {
        font-size: 16px;
    }
}