/* styles.css */
:root {
    --primary-color: #4a90e2;
    --secondary-color: #50e3c2;
    --dark-color: #333;
    --light-color: #f4f4f4;
    --danger-color: #d0021b;
    --border-radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: var(--light-color);
    color: var(--dark-color);
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Telas */
.screen {
    display: none;
}
.screen.active {
    display: block;
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Cabeçalho */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
header h1 {
    margin: 0;
    font-size: 1.5rem;
}
header button {
    background: none;
    border: 1px solid white;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
}

/* Formulários */
form {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-top: 1rem;
}
form h2 {
    text-align: center;
    margin-top: 0;
}
input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="number"] {
    width: 100%;
    padding: 0.8rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    box-sizing: border-box;
}
.file-upload {
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px dashed #ccc;
    border-radius: var(--border-radius);
}
.preview-img {
    max-width: 150px;
    margin-top: 10px;
    border-radius: var(--border-radius);
}

/* Botões */
button {
    cursor: pointer;
    padding: 0.8rem 1.5rem;
    border-radius: var(--border-radius);
    border: none;
    font-size: 1rem;
    transition: background-color 0.3s;
}
button[type="submit"], .btn-primary {
    background-color: var(--primary-color);
    color: white;
    width: 100%;
}
button[type="submit"]:hover, .btn-primary:hover {
    background-color: #357abd;
}
.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}
.btn-secondary:hover {
    background-color: #45b8a0;
}
main button {
    display: block;
    width: 100%;
    margin-bottom: 1rem;
}
a {
    color: var(--primary-color);
    text-decoration: none;
}
p { text-align: center; }

/* Produtos */
.product-entry {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f9f9f9;
    border-radius: var(--border-radius);
}
.product-entry input { margin-bottom: 0;  width: 200px; }
.remove-product-btn {
    background-color: var(--danger-color);
    color: white;
    padding: 0.5rem;
width: 100px;
    flex-shrink: 0;
}
#add-product-btn {
    width: auto;
    background-color: #6c757d;
}

/* Tabela de Relatórios */
.table-container {
    overflow-x: auto;
    background: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
#reports-table {
    width: 100%;
    border-collapse: collapse;
}
#reports-table th, #reports-table td {
    padding: 0.8rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}
#reports-table th {
    background-color: #f8f8f8;
}
#reports-table .edit-btn { background-color: #ffc107; color: #333;}
#reports-table .delete-btn { background-color: var(--danger-color); color: white; }
#reports-table td button { margin-right: 5px; }

/* Filtros */
#report-filters {
    margin-bottom: 1rem;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
#report-filters input, #report-filters button {
    flex-grow: 1;
}

/* Loader */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: white;
}
.loader {
    border: 8px solid #f3f3f3;
    border-top: 8px solid var(--primary-color);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsividade */
@media (max-width: 600px) {
    .container {
        padding: 0 1rem;
    }
    header {
        flex-direction: column;
        gap: 10px;
    }
    .product-entry {
        flex-direction: column;
        align-items: stretch;
    }
    #reports-table thead {
        display: none;
    }
    #reports-table, #reports-table tbody, #reports-table tr, #reports-table td {
        display: block;
        width: 100%;
    }
    #reports-table tr {
        margin-bottom: 1rem;
        border: 1px solid #ddd;
        border-radius: var(--border-radius);
    }
    #reports-table td {
        text-align: right;
        padding-left: 50%;
        position: relative;
    }
    #reports-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        padding-left: 1rem;
        font-weight: bold;
        text-align: left;
    }
}