* {
    box-sizing: border-box;
}

:root {
    --bg: #f3f4f6;
    --card: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --border: #d1d5db;
    --danger: #dc2626;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;

    background: var(--bg);
    color: var(--text);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;
}

.app {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 40px;
}

header {
    background: #111827;
    color: white;

    padding:
        calc(16px + env(safe-area-inset-top))
        16px
        18px;

    position: sticky;
    top: 0;
    z-index: 10;
}

header h1 {
    margin: 0;

    font-size: 22px;
    font-weight: 700;

    text-align: center;
}

main {
    padding: 16px;
}


/* ТИП ПОЇЗДКИ */

.trip-type {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.radio-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    min-height: 54px;

    background: white;
    border: 2px solid var(--border);
    border-radius: 12px;

    font-weight: 600;
    cursor: pointer;
}

.radio-card:has(input:checked) {
    border-color: var(--primary);
    background: #eff6ff;
    color: var(--primary-dark);
}

.radio-card input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}


/* ПОЛЯ */

.field {
    display: block;
    margin-bottom: 16px;
}

.field > span {
    display: block;
    font-weight: 600;
    margin-bottom: 7px;
}

input[type="text"],
input[type="number"],
textarea {
    width: 100%;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: white;

    padding: 14px;

    font-size: 17px;
    color: var(--text);

    outline: none;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

input:focus,
textarea:focus {
    border-color: var(--primary);

    box-shadow:
        0 0 0 3px
        rgba(37, 99, 235, 0.12);
}


/* АВТО */

.select-button {
    width: 100%;
    min-height: 54px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: white;

    font-size: 17px;
    font-weight: 600;

    text-align: left;

    padding: 14px;

    margin-bottom: 16px;

    cursor: pointer;
}


/* ОДИНИЦІ */

.units {
    display: grid;
    grid-template-columns: 1fr 1fr;

    gap: 10px;

    margin: -4px 0 16px;
}

.units label {
    min-height: 48px;

    background: white;

    border: 1px solid var(--border);
    border-radius: 10px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    font-weight: 600;
    cursor: pointer;
}

.units input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}


/* ПРОЙДЕНИЙ ШЛЯХ */

.distance {
    display: flex;

    justify-content: space-between;
    align-items: center;

    background: #e0f2fe;

    border-radius: 10px;

    padding: 14px;

    margin-bottom: 16px;
}

.distance strong {
    color: #0369a1;
    font-size: 18px;
}


/* ФОТО */

.photos {
    margin-top: 20px;
    margin-bottom: 20px;
}

.photos h2 {
    font-size: 17px;
    margin: 0 0 10px;
    font-weight: 600;
}

.photo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.photo-box {
    background: white;

    border-radius: 12px;

    padding: 8px;

    border: 1px solid var(--border);
}

.photo-button {
    width: 100%;
    min-height: 54px;

    border: 0;
    border-radius: 9px;

    font-size: 16px;
    font-weight: 600;

    cursor: pointer;

    padding: 10px;
}

.camera-button {
    background: #2563eb;
    color: white;
}

.camera-button:active {
    background: #1d4ed8;
}

.gallery-button {
    width: 100%;

    min-height: 48px;

    margin-top: 8px;

    border: 1px solid var(--border);
    border-radius: 9px;

    background: #f9fafb;
    color: #374151;

    font-size: 15px;
    font-weight: 600;

    cursor: pointer;

    padding: 10px;
}

.gallery-button:active {
    background: #e5e7eb;
}

.preview {
    width: 100%;

    margin-top: 8px;

    border-radius: 8px;

    display: block;

    aspect-ratio: 4 / 3;

    object-fit: cover;
}

.photo-hint {
    color: var(--muted);

    font-size: 13px;
    line-height: 1.4;

    margin-top: 8px;
}


/* НАДІСЛАТИ */

.send-button {
    width: 100%;

    min-height: 60px;

    border: 0;
    border-radius: 12px;

    background: #16a34a;
    color: white;

    font-size: 19px;
    font-weight: 700;

    margin-top: 10px;

    cursor: pointer;
}

.send-button:active {
    background: #15803d;
    transform: scale(0.99);
}


/* ОЧИСТИТИ */

.clear-button {
    width: 100%;

    min-height: 48px;

    border: 0;

    background: transparent;

    color: var(--danger);

    font-size: 15px;

    margin-top: 8px;

    cursor: pointer;
}


/* ПОВІДОМЛЕННЯ */

.message {
    margin-top: 12px;

    padding: 12px;

    border-radius: 10px;

    background: #fee2e2;

    color: #991b1b;

    font-size: 14px;
}


/* MODAL */

.modal {
    position: fixed;

    inset: 0;

    background: rgba(0, 0, 0, 0.55);

    display: flex;

    align-items: flex-end;

    justify-content: center;

    z-index: 1000;
}

.modal-content {
    width: 100%;
    max-width: 600px;

    background: white;

    border-radius:
        18px 18px 0 0;

    padding:
        22px 16px
        calc(30px + env(safe-area-inset-bottom));
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 16px;
}

.car-option {
    display: flex;

    align-items: center;

    gap: 12px;

    min-height: 58px;

    border-bottom:
        1px solid #e5e7eb;

    font-size: 17px;

    cursor: pointer;
}

.car-option input {
    width: 20px;
    height: 20px;

    accent-color: var(--primary);
}

.modal-close {
    width: 100%;

    min-height: 50px;

    margin-top: 18px;

    border: 0;

    border-radius: 10px;

    background: #e5e7eb;

    font-size: 16px;
    font-weight: 600;

    cursor: pointer;
}


/* HIDDEN */

.hidden {
    display: none !important;
}


/* МАЛЕНЬКИЙ ЕКРАН */

@media (max-width: 380px) {

    .trip-type {
        grid-template-columns: 1fr;
    }

    .photo-grid {
        grid-template-columns: 1fr;
    }

}
