/* assets/style.css */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f4f5f7; /* fundo claro */
    color: #222;
    line-height: 1.4;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

.app-header {
    margin-bottom: 16px;
}

.app-header h1 {
    font-size: 1.6rem;
    margin-bottom: 4px;
}

.app-header p {
    font-size: 0.9rem;
    color: #555;
}

/* ALERTAS */

.alert-box {
    padding: 10px 14px;
    margin-bottom: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.alert-info {
    background: #e0f2fe;
    color: #075985;
    border-color: #bae6fd;
}

.alert-error {
    background: #fee2e2;
    color: #7f1d1d;
    border-color: #fecaca;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

#js-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

/* CARDS / FORMULÁRIOS */

.card {
    background: #ffffff;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.card.light {
    background: #f9fafb;
}

.card h2 {
    font-size: 1.2rem;
    margin-bottom: 12px;
}

.card h3 {
    font-size: 1rem;
    margin-bottom: 8px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #ccd0d5;
    font-size: 0.9rem;
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

.campo-data {
    text-align: center;
}

.grid-2,
.grid-3 {
    display: grid;
    grid-gap: 12px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.align-bottom {
    display: flex;
    align-items: flex-end;
}

.actions-right {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

button {
    border: none;
    border-radius: 20px;
    padding: 7px 14px;
    font-size: 0.9rem;
    cursor: pointer;
    background: #e0e3ea;
    color: #222;
    transition: background 0.15s ease, transform 0.1s ease;
}

button.primary {
    background: #2563eb;
    color: #fff;
}

button.secondary {
    background: #e5e7eb;
}

button.danger {
    background: #ef4444;
    color: #fff;
}

button:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
}

button:active {
    transform: translateY(0);
    filter: brightness(0.97);
}

.help-text {
    font-size: 0.8rem;
    color: #666;
    margin-top: 4px;
}

/* TORRES, TIPOS */

.obra-select-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.obra-select-row label {
    font-size: 0.9rem;
}

.obra-select-row select {
    min-width: 220px;
}

.torres-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.torre-card {
    background: #f9fafb;
    border-radius: 8px;
    padding: 8px;
    border: 1px solid #e5e7eb;
    flex: 1 1 180px;
}

.torre-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.torre-card-header h3 {
    font-size: 0.95rem;
}

.torre-card-header small {
    font-size: 0.75rem;
    color: #555;
}

.torre-card-body {
    font-size: 0.8rem;
    color: #555;
}

.tipos-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tipo-card {
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    padding: 8px;
    background: #f9fafb;
}

.tipo-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tipo-card-header h3 {
    font-size: 0.95rem;
}

.tipo-card-header span {
    font-size: 0.8rem;
    color: #555;
}

.tipo-atividades {
    margin-top: 6px;
    font-size: 0.8rem;
}

.tipo-atividades ul {
    list-style: disc;
    padding-left: 18px;
}

.tipo-add-atividade-row {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.tipo-add-atividade-row input {
    flex: 1;
}

/* TABELAS */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-top: 8px;
}

.data-table th,
.data-table td {
    border: 1px solid #e5e7eb;
    padding: 6px 8px;
    text-align: left;
    vertical-align: middle;
}

.data-table thead {
    background: #f3f4f6;
}

.data-table th {
    font-weight: 600;
}

.data-table input[type="text"],
.data-table input[type="number"] {
    font-size: 0.8rem;
    padding: 4px 6px;
}

/* CRONOGRAMA */

.cronograma-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.cronograma-torre {
    flex: 1 1 260px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    padding: 8px;
}

.cronograma-torre h3 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.cronograma-prumada {
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    padding: 6px;
    background: #ffffff;
    margin-top: 6px;
    font-size: 0.8rem;
}

.cronograma-prumada-header {
    display: flex;
    justify-content: space-between;
}

.cronograma-atividades {
    margin-top: 4px;
    padding-left: 10px;
}

/* Impressão simples */

@media print {
    body {
        background: #ffffff;
    }
    .app-header,
    #btn-imprimir-cronograma,
    #btn-atualizar-cronograma,
    .actions-right,
    button,
    #js-warning {
        display: none !important;
    }
    .card {
        box-shadow: none;
        border: none;
        margin: 0 0 8mm 0;
        page-break-inside: avoid;
    }
    .cronograma-container {
        display: block;
    }
    .cronograma-torre {
        page-break-inside: avoid;
    }
}

/* Mobile */

@media (max-width: 600px) {
    .app-container {
        padding: 8px;
    }
    .app-header h1 {
        font-size: 1.3rem;
    }
}
