/* Add this at the top of your CSS file */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

h1, h2, h3 {
    color: #2c3e50;
    margin-top: 0;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #3498db;
    padding-bottom: 10px;
    border-bottom: 2px solid #ecf0f1;
}

.container {
    max-width: 800px;
    margin: auto;
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.1);
}

.section {
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    background-color: #f8f9fa;
}

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

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

input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    transition: border-color 0.3s;
    font-size: 16px;
    box-sizing: border-box; /* Add this line */
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

button {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-success {
    background-color: #2ecc71;
    color: white;
}

.btn-success:hover {
    background-color: #27ae60;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 14px;
    width: auto;
}

.expense-list {
    list-style-type: none;
    padding: 0;
}

.expense-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.expense-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.expense-item small {
    display: block;
    color: #7f8c8d;
    font-size: 0.85em;
    margin-top: 5px;
}

.expense-info {
    flex-grow: 1;
}

.expense-amount {
    font-weight: bold;
    color: #2c3e50;
}

.button-group {
    display: flex;
    gap: 8px;
}

.summary {
    background-color: #2c3e50;
    color: #fff;
    padding: 15px;
    border-radius: 8px;
    margin-top: 10px;
}

.summary h2 {
    color: #ecf0f1;
    border-bottom: 1px solid #34495e;
    padding-bottom: 8px;
    margin-top: 0;
    margin-bottom: 10px;
}

.summary h3 {
    margin-top: 12px;
    margin-bottom: 8px;
}

#total-display {
    margin: 10px 0;
}

.summary p {
    font-size: 18px;
    margin: 15px 0;
}

.adjustment-item {
    padding: 8px;
    margin: 4px 0;
    border-radius: 5px;
    background-color: #34495e;
}

.adjustment-positive {
    border-left: 4px solid #2ecc71;
}

.adjustment-negative {
    border-left: 4px solid #e74c3c;
}

.adjustment-neutral {
    border-left: 4px solid #f1c40f;
}

#participants-section {
    margin: 15px 0;
    padding: 15px;
    background-color: #ecf0f1;
    border-radius: 5px;
}

.help-text {
    color: #7f8c8d;
    font-size: 0.9em;
    margin-top: 5px;
    margin-bottom: 15px;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.checkbox-group label {
    margin-right: 15px;
    display: flex;
    align-items: center;
    padding: 5px 10px;
    background-color: #fff;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.checkbox-group label:hover {
    background-color: #e0e7ff;
}

.checkbox-group input[type="checkbox"] {
    margin-right: 5px;
}

#people-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

#people-list div {
    background: #3498db;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 14px;
}

.steps-guide-container {
    margin-bottom: 20px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border-left: 4px solid #00acc1;
    overflow: hidden;
}

.steps-guide-header {
    padding: 10px 15px;
    cursor: pointer;
    background-color: #e0f7fa;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
}

.steps-guide-header:hover {
    background-color: #b3e5fc;
}

.steps-guide-header h3 {
    margin: 0;
    display: flex;
    justify-content: space-between;
    width: 100%;
    color: #0288d1;
}

.toggle-icon {
    font-weight: bold;
    font-size: 18px;
    color: #0288d1;
}

.steps-guide {
    padding: 0 15px 15px 15px;
    margin: 0;
    border-top: 1px solid #b3e5fc;
}

.steps-guide ol {
    margin-top: 10px;
    margin-bottom: 5px;
    padding-left: 25px;
}

.steps-guide li {
    margin-bottom: 5px;
}

.no-participants-message {
    text-align: center;
    padding: 15px;
    color: #7f8c8d;
    font-style: italic;
}

.tab-container {
    margin-bottom: 20px;
}

.tab-buttons {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid #ddd;
}

.tab-button {
    padding: 10px 20px;
    background-color: #f8f9fa;
    border: none;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    margin-right: 5px;
    font-weight: bold;
    width: auto;
}

.tab-button.active {
    background-color: #3498db;
    color: white;
}

