/* ===============================
   RESET E BASE
================================*/

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Inter", sans-serif;
    background: #f8fafc;
    color: #0f172a;
}

.container {
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===============================
   HEADER
================================*/

.header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 18px 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    text-decoration: none;
}

.logo span {
    color: #3b82f6;
}

.back-btn {
    background: #e2e8f0;
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    color: #0f172a;
    font-size: 14px;
    transition: 0.2s ease;
}

.back-btn:hover {
    background: #cbd5e1;
}

/* ===============================
   LAYOUT PRINCIPAL
================================*/

.main-area {
    display: flex;
    gap: 40px;
    padding: 40px 0;
}

.form-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* ===============================
   PRÉVIA DO PDF
================================*/

.preview-area {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.preview-title {
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 14px;
}

.preview-frame {
    width: 100%;
    max-width: 520px;
    aspect-ratio: 210 / 297; /* proporção A4 */
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #ffffff;
    overflow: auto;
}

/* ===============================
   CARDS (FORM)
================================*/

.card {
    background: #fff;
    padding: 22px;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    box-shadow: rgba(0,0,0,0.03) 0px 3px 10px;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
}

/* ===============================
   INPUTS
================================*/

label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    margin-top: 14px;
}

input,
textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    font-size: 15px;
    transition: 0.2s;
}

input:focus,
textarea:focus {
    border-color: #3b82f6;
    background: #fff;
    outline: none;
}

textarea {
    height: 110px;
    resize: none;
}

.row-2 {
    display: flex;
    gap: 14px;
}

.row-2 > div {
    flex: 1;
}

/* ===============================
   ITENS DO ORÇAMENTO (DESKTOP)
================================*/

.item-row {
    display: grid;
    grid-template-columns: 1fr 80px 130px 110px 40px;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.item-desc {
    padding: 10px;
}

.item-total {
    font-weight: 600;
    text-align: right;
    color: #0f172a;
}

.del-item {
    background: #fee2e2;
    border: none;
    color: #b91c1c;
    font-size: 20px;
    border-radius: 8px;
    cursor: pointer;
    padding: 3px 0;
}

.del-item:hover {
    background: #fecaca;
}

.add-btn {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    border-radius: 10px;
    border: 1px dashed #3b82f6;
    color: #3b82f6;
    background: #eff6ff;
    cursor: pointer;
    font-size: 15px;
    transition: 0.2s;
}

.add-btn:hover {
    background: #dbeafe;
}

/* ===============================
   TOTAL FINAL
================================*/

.total-box {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 20px;
    text-align: center;
    margin-top: -10px;
}

.total-box p {
    font-size: 14px;
}

.total-box h3 {
    font-size: 26px;
    font-weight: 700;
    margin-top: 6px;
}

/* ===============================
   BOTÃO GERAR PDF
================================*/

.generate-btn {
    background: #3b82f6;
    padding: 16px;
    width: 100%;
    border-radius: 12px;
    border: none;
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s ease;
}

.generate-btn:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

/* ===============================
   RESPONSIVO (TABLET)
================================*/

@media (max-width: 900px) {
    .main-area {
        flex-direction: column;
    }

    .preview-area {
        width: 100%;
    }

    .preview-frame {
        max-width: 460px;
    }
}

/* ===============================
   RESPONSIVO (MOBILE)
================================*/

@media (max-width: 600px) {

    .logo {
        font-size: 18px;
    }

    .back-btn {
        font-size: 13px;
        padding: 6px 12px;
    }

    /* ITENS DO ORÇAMENTO – MOBILE
       1ª linha: descrição (100% largura)
       2ª linha: Qtd | Unit | Total | X
    */
    .item-row {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr 40px;
        grid-template-rows: auto auto;
        column-gap: 8px;
        row-gap: 8px;
        align-items: center;
    }

    .item-desc {
        grid-column: 1 / -1;   /* ocupa a linha inteira */
        font-size: 15px;
        padding: 12px;
    }

    .item-qty {
        grid-column: 1 / 2;
    }

    .item-price {
        grid-column: 2 / 3;
    }

    .item-total {
        grid-column: 3 / 4;
        text-align: right;
        font-size: 14px;
    }

    .del-item {
        grid-column: 4 / 5;
        align-self: stretch;
    }

    .preview-frame {
        max-width: 360px;
    }
}
