/* Global Reset */
* { 
    box-sizing: border-box; 
}

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    padding: 0; 
    margin: 0;
    background: #f8f9fa; 
    min-height: 100vh;
}

/* --- HEADER (Blue to Green Gradient) --- */
.site-header {
    width: 100%;
    padding: 40px 20px 60px 20px;
    background: linear-gradient(135deg, #007bff 0%, #28a745 100%);
    color: white;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.site-header h1 {
    margin: 0;
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: 4px;
    text-transform: uppercase;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.search-container {
    margin-top: 25px;
    width: 100%;
    max-width: 450px;
    margin-left: auto;
    margin-right: auto;
}

#site-search {
    width: 100%;
    padding: 14px 25px;
    border-radius: 30px;
    border: none;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    outline: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#site-search:focus {
    transform: scale(1.03);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

/* --- MAIN EDITOR GRID --- */
#main-editor-container {
    width: 95%;
    max-width: 1300px; 
    display: grid;
    grid-template-columns: repeat(2, 1fr); 
    gap: 40px; 
    padding: 40px 0;
    flex-grow: 1;
}

#status {
    grid-column: 1 / -1; 
    color: #888; 
    text-align: center; 
    margin: 40px 0;
}

.white-box { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 20px; 
    background: white; 
    padding: 20px; 
    border-radius: 16px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.08); 
    align-items: flex-start;
}

/* --- IMAGE & PALETTE SQUARES --- */
.display-image, .display-palette { 
    flex: 1; 
    aspect-ratio: 1 / 1; 
    min-width: 0; 
}

.display-image { 
    border: 2px solid #eeeeee; 
    background: #ffffff; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    overflow: hidden; 
    padding: 15px; 
    border-radius: 8px;
}

.display-image canvas, .display-image svg { 
    max-width: 100%; 
    max-height: 100%; 
    object-fit: contain; 
}

.display-palette { 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
    overflow-y: auto; 
    padding-right: 10px;
}

.display-palette::-webkit-scrollbar { width: 6px; }
.display-palette::-webkit-scrollbar-thumb { background: #ddd; border-radius: 10px; }

/* Palette Elements */
.palette-section h3 { 
    margin: 0 0 10px 0; 
    font-size: 14px; 
    color: #444; 
    border-bottom: 1px solid #eee; 
    padding-bottom: 5px; 
    font-weight: 600;
}

.color-group { 
    display: flex; 
    align-items: center;
    justify-content: space-between; 
    margin-bottom: 10px;
}

input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 28px;
    height: 28px;
    cursor: pointer;
    background: none;
}
input[type="color"]::-webkit-color-swatch { border: 1px solid #ddd; border-radius: 4px; }

/* --- DOWNLOAD BUTTONS --- */
.button-row {
    flex: 0 0 100%; 
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.download-btn {
    flex: 1;
    padding: 14px 5px;
    cursor: pointer;
    background: #ffffff;
    border: 1px solid #007bff;
    color: #007bff;
    border-radius: 8px;
    font-weight: bold;
    font-size: 12px;
    text-transform: uppercase;
    transition: 0.2s ease;
}

.download-btn:hover { background: #007bff; color: white; }

/* --- ABOUT & CONTACT CONTAINERS --- */
.about-container, .contact-container {
    width: 90%;
    max-width: 1100px;
    margin: 60px auto;
    flex-grow: 1;
}

.about-section, .contact-card {
    display: flex;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    overflow: hidden;
}

.about-section { padding: 40px; gap: 50px; align-items: center; }

/* --- CONTACT FORM SPECIFICS --- */
.contact-form { flex: 2; padding: 40px; border-right: 1px solid #eee; }
.contact-info { flex: 1; padding: 40px; background: #fafafa; }

.input-group { margin-bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
.input-group label { font-weight: 600; font-size: 0.9rem; color: #666; }
.input-group input, .input-group textarea {
    padding: 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 1rem; outline: none;
}
.input-group input:focus, .input-group textarea:focus { border-color: #007bff; }

.info-item { margin-bottom: 25px; }
.info-item strong { display: block; color: #007bff; font-size: 0.85rem; text-transform: uppercase; margin-bottom: 5px; }

/* --- FOOTER --- */
.site-footer {
    width: 100%;
    padding: 40px 20px;
    background: linear-gradient(135deg, #007bff 0%, #28a745 100%);
    color: white;
    text-align: center;
    margin-top: auto;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
}

.footer-content {
    max-width: 1300px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.footer-links { display: flex; gap: 20px; margin-bottom: 10px; }
.footer-links a { color: white; text-decoration: none; font-size: 0.9rem; opacity: 0.8; transition: 0.3s; }
.footer-links a:hover { opacity: 1; text-decoration: underline; }

.back-to-top {
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 8px 15px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    transition: 0.3s ease;
}

/* --- RESPONSIVENESS --- */
@media (max-width: 1000px) {
    #main-editor-container { grid-template-columns: 1fr; max-width: 650px; }
    .white-box { flex-direction: column; }
    .display-image, .display-palette { width: 100%; aspect-ratio: auto; }
    .display-image { aspect-ratio: 1 / 1; }
    .display-palette { max-height: 350px; }
    .about-section, .contact-card { flex-direction: column; }
    .contact-form { border-right: none; border-bottom: 1px solid #eee; }
}

@media (max-width: 600px) {
    .button-row { flex-direction: column; }
    .site-header h1 { font-size: 2.2rem; }
}