* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 30px 0;
    background: white;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

header p {
    color: #64748b;
    font-size: 1.1rem;
}

/* TABS */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: white;
    padding: 10px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.tab-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: var(--bg-color);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* SELECT PRODUTO */
.select-produto {
    background: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.select-produto label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.select-produto select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.select-produto select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* PRODUTO INFO */
.produto-info {
    background: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.produto-info h2 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 10px;
}

.produto-info p {
    color: #64748b;
    margin-bottom: 15px;
}

.preco-venda {
    background: var(--bg-color);
    padding: 15px;
    border-radius: 8px;
    font-size: 1.2rem;
}

.preco-venda span {
    color: var(--success-color);
    font-size: 1.5rem;
}

/* CONFIG SECTION */
.config-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.config-section h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

/* ADD ITEM FORM */
.add-item-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.add-item-form select,
.add-item-form input {
    flex: 1;
    min-width: 200px;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
}

.add-item-form select:focus,
.add-item-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* BUTTONS */
.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: #ff0000;
    color: white;
}

.btn-secondary:hover {
    background: #0e0909;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    padding: 6px 12px;
    font-size: 0.9rem;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-edit {
    background: var(--warning-color);
    color: white;
    padding: 6px 12px;
    font-size: 0.9rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-right: 5px;
}

.btn-edit:hover {
    background: #d97706;
}

/* TABLE */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.table thead {
    background: var(--bg-color);
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    font-weight: 600;
    color: var(--primary-color);
}

.table tbody tr:hover {
    background: var(--bg-color);
}

.table tfoot {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.table tfoot td {
    border: none;
}

.text-center {
    text-align: center;
}

/* RESUMO CUSTOS */
.resumo-custos {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.resumo-custos h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.resumo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.resumo-item {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.resumo-item.highlight {
    background: var(--primary-color);
    color: white;
    font-size: 1.2rem;
}

.resumo-item.positive {
    background: var(--success-color);
    color: white;
}

.resumo-item.negative {
    background: var(--danger-color);
    color: white;
}

/* SECTION HEADER */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.section-header h2 {
    color: var(--primary-color);
}

/* MODAL */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    color: var(--primary-color);
}

.modal-close {
    font-size: 2rem;
    cursor: pointer;
    color: #ffffff;
    line-height: 1;
}

.modal-close:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group small {
    display: block;
    color: #64748b;
    margin-top: 5px;
    font-size: 0.9rem;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 30px;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .add-item-form {
        flex-direction: column;
    }
    
    .add-item-form select,
    .add-item-form input {
        width: 100%;
    }
    
    .resumo-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .section-header button {
        width: 100%;
    }
}

/* VERSÃO 480px FULL WIDTH */
@media (max-width: 480px) {
    body {
        padding: 0;
    }
    
    .container {
        max-width: 100%;
        padding: 10px;
    }
    
    header {
        border-radius: 0;
        margin-bottom: 15px;
        padding: 20px 10px;
    }
    
    header h1 {
        font-size: 1.5rem;
        margin-bottom: 5px;
    }
    
    header p {
        font-size: 0.95rem;
    }
    
    .tabs {
        border-radius: 0;
        padding: 8px;
        gap: 5px;
        flex-wrap: wrap;
    }
    
    .tab-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
        flex: 1 1 auto;
        min-width: calc(33.33% - 5px);
    }
    
    .select-produto,
    .produto-info,
    .config-section,
    .resumo-custos,
    .section-header {
        border-radius: 0;
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .select-produto label {
        font-size: 1rem;
    }
    
    .produto-info h2 {
        font-size: 1.5rem;
    }
    
    .config-section h3,
    .resumo-custos h3 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }
    
    .add-item-form {
        gap: 8px;
    }
    
    .add-item-form select,
    .add-item-form input {
        min-width: 100%;
        padding: 12px;
        font-size: 1rem;
    }
    
    .btn-primary,
    .btn-secondary,
    .btn-danger {
        padding: 12px 16px;
        font-size: 1rem;
        width: 100%;
    }
    
    .table {
        font-size: 0.85rem;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table th,
    .table td {
        padding: 8px 6px;
        white-space: nowrap;
    }
    
    .resumo-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .resumo-item {
        padding: 15px;
        font-size: 0.95rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .resumo-item strong {
        font-size: 1.1rem;
    }
    
    .resumo-item.highlight {
        font-size: 1.1rem;
    }
    
    .section-header h2 {
        font-size: 1.3rem;
    }
    
    .section-header button {
        font-size: 0.95rem;
        padding: 12px;
    }
    
    /* Modal ajustes */
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        max-width: 100%;
        border-radius: 0;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-header h3 {
        font-size: 1.2rem;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 12px;
        font-size: 1rem;
    }
    
    .modal-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-actions button {
        width: 100%;
        padding: 12px;
    }
    
    /* Botões de ação nas tabelas */
    .btn-edit,
    .btn-danger {
        padding: 8px 10px;
        font-size: 0.85rem;
        margin: 2px;
        display: inline-block;
    }
    
    /* Ajustes de touch targets */
    button {
        min-height: 44px;
        min-width: 44px;
    }
    
    select,
    input[type="text"],
    input[type="number"],
    textarea {
        font-size: 16px !important; /* Previne zoom em iOS */
    }
}
