/* ========================================
   APP.CSS - Estilos Principales de Aplicación
   ResidentsPortal - Portal de Residentes

   Consolidado: layout + navigation + utilities + responsive
   ======================================== */

/* ========================================
   1. VARIABLES CSS
   ======================================== */
:root {
    --primary-color: #2e7d32;
    --primary-dark: #1b5e20;
    --primary-light: #4caf50;
    --secondary-color: #66bb6a;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --border-color: #dee2e6;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    --transition-base: all 0.3s ease;
}

/* ========================================
   2. ESTILOS BASE
   ======================================== */
* {
    box-sizing: border-box;
}

html {
    height: 100%;
    font-size: 16px;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-light);
    margin: 0;
    padding: 0;
}

/* === MAIN CONTENT === */
.main-content {
    flex: 1 0 auto;
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

.main-content .container {
    background-color: var(--bg-white);
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
}

/* === FOOTER === */
.footer-main {
    flex-shrink: 0;
    margin-top: auto;
}

.footer-premium {
    background-color: rgba(255, 255, 255, 0.96);
    border-top: 1px solid rgba(46, 125, 50, 0.18);
    box-shadow: 0 -8px 26px rgba(33, 37, 41, 0.06);
}

.footer-premium-container {
    padding: 1rem 1rem 5rem 1rem;
}

.footer-premium-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
}

.footer-premium-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    padding-bottom: 0.35rem;
    border-bottom: 0;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.footer-premium-row:last-child {
    padding-bottom: 0;
}

.footer-premium-row-brand,
.footer-premium-row-rights,
.footer-premium-row-contact,
.footer-premium-row-social,
.footer-premium-row-whatsapp {
    justify-content: center;
    align-items: center;
    text-align: center;
}

.footer-premium-row-whatsapp {
    flex-direction: column;
    gap: 0.5rem;
}

.footer-premium-brand {
    color: #24352c;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

.footer-premium-label {
    color: #34433b;
    font-size: 0.98rem;
    font-weight: 700;
}

.footer-premium-rights {
    color: #5a6a61;
    font-size: 0.94rem;
    font-weight: 600;
    margin: 0;
}

.footer-premium-link {
    color: #2e7d32;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
}

.footer-premium-link:hover,
.footer-premium-link:focus {
    color: #1f5d24;
    text-decoration: underline;
}

.footer-premium-social {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.footer-premium-whatsapp-title {
    color: #34433b;
    font-size: 0.95rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.footer-premium-whatsapp-title .bi-whatsapp {
    color: #25d366;
    font-size: 1.05rem;
}

.footer-premium-whatsapp-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

/* === TIPOGRAFÍA === */
.portal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
    line-height: 1.2;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; color: var(--primary-color); }
h3 { font-size: 1.5rem; }

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition-base);
}

a:hover {
    color: var(--primary-dark);
}

/* === CARDS === */
.card {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background-color: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--primary-color);
}

/* === TABLAS === */
.table {
    color: var(--text-primary);
}

.table thead th {
    background-color: var(--primary-color);
    color: var(--bg-white);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    border: none;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(46, 125, 50, 0.05);
}

.table-hover tbody tr:hover {
    background-color: rgba(46, 125, 50, 0.1);
    cursor: pointer;
}

