/**
 * Mobilní úpravy pro formulářová pole
 * Každý input na samostatný řádek na mobilu
 */

@media (max-width: 768px) {
    /* Upravit padding pro checkout-main-content */
    .checkout-main-content {
        padding: 12px !important;
    }
    
    /* Upravit padding pro výběr dopravy a platby */
    .vyber-dopravy,
    .vyber-platby {
        padding: 12px !important;
    }
    /* Osobní údaje */
    .fakturacni-udaje {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .fakturacni-udaje input[type="text"],
    .fakturacni-udaje input[type="email"],
    .fakturacni-udaje input[type="tel"],
    .fakturacni-udaje input[type="number"],
    .fakturacni-udaje select {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
    
    /* Telefon wrapper - předvolba a číslo na jednom řádku */
    .telefon-wrapper {
        display: flex;
        gap: 8px;
        width: 100%;
    }
    
    .telefon-predvolba-select {
        flex: 0 0 100px;
    }
    
    .telefon-predvolba-select select {
        width: 100%;
    }
    
    .telefon-wrapper input[type="tel"] {
        flex: 1;
    }
    
    /* Adresní údaje */
    .adresa-udaje {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .adresa-udaje input[type="text"],
    .adresa-udaje input[type="number"] {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
    
    /* Firemní údaje */
    .company-fields {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .company-fields input[type="text"] {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
    
    /* Doručovací adresa - přepsat VŠECHNY grid layouty */
    .dorucovaci-sekce .dorucovaci-udaje.fakturacni-udaje.adresa-udaje {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        grid-template-columns: none !important;
        grid-template-columns: unset !important;
        grid-template-columns: 1fr !important;
    }
    
    /* Všechny inputy v doručovací sekci */
    .dorucovaci-sekce .dorucovaci-udaje input {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        grid-column: 1 / -1 !important;
        grid-column: unset !important;
    }
    
    /* Specificky pro dorucovaci-udaje s více třídami */
    .dorucovaci-udaje.fakturacni-udaje.adresa-udaje {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .dorucovaci-udaje.fakturacni-udaje.adresa-udaje input {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
    
    /* Checkbox pro stejnou adresu */
    .dorucovaci-checkbox {
        margin-bottom: 16px;
    }
    
    .dorucovaci-checkbox label {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 14px;
    }
    
    /* Země info */
    .zeme-info {
        margin-top: 8px;
        font-size: 14px;
        color: #666;
        grid-column: unset !important;
        width: 100% !important;
    }
    
    /* Override pro všechny grid layouty v doručovací sekci */
    .dorucovaci-sekce * {
        grid-template-columns: unset !important;
    }
    
    /* Ještě silnější override pro problematickou doručovací adresu */
    #step-3 .dorucovaci-sekce .dorucovaci-udaje,
    .form-step .dorucovaci-sekce .dorucovaci-udaje,
    .predplatne-container .dorucovaci-sekce .dorucovaci-udaje,
    .dorucovaci-udaje.fakturacni-udaje.adresa-udaje {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: none !important;
        grid-template-columns: 1fr !important;
    }
    
    #step-3 .dorucovaci-sekce .dorucovaci-udaje input,
    .form-step .dorucovaci-sekce .dorucovaci-udaje input,
    .predplatne-container .dorucovaci-sekce .dorucovaci-udaje input,
    .dorucovaci-udaje.fakturacni-udaje.adresa-udaje input {
        width: 100% !important;
        grid-column: unset !important;
        grid-column: 1 / -1 !important;
    }
    
    /* Nuclear option - přepsat VŠECHNA grid pravidla pro inputy */
    .dorucovaci-sekce input[name="shipping_first_name"],
    .dorucovaci-sekce input[name="shipping_last_name"],
    .dorucovaci-sekce input[name="shipping_street"],
    .dorucovaci-sekce input[name="shipping_house_number"],
    .dorucovaci-sekce input[name="shipping_city"],
    .dorucovaci-sekce input[name="shipping_postcode"] {
        grid-column: 1 / -1 !important;
        width: 100% !important;
        max-width: 100% !important;
        display: block !important;
    }
    
    /* Zajistit správnou výšku inputů */
    .fakturacni-udaje input,
    .fakturacni-udaje select,
    .adresa-udaje input,
    .dorucovaci-udaje input,
    .company-fields input {
        min-height: 44px;
        padding: 10px 12px;
        font-size: 16px; /* Zabrání zoomu na iOS */
        border: 1px solid #ddd;
        border-radius: 8px;
        background-color: #fff;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
    }
    
    /* Styling pro select */
    .telefon-predvolba-select select {
        background-image: url('data:image/svg+xml;utf8,<svg fill="black" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
        background-repeat: no-repeat;
        background-position: right 8px center;
        background-size: 20px;
        padding-right: 32px;
    }
    
    /* Upravit mezery mezi sekcemi */
    .udaje-sekce {
        margin-bottom: 24px;
    }
    
    .udaje-sekce h4 {
        margin-bottom: 16px;
        font-size: 18px;
        font-weight: 600;
    }
}

/* Zachovat původní layout pro desktop */
@media (min-width: 769px) {
    /* Osobní údaje - 2 sloupce */
    .fakturacni-udaje {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
    
    /* Email a telefon na celou šířku */
    .fakturacni-udaje input[type="email"],
    .telefon-wrapper {
        grid-column: 1 / -1;
    }
    
    /* Adresní údaje */
    .adresa-udaje {
        display: grid;
        grid-template-columns: 2fr 1fr;
        gap: 16px;
    }
    
    /* Město a PSČ na jednom řádku */
    .adresa-udaje input[name="billing_city"],
    .adresa-udaje input[name="shipping_city"] {
        grid-column: 1;
    }
    
    .adresa-udaje input[name="billing_postcode"],
    .adresa-udaje input[name="shipping_postcode"] {
        grid-column: 2;
    }
    
    /* Země info na celou šířku */
    .zeme-info {
        grid-column: 1 / -1;
    }
    
    /* Firemní údaje */
    .company-fields {
        display: grid;
        grid-template-columns: 2fr 1fr 1fr;
        gap: 16px;
        margin-bottom: 16px;
    }
}