/* ====== ZÁKLADNÍ KONTEJNER FORMULÁŘE ====== */
#vizualizace-sofi-form-container {
    max-width: 640px;
    margin: 2rem auto;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 2px 24px rgba(0,0,0,0.07);
    padding: 2rem 2.5rem;
    font-family: 'Segoe UI', Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#vizualizace-sofi-form-container h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #1a202c;
}

/* ====== VŠECHNY INPUTY PŘES CELOU ŠÍŘKU FORMULÁŘE ====== */
#vizualizaceSofiForm input[type="text"],
#vizualizaceSofiForm input[type="email"],
#vizualizaceSofiForm input[type="tel"],
#vizualizaceSofiForm input[type="password"],
#vizualizaceSofiForm input[type="number"],
#vizualizaceSofiForm select,
#vizualizaceSofiForm textarea {
    width: 100%;
    max-width: 100%;
    margin-bottom: 1rem;
    box-sizing: border-box;
    display: block;
    margin-left: 0;
    margin-right: 0;
}

/* ====== SEKCE FORMULÁŘE ====== */
.form-section { 
    margin-bottom: 1.5rem; 
    width: 100%;
}
.form-section label { 
    display: block; 
    margin-bottom: 5px; 
    font-weight: 500;
    color: #374151;
}

/* ====== TELEFON: POPIS NAD, POLE VEDLE SEBE ====== */
.form-section label[for="teltel"] {
    margin-bottom: 8px;
    font-weight: 500;
}
.tel-inline {
    display: flex;
    gap: 15px;
    width: 100%;
}
#tel-prefix, #teltel {
    width: 100%;
    min-width: 0;
}
@media (max-width: 768px) {
    .tel-inline { flex-direction: column; gap: 10px; }
}

/* ====== SERVICE OPTIONS (STYLY, EXPRESNÍ, SOUHLASY) ====== */
.sofi-style-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.service-option {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 0 !important;
    font-weight: 400 !important;
}

.service-option:hover {
    border-color: #d1d5db;
    background: #f3f4f6;
}

.service-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: #377dff;
    flex-shrink: 0;
}

.service-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

/* Přepiš původní service-content styly */
#vizualizaceSofiForm .service-content {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-grow: 1 !important;
    gap: 12px !important;
    flex-direction: row !important;
}

#vizualizaceSofiForm .service-title {
    font-weight: 600 !important;
    color: #1f2937 !important;
    font-size: 1rem !important;
    line-height: 1.2 !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
}

#vizualizaceSofiForm .service-desc {
    font-size: 0.875rem !important;
    color: #6b7280 !important;
    line-height: 1.3 !important;
    text-align: right !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
}

.service-desc a {
    color: #377dff;
    text-decoration: none;
}

.service-desc a:hover {
    text-decoration: underline;
}

/* ====== CHECKED STATES ====== */
.service-option input[type="checkbox"]:checked ~ .service-content .service-title,
.service-option input[type="checkbox"]:checked ~ .service-content .service-desc {
    color: #1f2937;
}

/* Obecný checked styl */
.service-option:has(input[type="checkbox"]:checked) {
    border-color: #377dff;
    background: #f0f9ff;
}

/* EXPRESNÍ DODÁNÍ - červená */
.express-option:has(input[type="checkbox"]:checked) {
    border-color: #ef4444 !important;
    background: #fef2f2 !important;
}

.express-option:has(input[type="checkbox"]:checked) .service-title,
.express-option:has(input[type="checkbox"]:checked) .service-desc {
    color: #dc2626 !important;
}

.express-option input[type="checkbox"]:checked {
    accent-color: #ef4444;
}

/* SOUHLASY - zelená */
.consent-option:has(input[type="checkbox"]:checked) {
    border-color: #22c55e !important;
    background: #f0fdf4 !important;
}

.consent-option:has(input[type="checkbox"]:checked) .service-title,
.consent-option:has(input[type="checkbox"]:checked) .service-desc {
    color: #16a34a !important;
}