/* === BOTONES === */
.btn {
    font-weight: 500;
    border-radius: 0.375rem;
    padding: 0.5rem 1.25rem;
    transition: var(--transition-base);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-success {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-success:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* === BADGES === */
.badge {
    font-weight: 500;
    padding: 0.35rem 0.75rem;
    border-radius: 0.375rem;
}

.badge.bg-success {
    background-color: var(--primary-color) !important;
}

/* ========================================
   3. NAVEGACIÓN
   ======================================== */
.navbar-header {
    background-color: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid rgba(46, 125, 50, 0.16);
    box-shadow: 0 12px 30px rgba(33, 37, 41, 0.08);
    backdrop-filter: blur(8px);
    z-index: 1040;
}

.navbar {
    padding: 0.9rem 0;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0;
    margin-right: auto;
}

.navbar-logo {
    height: 84px;
    width: auto;
    object-fit: contain;
    border-radius: 0.75rem;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 0.25rem;
    box-shadow: 0 6px 14px rgba(31, 93, 36, 0.15);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-line-1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1f2f26;
}

.brand-line-2 {
    font-size: 1rem;
    font-weight: 600;
    color: #2e7d32;
    margin-top: 0.2rem;
}

.badge-subtitle {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem;
    margin-top: 0.2rem;
    display: inline-block;
}

.navbar-nav {
    align-items: center;
}

.nav-item {
    margin: 0 0.25rem;
}

.nav-link {
    color: var(--text-primary) !important;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 1rem !important;
    border-radius: 0.25rem;
    transition: var(--transition-base);
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.nav-link i {
    font-size: 1rem;
}

.nav-link:hover {
    background-color: rgba(46, 125, 50, 0.1);
    color: var(--primary-color) !important;
}

.nav-link.active,
.nav-item.active .nav-link {
    background-color: var(--primary-color);
    color: var(--bg-white) !important;
    font-weight: 600;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    color: var(--text-primary);
}

.dropdown-toggle:hover {
    background-color: rgba(46, 125, 50, 0.1);
    color: var(--primary-color);
}

.dropdown-toggle i {
    font-size: 1.1rem;
}

.dropdown-menu {
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    border-radius: 0.5rem;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
}

.dropdown-item {
    padding: 0.75rem 1.5rem;
    color: var(--text-primary);
    font-weight: 500;
    transition: var(--transition-base);
    display: flex;
    align-items: center;
}

.dropdown-item i {
    width: 20px;
}

.dropdown-item:hover {
    background-color: rgba(46, 125, 50, 0.1);
    color: var(--primary-color);
}

.dropdown-item:active {
    background-color: var(--primary-color);
    color: var(--bg-white);
}

.navbar-toggler {
    border: 2px solid var(--primary-color);
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(46, 125, 50, 0.25);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%232e7d32' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    width: 1.5rem;
    height: 1.5rem;
}

.sticky-top {
    position: sticky;
    top: 0;
    z-index: 1040;
}

.navbar-collapse.collapsing {
    transition: height 0.3s ease;
}

.navbar-collapse.show {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn-outline-success {
    color: var(--primary-color);
    border-color: var(--primary-color);
    font-weight: 500;
}

.btn-outline-success:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--bg-white);
}

.btn-outline-success:focus {
    box-shadow: 0 0 0 0.2rem rgba(46, 125, 50, 0.25);
}

/* ========================================
   4. UTILIDADES
   ======================================== */

/* Spacing */
.mt-6 { margin-top: 4rem !important; }
.mb-6 { margin-bottom: 4rem !important; }
.py-6 { padding-top: 4rem !important; padding-bottom: 4rem !important; }
.px-6 { padding-left: 4rem !important; padding-right: 4rem !important; }

/* Text */
.text-premium { color: var(--primary-color) !important; font-weight: 600; }
.text-muted-custom { color: var(--text-muted) !important; }
.text-uppercase { text-transform: uppercase !important; letter-spacing: 0.5px; }
.text-bold { font-weight: 700 !important; }
.text-semi-bold { font-weight: 600 !important; }
.text-small { font-size: 0.875rem !important; }
.text-large { font-size: 1.125rem !important; }

/* Background */
.bg-light-custom { background-color: var(--bg-light) !important; }
.bg-premium { background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%) !important; color: var(--bg-white) !important; }
.bg-gradient-primary { background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%) !important; }

/* Borders */
.border-premium { border-color: var(--primary-color) !important; }
.border-thick { border-width: 2px !important; }
.border-radius-lg { border-radius: 0.75rem !important; }
.border-radius-xl { border-radius: 1rem !important; }

/* Shadows */
.shadow-premium { box-shadow: var(--shadow-md) !important; }
.shadow-premium-lg { box-shadow: var(--shadow-lg) !important; }
.shadow-none { box-shadow: none !important; }
.hover-shadow { transition: var(--transition-base); }
.hover-shadow:hover { box-shadow: var(--shadow-md) !important; }

/* Display */
.d-flex-center { display: flex !important; justify-content: center !important; align-items: center !important; }
.d-flex-between { display: flex !important; justify-content: space-between !important; align-items: center !important; }

/* Width / Height */
.w-fit { width: fit-content !important; }
.h-fit { height: fit-content !important; }
.min-h-100 { min-height: 100px !important; }
.min-h-200 { min-height: 200px !important; }
.min-h-300 { min-height: 300px !important; }

/* Cursor */
.cursor-pointer { cursor: pointer !important; }
.cursor-not-allowed { cursor: not-allowed !important; }

/* Transitions */
.transition-base { transition: var(--transition-base) !important; }
.transition-fast { transition: all 0.15s ease !important; }
.transition-slow { transition: all 0.5s ease !important; }

