/* Import Font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #ece9e6 0%, #ffffff 100%); /* Light, clean gradient */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 40px 20px;
    box-sizing: border-box;
    color: #333;
}

.calculator-container { /* Keep class name for consistency */
    background-color: rgba(255, 255, 255, 0.98);
    padding: 30px 40px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08); /* Softer shadow */
    max-width: 800px; /* Adjusted width */
    width: 100%;
    backdrop-filter: blur(3px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 40px;
}

/* --- Logo & Header --- */
.logo-container { text-align: center; margin-bottom: 20px; padding-top: 10px; }
#headerLogo { max-height: 60px; width: auto; display: inline-block; }
.calculator-header { text-align: center; margin-bottom: 15px; color: #3a3a3a; }
.header-icon { font-size: 2.8em; color: #4CAF50; margin-bottom: 8px; } /* Green for 'positive' action */
h1 { font-weight: 700; font-size: 2em; margin: 0; color: #2c3e50; }
.subtitle { color: #555; text-align: center; margin-bottom: 35px; font-size: 1.05em; font-weight: 300; line-height: 1.5; }

/* --- Converter Area --- */
.converter-area {
    background-color: #f9fbfc;
    border: 1px dashed #cce4ff; /* Dashed border for drop zone feel */
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    margin-bottom: 30px;
}

/* Upload Section */
.upload-section { margin-bottom: 25px; }
.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    border: 2px dashed #007bff;
    border-radius: 10px;
    cursor: pointer;
    background-color: #f0f8ff;
    transition: background-color 0.3s ease;
}
.upload-label:hover { background-color: #e6f2ff; }
.upload-label i {
    font-size: 3em;
    color: #007bff;
    margin-bottom: 15px;
}
.upload-label span {
    font-size: 1.1em;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}
.upload-label small {
    font-size: 0.85em;
    color: #666;
}

/* Preview Area */
.preview-area {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    align-items: flex-start; /* Align items top */
    text-align: left; /* Align text left */
}
.image-preview-container {
    flex-shrink: 0; /* Don't shrink image container */
    width: 150px; /* Max width for preview */
    height: 150px;
    border: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* Hide overflow */
    background-color: #f8f8f8;
}
#imagePreview {
    max-width: 100%;
    max-height: 100%;
    display: block;
    object-fit: contain; /* Scale image nicely */
}
.input-info {
    flex-grow: 1; /* Allow info to take remaining space */
    font-size: 0.9em;
    color: #555;
}
.input-info p { margin: 0 0 8px 0; }
.input-info strong { color: #333; margin-right: 5px; }
.input-info span { word-break: break-all; } /* Break long file names */

/* Controls Area */
.controls-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}
.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 400px; /* Limit width */
    justify-content: center;
}
.control-group label {
    font-weight: 500;
    color: #444;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
}
.control-group select,
.control-group input[type="range"] {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1em;
    font-family: 'Poppins', sans-serif;
    flex-grow: 1; /* Allow select/range to take space */
}
.control-group select { min-width: 120px; }
.quality-control input[type="range"] { margin-left: 5px; }
#qualityValue { font-weight: 600; }

/* Convert Button */
.convert-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 30px;
    font-size: 1.05em;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #ff8a00 0%, #e52e71 100%); /* Orange to Pink gradient */
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 10px rgba(229, 46, 113, 0.2);
}
.convert-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(229, 46, 113, 0.4);
}
.convert-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}
.convert-button i { transition: transform 0.5s ease; }
.convert-button:disabled i { animation: spin 1.5s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Status Area */
.status-area { margin-top: 20px; }
.status-message {
    font-size: 1em;
    font-weight: 500;
    color: #007bff;
    margin-bottom: 15px;
    min-height: 1.5em; /* Prevent layout shift */
}
.status-message.error { color: #e74c3c; }
.download-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 25px;
    font-size: 1em;
    font-weight: 600;
    color: #fff;
    background-color: #28a745; /* Green download */
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.3s ease;
}
.download-button:hover { background-color: #218838; }


/* --- Error Message --- */
.error-message {
    color: #e74c3c; background-color: #fdedec; border: 1px solid #fadbd8; padding: 12px 15px;
    border-radius: 8px; margin-top: 20px; text-align: center; font-weight: 500;
}

/* --- Explanation Section --- */
.explanation-section {
    margin-top: 35px;
    padding: 25px;
    background-color: #fdfefe;
    border: 1px solid #e5e8e8;
    border-radius: 10px;
}
.explanation-section h2 {
    text-align: center;
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 1.4em;
}
.explanation-item { margin-bottom: 25px; }
.explanation-item:last-child { margin-bottom: 0; }
.explanation-item h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15em;
    color: #16a085; /* Teal color */
    margin-bottom: 10px;
    font-weight: 600;
}
.explanation-item h4 i { font-size: 1.1em; }
.explanation-item p, .explanation-item ul {
    font-size: 0.95em;
    line-height: 1.7;
    color: #444;
    margin-left: 5px;
}
.explanation-item ul { padding-left: 25px; margin-top: 10px; }
.explanation-item li { margin-bottom: 8px; }
.explanation-item strong { color: #2c3e50; font-weight: 600; }

/* --- CTA & Embed Sections (Inherited/Adjusted) --- */
.cta-section {
    margin-top: 35px; padding: 30px; border-radius: 10px;
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%); /* Light Purple gradient */
    text-align: center; border: 1px solid rgba(0, 0, 0, 0.05);
}
.cta-section h2 { color: #8e44ad; font-weight: 700; font-size: 1.4em; margin-top: 0; margin-bottom: 15px; }
.cta-section p { color: #6a1b9a; font-size: 1em; line-height: 1.6; margin-bottom: 25px; }
.cta-buttons { display: flex; justify-content: center; gap: 15px; flex-wrap: wrap; margin-bottom: 20px; }
.cta-link {
    display: inline-flex; align-items: center; gap: 8px; padding: 12px 25px; border-radius: 25px;
    text-decoration: none; font-weight: 600; font-size: 0.95em;
    transition: transform 0.2s ease, box-shadow 0.3s ease; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.cta-link.website { background-color: #9b59b6; color: white; border: 1px solid #9b59b6; }
.cta-link.website:hover { background-color: #8e44ad; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(155, 89, 182, 0.3); }
.cta-link.whatsapp { background-color: #25D366; color: white; border: 1px solid #25D366; }
.cta-link.whatsapp:hover { background-color: #1ebe57; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4); }
.cta-footer { font-size: 0.9em; color: #7b1fa2; font-style: italic; margin-top: 15px; margin-bottom: 0; }

#embedSection { text-align: center; margin-top: 40px; padding-top: 20px; border-top: 1px dashed #ddd; }
button#embedBtn {
    display: inline-flex; justify-content: center; align-items: center; gap: 10px;
    width: auto; padding: 10px 20px;
    background: #6c757d; color: white; border: none; border-radius: 8px; font-size: 0.95em;
    font-weight: 500; cursor: pointer; margin: 15px auto 15px auto;
    transition: background-color 0.3s ease, transform 0.2s ease;
}
button#embedBtn:hover { background-color: #5a6268; transform: translateY(-1px); }
#embedCodeArea { margin-top: 15px; padding: 20px; border: 1px dashed #ccc; border-radius: 8px; background-color: #fdfdfd; }
#embedCodeArea h4 { margin-top: 0; margin-bottom: 10px; font-size: 1em; color: #555; text-align: center; }
#embedCodeOutput { width: 100%; box-sizing: border-box; padding: 10px; font-family: monospace; font-size: 0.9em; border: 1px solid #ccc; border-radius: 4px; background-color: #f0f0f0; resize: vertical; color: #333; }
#embedCodeArea p { font-size: 0.85em; color: #777; text-align: center; margin-top: 10px; margin-bottom: 0; }


/* --- Responsiveness --- */
@media (max-width: 768px) {
    .calculator-container { padding: 20px; max-width: 95%; }
    h1 { font-size: 1.6em; }
    .preview-area { flex-direction: column; align-items: center; text-align: center; }
    .image-preview-container { margin-bottom: 15px; width: 100%; height: 200px;} /* Adjust preview size */
    .input-info { text-align: center; }
    .controls-area { padding-top: 15px; }
    .control-group { flex-direction: column; gap: 8px; max-width: 90%; }
    .control-group label { justify-content: center; }
    .control-group select, .control-group input[type="range"] { width: 100%; }
    .cta-buttons { flex-direction: column; align-items: center; }
    .cta-link { width: 80%; justify-content: center; margin-bottom: 10px; }
}

@media (max-width: 480px) {
    body { padding: 20px 10px; }
    .calculator-container { padding: 15px; }
    h1 { font-size: 1.4em; }
    .subtitle { font-size: 0.95em; }
    .upload-label { padding: 30px 15px; }
    .upload-label i { font-size: 2.5em; }
    .upload-label span { font-size: 1em; }
    .preview-area { padding: 15px; }
    .image-preview-container { height: 160px; }
    .explanation-section { padding: 15px; }
    .explanation-item h4 { font-size: 1.1em; }
    .explanation-item p, .explanation-item ul { font-size: 0.9em; }
}