/* Estilo para botão de aba desabilitado */
.tab-button[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.tab-button[disabled]:hover {
    background-color: #f8f9fa;
}

.tab-content {
    padding: 20px;
    background-color: #fff;
    border-radius: 0 0 5px 5px;
}

.tab-pane {
    display: none;
}

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

/* Add these rules to the end of your existing style.css file */

.expense-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.expense-description {
    font-weight: bold;
    font-size: 1.1em;
    color: #2c3e50;
}

.expense-payer {
    display: block;
    color: #7f8c8d;
    font-size: 0.85em;
    margin-bottom: 3px;
}

/* Optional: add a highlight for the payer's name */
.expense-payer {
    color: #3498db;
    font-weight: 500;
}

/* Add these rules to the end of your existing style.css file */

.transactions-header {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #34495e;
    color: #ecf0f1;
}

.transactions-section {
    margin-top: 10px;
}

.transaction-item {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    margin: 5px 0;
    background-color: #34495e;
    border-radius: 5px;
    border-left: 4px solid #3498db;
}

.transaction-debtor {
    font-weight: bold;
    color: #e74c3c;
}

.transaction-arrow {
    margin: 0 10px;
    font-size: 20px;
    color: #7f8c8d;
}

.transaction-creditor {
    font-weight: bold;
    color: #2ecc71;
}

.transaction-amount {
    margin-left: auto;
    font-weight: bold;
}

.adjustments-section {
    margin-bottom: 15px;
}

/* Estilos para a seção de gerenciamento de pessoas */
.manage-people-list {
    margin-top: 20px;
}

#manage-people-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

#manage-people-list div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #3498db;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    min-width: 150px;
}

#manage-people-list button {
    background: none;
    border: none;
    color: white;
    margin-left: 10px;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    width: auto;
}

#manage-people-list button:hover {
    color: #e74c3c;
}

/* Estilo para mensagem "Adicione pessoas primeiro" */
.select-message {
    color: #7f8c8d;
    font-style: italic;
}

/* Estilos para a seção de distribuição de despesas */
.distribution-section {
    margin-bottom: 20px;
}

.person-expense-item {
    background-color: #34495e;
    padding: 12px 15px;
    margin: 8px 0;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.person-name {
    font-weight: bold;
    font-size: 1.1em;
    color: #ecf0f1;
    flex-basis: 30%;
}

.person-details {
    flex-basis: 65%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

.paid-amount {
    color: #2ecc71;
    font-weight: bold;
    margin-right: 15px;
}

.owed-amount {
    color: #e74c3c;
    font-weight: bold;
    margin-right: 15px;
}

.participation-percentage {
    color: #7f8c8d;
    font-style: italic;
}

@media (max-width: 600px) {
    .person-expense-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .person-name {
        margin-bottom: 8px;
    }
    
    .person-details {
        flex-direction: column;
    }
    
    .paid-amount, .owed-amount {
        margin-bottom: 5px;
    }
}

/* Estilos para a tabela de resumo de despesas */
.expenses-summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
    color: #ecf0f1;
    background-color: #34495e;
    border-radius: 5px;
    overflow: hidden;
    table-layout: fixed; /* Fixa o layout da tabela para melhor controle */
}

.expenses-summary-table th, 
.expenses-summary-table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #2c3e50;
}

.expenses-summary-table th {
    background-color: #2c3e50;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9em;
}

.expenses-summary-table tr:last-child td {
    border-bottom: none;
}

/* Ajusta o alinhamento de textos e larguras das colunas */
.expenses-summary-table .person-name {
    width: 30%;
    text-align: left;
}

.expenses-summary-table .amount {
    width: 17.5%;
    text-align: right;
    font-weight: bold;
}

.expenses-summary-table .percentage {
    width: 17.5%;
    text-align: center;
    font-style: italic;
    color: #bdc3c7;
}

.expenses-summary-table th.amount,
.expenses-summary-table th.percentage {
    text-align: center; /* Centraliza o texto dos cabeçalhos */
}

.expenses-summary-table .paid-amount {
    color: #2ecc71;
}

.expenses-summary-table .owed-amount {
    color: #e74c3c;
}

.expenses-summary-table .balance-amount {
    font-weight: bold;
}