/* Hover Effects */
.hover-lift { transition: var(--transition-base); }
.hover-lift:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.hover-scale { transition: var(--transition-base); }
.hover-scale:hover { transform: scale(1.05); }
.hover-opacity { transition: var(--transition-base); }
.hover-opacity:hover { opacity: 0.8; }

/* Overflow */
.overflow-hidden { overflow: hidden !important; }
.overflow-x-auto { overflow-x: auto !important; }
.overflow-y-auto { overflow-y: auto !important; }

/* Position */
.position-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }

/* Z-index */
.z-index-high { z-index: 1000 !important; }
.z-index-modal { z-index: 1050 !important; }
.z-index-toast { z-index: 1055 !important; }

/* Divider */
.divider { height: 1px; background-color: var(--border-color); margin: 1.5rem 0; }
.divider-thick { height: 2px; background-color: var(--primary-color); margin: 2rem 0; }

/* Links */
.link-premium { color: var(--primary-color); text-decoration: none; font-weight: 600; transition: var(--transition-base); }
.link-premium:hover { color: var(--primary-dark); text-decoration: underline; }

/* Icons */
.icon-sm { font-size: 0.875rem; }
.icon-md { font-size: 1.25rem; }
.icon-lg { font-size: 1.75rem; }
.icon-xl { font-size: 2.5rem; }

/* Opacity */
.opacity-50 { opacity: 0.5 !important; }
.opacity-75 { opacity: 0.75 !important; }
.opacity-90 { opacity: 0.9 !important; }

/* ========================================
   5. RESPONSIVE (Mobile-First)
   ======================================== */

/* Extra Small Devices (<576px) */
@media (max-width: 575.98px) {
    .main-content { padding: 1rem 0; }
    .main-content .container { padding: 1rem; border-radius: 0; }
    .navbar-logo { height: 66px; }
    .brand-line-1 { font-size: 0.88rem; }
    .brand-line-2 { font-size: 0.82rem; }
    .badge-subtitle { font-size: 0.65rem; }
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.35rem; }
    h3 { font-size: 1.15rem; }
    .table { font-size: 0.875rem; }
    .table thead th { font-size: 0.75rem; padding: 0.5rem 0.25rem; }
    .table tbody td { padding: 0.5rem 0.25rem; }
    .table-responsive { border-radius: 0.5rem; box-shadow: var(--shadow-sm); }
    .card { margin-bottom: 1rem; }
    .card-body { padding: 1rem; }
    .btn { padding: 0.5rem 1rem; font-size: 0.875rem; }
    .btn-group { display: flex; flex-direction: column; gap: 0.5rem; }
    .btn-group .btn { width: 100%; }
    .form-control, .form-select { font-size: 0.875rem; }
    .mt-4, .my-4 { margin-top: 1.5rem !important; }
    .mb-4, .my-4 { margin-bottom: 1.5rem !important; }
    .navbar-collapse { background-color: var(--bg-white); padding: 1rem; margin-top: 1rem; border-radius: 0.5rem; box-shadow: var(--shadow-md); border: 1px solid var(--border-color); }
    .navbar-nav { flex-direction: column; align-items: stretch; width: 100%; }
    .nav-item { margin: 0.25rem 0; width: 100%; }
    .nav-link { justify-content: space-between; width: 100%; }
}

/* Small Devices (≥576px) */
@media (min-width: 576px) {
    .main-content { padding: 2rem 1rem; }
    .navbar-collapse { display: flex !important; flex-direction: row; }
}

@media (min-width: 768px) {
    .footer-premium-container {
        padding: 1.1rem 1.5rem 1.1rem 1.5rem;
    }

    .footer-premium-link,
    .footer-premium-label,
    .footer-premium-rights {
        font-size: 0.98rem;
    }

    .footer-premium-whatsapp-links {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.9rem;
    }
}

@media (max-width: 767.98px) {
    .footer-premium-brand {
        font-size: 1rem;
    }
}

/* Medium Devices (≥768px) */
@media (min-width: 768px) {
    html { font-size: 16px; }
    h1 { font-size: 2rem; }
    .navbar-logo { height: 84px; }
    .brand-line-1 { font-size: 1.2rem; }
    .brand-line-2 { font-size: 1rem; }
}

/* Landscape phones & tablets */
@media (max-width: 767.98px) and (orientation: landscape) {
    .navbar-logo { height: 56px; }
    .brand-line-1 { font-size: 0.84rem; }
    .brand-line-2 { font-size: 0.78rem; }
    .main-content { padding: 1rem 0; }
}

/* Large Devices (≥992px) */
@media (min-width: 992px) {
    .main-content .container { padding: 2rem; }
}

/* Animation utilities */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}
