/**
 * Estilos de la Aplicación de Gestión de Deudas
 * Mobile-First Design
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f7;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== LOGIN SCREEN ===== */
.login-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: linear-gradient(165deg, #1a1a1a 0%, #2d2d2d 100%);
}

.login-box {
    width: 100%;
    max-width: 380px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    padding: 40px 30px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-logo {
    width: 60px;
    height: 60px;
    background: #ff6b35;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 24px;
}

.login-title {
    color: white;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 32px;
}

.error-message {
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    color: #ff3b30;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center;
}

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

.input-group label {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: 500;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: white;
    font-size: 15px;
    transition: all 0.3s;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.12);
    border-color: #ff6b35;
}

.input-group input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Estilos para modales (fondo claro) */
.modal-content .input-group input,
.modal-content .input-group select {
    background: #f5f5f7;
    border: 1px solid #e8e8ea;
    color: #1a1a1a;
}

.modal-content .input-group input::placeholder {
    color: #999;
}

.modal-content .input-group input:focus,
.modal-content .input-group select:focus {
    background: #fff;
    border-color: #ff6b35;
}

.modal-content .input-group label {
    color: #1a1a1a;
}

.btn-primary {
    width: 100%;
    padding: 16px;
    background: #ff6b35;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    margin-top: 12px;
}

.login-hint {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    margin-top: 16px;
}

/* ===== APP CONTAINER ===== */
.app-container {
    min-height: 100vh;
    background: #f5f5f7;
    padding-bottom: 80px;
}

/* ===== HEADER ===== */
.app-header {
    background: linear-gradient(165deg, #1a1a1a 0%, #2d2d2d 100%);
    padding: 60px 20px 40px;
    position: relative;
}

.profile-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.greeting {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.username {
    color: white;
    font-size: 20px;
    font-weight: 600;
    margin-top: 4px;
}

.profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 107, 53, 0.2);
    border: 2px solid #ff6b35;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ff6b35;
    font-weight: 600;
    font-size: 18px;
}

.balance-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 20px;
}

.balance-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.balance-amount {
    color: white;
    font-size: 40px;
    font-weight: 700;
    letter-spacing: -1px;
}

.action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.action-btn {
    flex: 1;
    padding: 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.action-btn:active {
    transform: scale(0.96);
}

/* ===== CONTENT SECTION ===== */
.content-section {
    padding: 20px;
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 16px;
}

.debt-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.debt-item {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.debt-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.debt-name {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
}

.debt-amount {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
}

.debt-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.debt-btn {
    flex: 1;
    padding: 10px;
    background: #f5f5f7;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    cursor: pointer;
    transition: all 0.2s;
}

.debt-btn:active {
    background: #e8e8ea;
}

.history-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
    display: none;
}

.history-section.active {
    display: block;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 10px;
    background: #f8f8f8;
}

.history-item.payment {
    background: #e8f5e9;
}

.history-item.expense {
    background: #ffebee;
}

.history-type {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.history-amount {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
}

.history-item.payment .history-amount {
    color: #2e7d32;
}

.history-item.expense .history-amount {
    color: #c62828;
}

.history-item-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-item-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.attachment-btn {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.attachment-btn:active {
    transform: scale(0.95);
    background: rgba(0, 0, 0, 0.1);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* ===== FILE INPUT ===== */
.file-input-wrapper {
    margin-top: 12px;
}

.file-input-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    background: #f5f5f7;
    border: 2px dashed #e8e8ea;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    color: #666;
}

.file-input-label:hover {
    border-color: #ff6b35;
    background: #fff;
}

.file-input-label.has-file {
    background: #e8f5e9;
    border-color: #2e7d32;
    color: #2e7d32;
}

#paymentAttachment {
    display: none;
}

/* ===== FOOTER ===== */
.footer-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 16px 20px;
    border-top: 1px solid #e8e8ea;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.footer-text {
    font-size: 12px;
    color: #999;
}

.btn-logout {
    padding: 10px 20px;
    background: #1a1a1a;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: flex-end;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 24px 24px 0 0;
    width: 100%;
    max-width: 500px;
    padding: 24px 20px 40px;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.modal-header {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 24px;
}

/* ===== ATTACHMENT MODAL ===== */
.attachment-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.attachment-modal.active {
    display: flex;
}

.attachment-modal-content {
    max-width: 90%;
    max-height: 90%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.attachment-modal img {
    width: 100%;
    height: auto;
    display: block;
}

.close-attachment {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== RESPONSIVE ===== */
@media (min-width: 768px) {
    .app-container {
        max-width: 500px;
        margin: 0 auto;
    }

    .modal-content {
        border-radius: 24px;
        max-height: 80vh;
        overflow-y: auto;
    }
}