/**
 * Inquilino HM - Holding JM
 * Design System & Color Palette
 * Primary: #1E40AF (Dark Blue)
 * Secondary: #1F2937 (Dark Gray)
 * Accent: #DC2626 (Red)
 */

:root {
    --ios-bg: #F8F9FA;
    --ios-card-bg: #FFFFFF;
    --ios-blue: #1E40AF;
    --jm-primary: #1E40AF;
    --jm-secondary: #1F2937;
    --jm-accent: #DC2626;
    --ios-red: #FF3B30;
    --ios-green: #34C759;
    --ios-orange: #FF9500;
    --ios-text: #111827;
    --ios-subtext: #6B7280;
    --ios-border: rgba(0, 0, 0, 0.08);
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--ios-bg);
    color: var(--ios-text);
    /* Espaço extra em baixo para o menu flutuante */
    padding-bottom: calc(100px + var(--safe-bottom)); 
    padding-top: calc(70px + var(--safe-top));
    overscroll-behavior-y: none;
}

a { text-decoration: none; color: inherit; }

/* --- HEADER SUPERIOR (Vidro) --- */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(54px + var(--safe-top));
    background: linear-gradient(135deg, var(--jm-primary) 0%, var(--jm-secondary) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    padding-top: var(--safe-top);
    
    /* Layout Flex para separar Logo e Botão */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 20px;
    padding-right: 20px;
}

/* Área da Logo */
.header-left {
    display: flex;
    align-items: center;
}

.header-logo {
    height: 32px;
    width: auto;
    object-fit: contain;
}

/* Área do Botão Sair */
.header-right {
    display: flex;
    align-items: center;
}

.header-btn {
    background: transparent;
    border: none;
    color: #FFFFFF;
    font-size: 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 0;
    cursor: pointer;
    transition: opacity 0.2s;
}

.header-btn:active {
    opacity: 0.5;
}

.header-btn i {
    font-size: 18px;
}

/* --- TÍTULOS E WRAPPER --- */
.content-wrapper {
    padding: 0 20px;
    max-width: 1200px; /* Expandido para acomodar dashboard desktop */
    margin: 0 auto;
    animation: fadeIn 0.3s ease-out;
}

.large-title-area {
    padding: 20px 20px 10px 20px;
    margin-bottom: 5px;
}
.large-title-area h1 {
    font-size: 34px;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.5px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- MENU FLUTUANTE (Tabbar Pílula) --- */
.tabbar {
    position: fixed;
    bottom: calc(20px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: 94%;
    max-width: 480px;
    height: 70px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: 40px; /* Pílula */
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.4);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    z-index: 1000;
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #98989D; /* Cinza inativo */
    transition: all 0.3s ease;
    height: 56px;
    border-radius: 24px; /* Mais arredondado */
    margin: 0 2px;
    text-decoration: none;
}

.tab-item i {
    font-size: 22px;
    margin-bottom: 3px;
    transition: transform 0.2s;
}

.tab-item span {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: -0.2px;
}

/* --- ESTADO ATIVO (Correção: Azul Muito Sutil) --- */
.tab-item.active {
    color: var(--jm-primary);
    /* Fundo quase invisível, apenas uma nuance */
    background-color: rgba(30, 64, 175, 0.08); 
    font-weight: 600;
}

.tab-item.active i {
    transform: scale(1.05);
}

.tab-item:active {
    transform: scale(0.95);
    opacity: 0.7;
}

/* --- CARDS & WIDGETS --- */
.ios-card {
    background: var(--ios-card-bg);
    border-radius: 14px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03); 
    overflow: hidden;
}