.consent-option input[type="checkbox"]:checked {
    accent-color: #22c55e;
}

/* ====== TEXTAREA ====== */
.form-section textarea { 
    min-height: 80px; 
    resize: vertical; 
    font-family: inherit;
}

/* ====== OBECNÉ INPUT STYLY ====== */
.form-section input[type="text"],
.form-section input[type="email"],
.form-section input[type="tel"],
.form-section input[type="number"],
.form-section textarea {
    padding: 10px 14px;
    margin-bottom: 8px; 
    border: 1px solid #e1e5ee;
    border-radius: 8px; 
    font-size: 1rem; 
    transition: border-color 0.15s, background-color 0.15s;
}
.form-section input:focus, 
.form-section textarea:focus { 
    border-color: #377dff; 
    outline: none;
    background-color: #f8faff;
}

/* ====== UPLOAD OBLAST ====== */
.file-upload-area {
    background: #f7f8fa;
    border: 2px dashed #b7b7b7;
    border-radius: 10px;
    min-height: 120px;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    cursor: pointer; 
    text-align: center;
    margin-bottom: 6px; 
    position: relative;
    transition: border-color 0.25s, background-color 0.25s;
    width: 100%;
}
.file-upload-area:hover {
    border-color: #377dff;
    background: #f9fafb;
}
.upload-icon { font-size: 2.2rem; margin-bottom: 8px; }
.upload-text { margin-top: 6px; font-size: 1.1rem; color: #383d47; font-weight: 500;}
.upload-hint { font-size: 0.95rem; color: #888; margin-top: 4px; }

/* ====== PHOTO LIST ====== */
#sofiPhotoList { margin: 10px 0; }
.sofi-photo-thumb { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    margin-bottom: 12px;
    padding: 8px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}
.sofi-thumb-img { 
    width: 55px; 
    height: 55px; 
    border-radius: 8px; 
    object-fit: cover; 
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.photo-item button { 
    background: none; 
    border: none; 
    font-size: 1.2em; 
    cursor: pointer; 
    color: #dc2626;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.15s;
}
.photo-item button:hover {
    background-color: #fee2e2;

/* ====== SUMMARY ====== */
.sofi-summary { 
    margin: 22px 0 16px 0; 
    font-size: 1.1rem; 
    display: block;
    padding: 16px;
    background: #f0f9ff;
    border: 1px solid #0ea5e9;
    border-radius: 8px;
    color: #0c4a6e;
}

/* ====== SUBMIT BUTTON ====== */
.submit-btn {
    width: 100%; 
    background: #377dff; 
    color: #fff; 
    font-size: 1.12rem;
    border: none; 
    border-radius: 8px; 
    padding: 14px 0; 
    font-weight: 700;
    transition: background-color 0.18s; 
    margin-top: 0.4rem; 
    cursor: pointer;
}
.submit-btn:hover, 
.submit-btn:focus { background: #215ab6; }
.submit-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* ====== ERROR STATES ====== */
.input-error {
    border-color: #f03333 !important;
    background-color: #fef2f2 !important;
}
.form-error {
    color: #f03333 !important;
    font-size: 0.97em !important;
    min-height: 18px !important;
    display: block !important;
    margin: 4px 0 0 0 !important;
    font-weight: 500 !important;
}

/* ====== ÚSPĚCH ====== */
.form-success { 
    text-align: center; 
    margin-top: 2rem;
    padding: 16px;
    background: #f0fdf4;
    border: 1px solid #22c55e;
    border-radius: 8px;
    color: #166534;
}

.form-success.visible {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 9999 !important;
    background: #f0fdf4 !important;
    border: 2px solid #22c55e !important;
    border-radius: 12px !important;
    padding: 20px !important;
    margin: 20px 0 !important;
    text-align: center !important;
    color: #166534 !important;
    font-size: 16px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 480px) {
    #vizualizace-sofi-form-container {
        margin: 1rem;
        padding: 1.5rem;
    }
    #vizualizaceSofiForm input[type="text"],
    #vizualizaceSofiForm input[type="email"],
    #vizualizaceSofiForm input[type="tel"],
    #vizualizaceSofiForm select,
    #vizualizaceSofiForm textarea {
        width: 100%;
    }
    /* Telefon na malých mobilech */
    #tel-prefix, #teltel {
        padding: 12px 14px !important;
        font-size: 16px !important; /* Zabráni zoom na iOS */
        height: 50px !important;
    }
    
    .service-option {
        padding: 12px;
    }
    
    .service-title {
        font-size: 0.95rem;
    }
    
    .service-desc {
        font-size: 0.8rem;
    }
}

/* ====== LOADING STATE BUTTON ====== */
.submit-btn.loading {
    position: relative;
    color: transparent;
}
.submit-btn.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ====== FALLBACK PRO STARŠÍ PROHLÍŽEČE ====== */
/* Pro prohlížeče bez podpory :has() */
.service-option.checked {
    border-color: #377dff;
    background: #f0f9ff;
}

.express-option.checked {
    border-color: #ef4444 !important;
    background: #fef2f2 !important;
}

.express-option.checked .service-title,
.express-option.checked .service-desc {
    color: #dc2626 !important;
}

.consent-option.checked {
    border-color: #22c55e !important;
    background: #f0fdf4 !important;
}

.consent-option.checked .service-title,
.consent-option.checked .service-desc {
    color: #16a34a !important;
}

.file-upload-area {
    border: none;
    outline: none;
    font-family: inherit;
}

.file-upload-area:focus {
    border-color: #377dff !important;
    box-shadow: 0 0 0 3px rgba(55, 125, 255, 0.1);
}

/* Button styling pro upload */
button.file-upload-area {
    border: 2px dashed #b7b7b7 !important;
    outline: none;
    font-family: inherit;
}

button.file-upload-area:focus {
    border-color: #377dff !important;
    box-shadow: 0 0 0 3px rgba(55, 125, 255, 0.1);
}

/* ====== STYLE ROW - nová struktura ====== */
.style-row {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 16px !important;
    border: 2px solid #e5e7eb !important;
    border-radius: 12px !important;
    background: #f9fafb !important;
    margin-bottom: 12px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.style-row:hover {
    border-color: #d1d5db !important;
    background: #f3f4f6 !important;
}

.style-row input[type="checkbox"] {
    width: 20px !important;
    height: 20px !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
    accent-color: #377dff !important;
}

.style-label {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    flex-grow: 1 !important;
    cursor: pointer !important;
    margin: 0 !important;
}

.style-name {
    font-weight: 600 !important;
    color: #1f2937 !important;
    min-width: 140px !important;
    font-size: 1rem !important;
}

.style-desc {
    color: #6b7280 !important;
    font-size: 0.875rem !important;
    margin-left: auto !important;
    text-align: right !important;
}

/* CHECKED STATES pro style-row */
.style-row:has(input[type="checkbox"]:checked) {
    border-color: #377dff !important;
    background: #f0f9ff !important;
}

/* EXPRESNÍ DODÁNÍ */
.style-row.express-option:has(input[type="checkbox"]:checked) {
    border-color: #dc2626 !important;
    background: #fef2f2 !important;
}

.style-row.express-option input[type="checkbox"]:checked {
    accent-color: #dc2626 !important;
}

/* SOUHLASY */
.style-row.consent-option:has(input[type="checkbox"]:checked) {
    border-color: #16a34a !important;
    background: #f0fdf4 !important;
}

.style-row.consent-option input[type="checkbox"]:checked {
    accent-color: #16a34a !important;
}

/* FALLBACK pro starší prohlížeče */
.style-row.checked {
    border-color: #377dff !important;
    background: #f0f9ff !important;
}

.style-row.express-option.checked {
    border-color: #dc2626 !important;
    background: #fef2f2 !important;
}

.style-row.consent-option.checked {
    border-color: #16a34a !important;
    background: #f0fdf4 !important;
}
