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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

/* Estilos del Header */
header {
    background-color: #2c3e50;
    color: #fff;
    padding: 1rem 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 1.5rem;
    margin: 0;
}

.main-nav ul {
    display: flex;
    list-style: none;
}

.main-nav li {
    margin-left: 1.5rem;
}

.main-nav a {
    color: #fff;
    text-decoration: none;
    font-weight: 500;
}

.main-nav a:hover {
    color: #3498db;
}

.user-info {
    display: flex;
    align-items: center;
}

.user-info span {
    margin-right: 10px;
}

/* Estilos del Footer */
footer {
    background-color: #2c3e50;
    color: #fff;
    padding: 1rem 0;
    text-align: center;
    margin-top: 2rem;
}

/* Estilos de Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f5f5f5;
}

.login-form {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    width: 400px;
    max-width: 100%;
}

.login-form h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

/* Estilos de Formularios */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.radio-group {
    display: flex;
    gap: 1rem;
}

.form-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
}

/* Botones */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

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

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

.btn-secondary {
    background-color: #95a5a6;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

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

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

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    margin: 0 0.25rem;
}

/* Dashboard */
.dashboard-container {
    margin: 2rem auto;
    max-width: 1100px;
    padding: 0 1rem;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background-color: #fff;
    border-radius: 5px;
    padding: 1.5rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

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

.balance-card.positive {
    border-left: 5px solid #2ecc71;
}

.balance-card.negative {
    border-left: 5px solid #e74c3c;
}

.income-card {
    border-left: 5px solid #2ecc71;
}

.expense-card {
    border-left: 5px solid #e74c3c;
}

.balance-amount,
.income-amount,
.expense-amount {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

.income-amount {
    color: #2ecc71;
}

.expense-amount {
    color: #e74c3c;
}

/* Alertas */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.alert-success {
    background-color: #d5f5e3;
    color: #2ecc71;
    border: 1px solid #2ecc71;
}

.alert-error {
    background-color: #fadbd8;
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

.error-message {
    color: #e74c3c;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background-color: #fadbd8;
    border-radius: 4px;
}

/* Secciones */
.dashboard-section {
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h2 {
    margin: 0;
}

/* Lista de transacciones */
.transactions-list {
    background-color: #fff;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.transaction-item {
    display: grid;
    grid-template-columns: 0.8fr 1fr 2fr 1fr 0.5fr;
    padding: 1rem;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-item.income {
    border-left: 4px solid #2ecc71;
}

.transaction-item.expense {
    border-left: 4px solid #e74c3c;
}

.transaction-date {
    font-weight: 500;
}

.transaction-category {
    color: #7f8c8d;
}

.transaction-amount {
    font-weight: 700;
    text-align: right;
}

.transaction-item.income .transaction-amount {
    color: #2ecc71;
}

.transaction-item.expense .transaction-amount {
    color: #e74c3c;
}

.transaction-actions {
    display: flex;
    justify-content: flex-end;
}

.action-buttons {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}

/* Formulario de transacciones */
.form-container {
    max-width: 700px;
    margin: 2rem auto;
    background-color: #fff;
    padding: 2rem;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.form-container h1 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

/* Estilos para estadísticas */
.stats-container {
    max-width: 1100px;
    margin: 2rem auto;
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background-color: #fff;
    border-radius: 5px;
    padding: 1.5rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.chart-card h3 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background-color: #f5f5f5;
    font-weight: 600;
}

.period-selector {
    margin-bottom: 1.5rem;
}

.period-form {
    max-width: 300px;
}

/* Filtros */
.filters {
    margin-bottom: 1.5rem;
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 5px;
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: end;
}

.filter-group {
    margin-bottom: 0.5rem;
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
}

/* Mensajes */
.no-data {
    padding: 2rem;
    text-align: center;
    color: #7f8c8d;
}

/* Estilos para préstamos */
.loan-header {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr 1fr 1fr 0.5fr;
    background-color: #f5f5f5;
    font-weight: 600;
    padding: 1rem;
    border-bottom: 2px solid #e0e0e0;
}

.loan-item {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr 1fr 1fr 0.5fr;
    padding: 1rem;
    border-bottom: 1px solid #eee;
    align-items: center;
}

.loan-col {
    padding: 0 0.5rem;
}

.loan-actions {
    display: flex;
    justify-content: flex-end;
}

.loan-status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-pending {
    background-color: #f39c12;
    color: #fff;
}

.status-paid {
    background-color: #2ecc71;
    color: #fff;
}

.status-overdue {
    background-color: #e74c3c;
    color: #fff;
}

/* Calculadora de préstamos */
.loan-calculator {
    background-color: #f5f5f5;
    padding: 1rem;
    border-radius: 5px;
    margin: 1.5rem 0;
}

.loan-calculator h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.loan-summary {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background-color: #fff;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
}

.summary-row:last-child {
    border-bottom: none;
}

.total-row {
    font-weight: 700;
    background-color: #f9f9f9;
}

/* Estilos para gestión de usuarios */
.users-container {
    max-width: 800px;
    margin: 2rem auto;
}

.register-form {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.users-list {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, 
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background-color: #f5f5f5;
    font-weight: 600;
}

/* Tarjetas para préstamos */
.loan-card {
    border-left: 5px solid #3498db;
}

.pending-card {
    border-left: 5px solid #f39c12;
}

/* Responsive para préstamos */
@media (max-width: 992px) {
    .loan-header {
        display: none;
    }
    
    .loan-item {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 0.5rem;
        position: relative;
    }
    
    .loan-col {
        display: flex;
        justify-content: space-between;
    }
    
    .loan-col::before {
        content: attr(data-label);
        font-weight: 600;
    }
    
    .loan-actions {
        justify-content: flex-start;
        position: absolute;
        top: 1rem;
        right: 1rem;
    }
}

/* Estilos para metas */
.goals-container, .shared-goals-container {
    margin: 2rem auto;
    max-width: 1100px;
}

.goals-grid, .shared-goals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.goal-card, .shared-goal-card {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.goal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.goal-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.goal-category {
    font-size: 0.85rem;
    padding: 0.2rem 0.5rem;
    background-color: #f5f5f5;
    border-radius: 3px;
}

.goal-progress-container {
    margin-bottom: 1rem;
}

.goal-progress-bar {
    height: 10px;
    background-color: #eee;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.goal-progress-fill {
    height: 100%;
    background-color: #3498db;
    border-radius: 5px;
    transition: width 0.3s ease;
}

.status-completed .goal-progress-fill {
    background-color: #2ecc71;
}

.status-canceled .goal-progress-fill {
    background-color: #95a5a6;
}

.goal-progress-text {
    font-size: 0.85rem;
    color: #7f8c8d;
    text-align: right;
}

.goal-details {
    margin-bottom: 1rem;
}

.goal-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f5f5f5;
}

.goal-detail-row:last-child {
    border-bottom: none;
}

.goal-target, .goal-current {
    font-weight: 600;
}

.goal-remaining {
    color: #e74c3c;
    font-weight: 600;
}

.goal-description {
    margin-bottom: 1rem;
    padding: 0.5rem;
    background-color: #f9f9f9;
    border-radius: 3px;
    font-size: 0.9rem;
}

.goal-actions {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.status-completed {
    border-top: 5px solid #2ecc71;
}

.status-canceled {
    border-top: 5px solid #95a5a6;
    opacity: 0.8;
}

.status-progress {
    border-top: 5px solid #3498db;
}

.date-overdue {
    color: #e74c3c;
}

.balance-info {
    margin-bottom: 1.5rem;
    background-color: #f5f5f5;
    padding: 1rem;
    border-radius: 5px;
    text-align: center;
}

.balance-positive {
    color: #2ecc71;
}

.balance-negative {
    color: #e74c3c;
}

/* Estilos para formularios de metas */
.goal-calculator, .goal-summary {
    background-color: #f5f5f5;
    padding: 1rem;
    border-radius: 5px;
    margin: 1.5rem 0;
}

.goal-calculator h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.goal-summary {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background-color: #fff;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
}

.summary-row:last-child {
    border-bottom: none;
}

/* Estilos para unirse a metas compartidas */
.goal-confirmation {
    background-color: #f9f9f9;
    padding: 1.5rem;
    border-radius: 5px;
    margin-bottom: 1.5rem;
}

.goal-details {
    background-color: #fff;
    border-radius: 5px;
    padding: 1rem;
    margin: 1rem 0 1.5rem;
    border: 1px solid #eee;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f5f5f5;
}

.detail-row.description {
    flex-direction: column;
}

.detail-row.description span:first-child {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.detail-row:last-child {
    border-bottom: none;
}

.form-text {
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    color: #666;
}

/* Estilos para códigos de invitación */
.invite-code-container {
    background-color: #f5f5f5;
    padding: 1.5rem;
    border-radius: 5px;
    margin: 1.5rem 0;
    text-align: center;
}

.invite-code {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 1rem 0;
}

.invite-code code {
    background-color: #fff;
    padding: 0.75rem 1rem;
    border: 1px solid #ddd;
    border-radius: 5px 0 0 5px;
    font-size: 1.1rem;
    font-family: monospace;
    overflow-x: auto;
    max-width: 70%;
}

.btn-copy {
    background-color: #3498db;
    color: #fff;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap;
}

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

/* Estilos para participantes */
.participants-list {
    margin-top: 1.5rem;
}

.participant-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 5px;
    margin-bottom: 0.5rem;
}

.participant-info {
    display: flex;
    align-items: center;
}

.participant-username {
    font-weight: 600;
    margin-right: 0.5rem;
}

.participant-role {
    font-size: 0.85rem;
    background-color: #f5f5f5;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
}

.role-admin {
    background-color: #3498db;
    color: #fff;
}

/* Responsive */
@media (max-width: 768px) {
    .goals-grid, .shared-goals-grid {
        grid-template-columns: 1fr;
    }
    
    .goal-actions {
        flex-direction: column;
    }
    
    .goal-actions .btn {
        width: 100%;
    }
    
    .detail-row {
        flex-direction: column;
    }
    
    .detail-row span:first-child {
        font-weight: 600;
        margin-bottom: 0.25rem;
    }
    
    .invite-code {
        flex-direction: column;
    }
    
    .invite-code code {
        border-radius: 5px;
        margin-bottom: 0.5rem;
        max-width: 100%;
    }
    
    .btn-copy {
        border-radius: 5px;
        width: 100%;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .transaction-item {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto auto;
        gap: 0.5rem;
    }
    
    .transaction-date,
    .transaction-category {
        grid-column: 1;
    }
    
    .transaction-description {
        grid-column: span 2;
    }
    
    .transaction-amount {
        grid-column: 2;
        grid-row: 1;
        text-align: right;
    }
    
    .transaction-actions {
        grid-column: 2;
        grid-row: 2;
    }
    
    .form-buttons {
        flex-direction: column;
        gap: 1rem;
    }
    
    .btn {
        width: 100%;
    }
}

/* Estilos para autenticación y formularios */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f5f5f5;
}

.auth-form {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    width: 400px;
    max-width: 100%;
}

.auth-form h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.auth-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #ddd;
}

.auth-tab {
    flex: 1;
    text-align: center;
    padding: 0.75rem;
    cursor: pointer;
    font-weight: 500;
    color: #95a5a6;
    transition: all 0.3s ease;
}

.auth-tab.active {
    color: #3498db;
    border-bottom: 2px solid #3498db;
}

.auth-tab:hover:not(.active) {
    color: #7f8c8d;
}

.toggle-form {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.toggle-form a {
    color: #3498db;
    text-decoration: none;
}

.toggle-form a:hover {
    text-decoration: underline;
}

.success-message {
    background-color: #d5f5e3;
    color: #2ecc71;
    border: 1px solid #2ecc71;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.form-text {
    display: block;
    margin-top: 0.25rem;
    color: #7f8c8d;
    font-size: 0.85rem;
}

.full-width {
    width: 100%;
}

/* Menú hamburguesa para móviles */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
}

.menu-toggle:focus {
    outline: none;
}

.menu-toggle span {
    display: block;
    width: 30px;
    height: 3px;
    background-color: #ffffff;
    border-radius: 10px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

.main-nav {
    transition: transform 0.3s ease-in-out;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 4;
}

.overlay.show {
    display: block;
}

/* Media queries para el menú móvil */
@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
    }
    
    .menu-toggle {
        display: flex;
        margin-left: auto;
        z-index: 15;
    }
    
    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        width: 80%;
        max-width: 300px;
        background-color: #2c3e50;
        flex-direction: column;
        padding: 80px 20px 30px;
        transition: right 0.3s ease-in-out;
        z-index: 5;
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
    }
    
    .main-nav.show {
        right: 0;
    }
    
    .main-nav ul {
        flex-direction: column;
        width: 100%;
    }
    
    .main-nav li {
        width: 100%;
        margin: 0;
        padding: 0;
    }
    
    .main-nav a {
        width: 100%;
        padding: 15px;
        text-align: left;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .user-info {
        margin-top: 1rem;
        width: 100%;
    }
    
    .auth-form {
        padding: 1.5rem;
        width: 100%;
        margin: 0 1rem;
    }
}

/* Estilos para la gestión de usuarios */
.admin-container {
    max-width: 1100px;
    margin: 2rem auto;
}

.users-list-admin {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th, 
.admin-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.admin-table th {
    background-color: #f5f5f5;
    font-weight: 600;
}

.admin-row {
    background-color: #f8f9fa;
}

.inline-form {
    display: inline-block;
    margin-right: 0.5rem;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
    border-radius: 3px;
    border: none;
    cursor: pointer;
    color: #fff;
}

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

.btn-warning {
    background-color: #f39c12;
}

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

.role-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 500;
}

.role-admin {
    background-color: #3498db;
    color: #fff;
}

.role-user {
    background-color: #95a5a6;
    color: #fff;
}

.badge {
    display: inline-block;
    background-color: #3498db;
    color: #fff;
    font-size: 0.7rem;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    margin-left: 0.3rem;
}

.text-muted {
    color: #7f8c8d;
    font-style: italic;
}

.action-buttons {
    white-space: nowrap;
}

.table-responsive {
    overflow-x: auto;
}

@media (max-width: 768px) {
    .btn-sm {
        display: block;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .inline-form {
        display: block;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
}

.info-message {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    text-align: center;
}