/* Estilo para linhas baseadas no balanço */
.expenses-summary-table .balance-positive .balance-amount {
    color: #2ecc71;
}

.expenses-summary-table .balance-negative .balance-amount {
    color: #e74c3c;
}

.expenses-summary-table .balance-neutral .balance-amount {
    color: #f1c40f;
}

/* Estilo para a legenda explicativa */
.summary-legend {
    background-color: #2c3e50;
    padding: 10px;
    margin-top: 10px;
    border-radius: 5px;
    font-size: 0.9em;
}

.summary-legend p {
    margin-top: 0;
    margin-bottom: 5px;
}

.summary-legend ul {
    padding-left: 20px;
    margin-top: 5px;
    margin-bottom: 0;
}

.summary-legend li {
    margin-bottom: 5px;
}

/* Estilos para o ícone de ajuda e conteúdo */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-header h3 {
    margin: 0;
}

.help-icon {
    width: 20px;
    height: 20px;
    background-color: #3498db;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.help-icon:hover {
    background-color: #2980b9;
}

.help-content {
    background-color: #2c3e50;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 15px;
    position: relative;
    border-left: 4px solid #3498db;
}

.help-content p {
    margin-top: 0;
    margin-bottom: 10px;
}

.help-content ul {
    padding-left: 20px;
    margin-bottom: 10px;
}

.help-content li {
    margin-bottom: 5px;
}

.close-help {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 10px;
    width: auto;
}

.close-help:hover {
    background-color: #2980b9;
}

/* ============================================
   RESPONSIVE DESIGN FOR MOBILE DEVICES
   ============================================ */

/* Tablet and below (768px) */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }
    
    .container {
        padding: 20px;
    }
    
    h1 {
        font-size: 1.75em;
    }
    
    /* Tab buttons scrolling for mobile/tablet */
    .tab-buttons {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }
    
    .tab-button {
        white-space: nowrap;
        flex-shrink: 0;
        min-width: auto;
    }
    
    /* Scrollbar styling for tab buttons */
    .tab-buttons::-webkit-scrollbar {
        height: 4px;
    }
    
    .tab-buttons::-webkit-scrollbar-track {
        background: #f1f1f1;
    }
    
    .tab-buttons::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 2px;
    }
    
    .tab-buttons::-webkit-scrollbar-thumb:hover {
        background: #555;
    }
}

/* Mobile devices (480px and below) */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px;
        border-radius: 5px;
    }
    
    h1 {
        font-size: 1.5em;
        margin-bottom: 15px;
    }
    
    .section {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    /* Improve touch targets on mobile */
    button {
        min-height: 44px;
        padding: 12px 10px;
    }
    
    /* Tab buttons - make scrollable horizontally */
    .tab-button {
        padding: 10px 15px;
        font-size: 0.9em;
    }
    
    /* Expense items - stack vertically on mobile */
    .expense-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px;
    }
    
    .expense-info {
        width: 100%;
    }
    
    .expense-item .button-group {
        width: 100%;
        margin-top: 10px;
        flex-direction: column;
        gap: 5px;
        min-width: auto;
    }
    
    .expense-item .button-group button {
        width: 100%;
    }
    
    /* People management */
    #manage-people-list div {
        min-width: 120px;
        font-size: 13px;
        padding: 6px 12px;
    }
    
    /* Transaction items */
    .transaction-item {
        font-size: 0.9em;
        padding: 10px;
    }
    
    /* Steps guide */
    .steps-guide-container {
        margin-bottom: 15px;
    }
    
    .steps-guide ol {
        padding-left: 20px;
        font-size: 0.9em;
    }
    
    .steps-guide li {
        margin-bottom: 8px;
    }
}



/* Table responsiveness */
.distribution-section {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 600px) {
    .expenses-summary-table {
        font-size: 0.85em;
        table-layout: auto;
        min-width: 500px;
    }
    
    .expenses-summary-table th,
    .expenses-summary-table td {
        padding: 6px 4px;
        white-space: nowrap;
    }
}

/* Transaction items - ensure they wrap properly */
.transaction-item {
    flex-wrap: wrap;
}