.card-header {
    padding: 15px 20px;
    border-bottom: 0.5px solid var(--ios-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-header h3 { margin: 0; font-size: 17px; font-weight: 600; }

.card-body { padding: 20px; }

/* --- INPUTS E BOTÕES GERAIS --- */
.form-control {
    width: 100%;
    background: #FFFFFF;
    border: 1px solid #D1D1D6;
    padding: 12px;
    border-radius: 10px;
    font-size: 17px;
    margin-bottom: 15px;
}
.form-control:focus {
    outline: none;
    border-color: var(--jm-primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.btn {
    border: none;
    background: var(--jm-primary);
    color: white;
    font-size: 17px;
    font-weight: 600;
    padding: 14px;
    border-radius: 12px;
    width: 100%;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    display: block;
    margin-top: 10px;
}
.btn:active {
    background: #1a3a8a;
    transform: scale(0.98);
}

/* --- LISTAS ESTILO IOS --- */
.ios-list {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 0.5px solid var(--ios-border);
    transition: background 0.2s;
    cursor: pointer;
}
.list-item:last-child { border-bottom: none; }
.list-item:active { background: #F2F2F7; }

.list-icon {
    width: 40px;
    height: 40px;
    background: #F2F2F7;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8E8E93;
    margin-right: 15px;
}
.list-content { flex: 1; }
.list-title { font-size: 15px; font-weight: 600; color: var(--ios-text); }
.list-subtitle { font-size: 12px; color: var(--ios-subtext); margin-top: 2px; }
.list-arrow { color: #C7C7CC; font-size: 14px; }

/* --- BARRA DE BUSCA --- */
.search-bar {
    background: #E3E3E8;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}
.search-bar i { color: var(--ios-subtext); margin-right: 8px; }
.search-input {
    border: none;
    background: transparent;
    width: 100%;
    font-size: 17px;
    color: var(--ios-text);
}
.search-input:focus { outline: none; }

/* --- TELA DE LOGIN (Ajuste Mobile Topo) --- */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Alinhado ao topo */
    min-height: 100vh;
    width: 100%;
    padding: 20px;
    padding-top: 60px; /* Afastamento do topo */
    background-color: var(--ios-bg);
    margin-top: calc(-1 * (70px + var(--safe-top))); /* Anula padding do body */
    padding-bottom: 0;
}

.login-container {
    width: 100%;
    max-width: 360px;
    text-align: center;
    animation: fadeIn 0.4s ease-out;
}

.login-logo-img {
    width: 110px;
    height: auto;
    border-radius: 20px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    margin-bottom: 25px;
}

.login-card-body {
    padding: 30px 25px;
    background: #FFFFFF;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

.login-welcome { margin: 0 0 5px 0; font-size: 22px; font-weight: 700; color: var(--ios-text); }
.login-instruction { margin: 0 0 25px 0; font-size: 15px; color: var(--ios-subtext); }

.btn-primary-ios {
    background-color: var(--jm-primary);
    color: white;
    font-weight: 600;
    font-size: 17px;
    padding: 14px;
    border-radius: 12px;
    border: none;
    width: 100%;
    cursor: pointer;
    margin-top: 10px;
}

.login-copyright { margin-top: 30px; font-size: 12px; color: #C7C7CC; }


/* --- DASHBOARD STYLES (Grid Responsivo) --- */
.dashboard-content {
    padding-bottom: 40px;
}

/* Saudação */
.welcome-section { margin-bottom: 25px; }
.welcome-title { font-size: 28px; font-weight: 700; margin: 0; color: var(--ios-text); }
.welcome-date { font-size: 14px; color: var(--ios-subtext); margin-top: 5px; text-transform: uppercase; letter-spacing: 0.5px; }

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.kpi-card {
    background: #fff;
    border-radius: 18px;
    padding: 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}
.kpi-card:active { transform: scale(0.98); }

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 15px;
}

.kpi-info { display: flex; flex-direction: column; }
.kpi-label { font-size: 13px; color: var(--ios-subtext); margin-bottom: 2px; }
.kpi-value { font-size: 22px; font-weight: 700; color: var(--ios-text); }

/* Cores KPI */
.kpi-card.blue .kpi-icon { background: rgba(30, 64, 175, 0.1); color: var(--jm-primary); }
.kpi-card.purple .kpi-icon { background: rgba(88,86,214,0.1); color: #5856D6; }
.kpi-card.green .kpi-icon { background: rgba(52,199,89,0.1); color: #34C759; }
.kpi-card.red .kpi-icon { background: rgba(220, 38, 38, 0.1); color: var(--jm-accent); }
.kpi-card.red .kpi-value { color: var(--jm-accent); }

/* Ações Rápidas */
.section-title { font-size: 18px; font-weight: 600; margin: 0 0 15px 5px; color: var(--ios-text); }

.actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}
@media (max-width: 600px) {
    .actions-grid { grid-template-columns: repeat(2, 1fr); }
}

.action-btn {
    background: #fff;
    border-radius: 16px;
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    transition: background 0.2s;
}
.action-btn:active { background: #f0f0f0; }

.action-icon {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
    margin-bottom: 10px;
}
.action-btn span { font-size: 13px; font-weight: 500; color: #333; }

@media (max-width: 680px) {
    .content-wrapper {
        padding: 0 12px;
    }
    .large-title-area {
        padding: 12px 12px 6px 12px;
        margin-bottom: 4px;
    }
    .large-title-area h1 {
        font-size: 26px;
    }
    .ios-card { margin-bottom: 12px; }
    .card-header { padding: 12px 14px; }
    .card-body { padding: 14px; }
    .ios-list { margin-bottom: 12px; }
    .list-item { padding: 12px 14px; }
    .section-title { margin: 0 0 10px 2px; }
    .actions-grid { gap: 10px; margin-bottom: 18px; }
    .kpi-grid { gap: 10px; margin-bottom: 20px; }
}

.bg-blue { background: var(--jm-primary); }
.bg-purple { background: #5856D6; }
.bg-green { background: #34C759; }
.bg-orange { background: #FF9500; }

/* --- CONTRATOS PAGE --- */
.contratos-table-container {
    display: grid;
    gap: 16px;
}

.contrato-detail-card {
    background: linear-gradient(135deg, #FFFFFF 0%, #F8FAFB 100%);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(30, 64, 175, 0.08);
    transition: all 0.3s ease;
}

.contrato-detail-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.card-header-section {
    padding: 20px;
    background: linear-gradient(135deg, var(--jm-primary) 0%, #1a3a8a 100%);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.card-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.card-title h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #FFFFFF;
}

.status-label {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(52, 199, 89, 0.2);
    color: #34C759;
}

.status-label.active { 
    background: rgba(52, 199, 89, 0.2);
    color: #34C759;
}

.card-body-section {
    padding: 20px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.info-block {
    padding: 16px;
    background: #FAFBFC;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    transition: all 0.2s ease;
}

.info-block:hover {
    background: #F3F4F6;
    border-color: var(--jm-primary);
}

.info-block.highlight {
    background: linear-gradient(135deg, #EBF8FF 0%, #DBEAFE 100%);
    border: 1px solid #93C5FD;
}

.info-block.full-width {
    grid-column: 1 / -1;
}

.info-block .label {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--ios-subtext);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-block .value {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    color: var(--ios-text);
    word-break: break-word;
}

.card-footer-section {
    padding: 16px 20px;
    border-top: 1px solid rgba(30, 64, 175, 0.08);
    background: #FAFBFC;
}

@media (max-width: 680px) {
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .card-title h2 {
        font-size: 18px;
    }
    
    .card-header-section {
        padding: 16px;
    }
    
    .card-body-section {
        padding: 16px;
    }
    
    .info-block {
        padding: 14px;
    }
}

/* ===== FINANCEIRO PAGE - ANO CARDS ===== */

.page-header-fin {
    margin-bottom: 32px;
}

.page-header-fin h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--ios-text);
    margin: 0 0 8px 0;
}

.page-header-fin .subtitle {
    font-size: 14px;
    color: var(--ios-subtext);
    margin: 0;
}

/* Próximo Aluguel Card */
.proximo-aluguel-card {
    background: linear-gradient(135deg, #16A34A 0%, #15803D 100%);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 32px;
    box-shadow: 0 4px 6px rgba(22, 163, 74, 0.15);
}

.proximo-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.proximo-label {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.proximo-vencimento {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.proximo-valor {
    font-size: 32px;
    font-weight: 700;
    color: white;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.05), rgba(220, 38, 38, 0.05));
    border-radius: 16px;
    border: 1px solid rgba(30, 64, 175, 0.1);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 20px;
    color: var(--ios-text);
    margin: 0 0 8px 0;
}

.empty-state p {
    font-size: 14px;
    color: var(--ios-subtext);
    margin: 0 0 24px 0;
}

.ano-card {
    background: linear-gradient(135deg, #1E40AF 0%, #1E40AF 100%);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 6px rgba(30, 64, 175, 0.1);
}

.ano-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.ano-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: white;
    margin: 0;
}

.total-pagamentos {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.titulos-ano {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.titulo-item {
    background: white;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.titulo-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.titulo-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.titulo-vencimento {
    font-size: 13px;
    color: var(--ios-subtext);
    font-weight: 500;
}

.titulo-valor {
    font-size: 18px;
    font-weight: 700;
    color: var(--jm-primary);
}

.btn-recibo {
    background: linear-gradient(135deg, #1E40AF, #1E3A8A);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-left: 12px;
}

.btn-recibo:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(30, 64, 175, 0.3);
}

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

.btn-back {
    display: inline-block;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--jm-primary), #1E3A8A);
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-back:hover {
    box-shadow: 0 4px 8px rgba(30, 64, 175, 0.3);
    transform: translateY(-2px);
}

.btn-primary {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--jm-primary), #1E3A8A);
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary:hover {
    box-shadow: 0 4px 8px rgba(30, 64, 175, 0.3);
    transform: translateY(-2px);
}

/* Mobile Responsivo */
@media (max-width: 680px) {
    .ano-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .titulos-ano {
        grid-template-columns: 1fr;
    }

    .titulo-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .btn-recibo {
        width: 100%;
        margin-left: 0;
        margin-top: 12px;
        text-align: center;
    }

    .ano-card {
        padding: 16px;
    }

    .ano-header h2 {
        font-size: 18px;
    }

    .proximo-aluguel-card {
        padding: 16px;
    }

    .proximo-valor {
        font-size: 28px;
    }
}
