/*
 * HOAware Super Admin theme
 *
 * Mirrors www.hoaware.com: Inter, the navy -> blue -> teal -> emerald
 * gradient system, large soft-shadow cards and pill accents.
 * Loaded by header.php (all signed-in pages), index.php and maintenance.php.
 * Page-specific tweaks go in a page's $customStyles, not here.
 */

/* ---------- Tokens ---------- */
:root {
    --hw-navy: #0f2b46;
    --hw-blue: #1e40af;
    --hw-sky: #0284c7;
    --hw-teal: #0891b2;
    --hw-emerald: #059669;
    --hw-gold: #fbbf24;

    --hw-text: #1e293b;
    --hw-muted: #4a5568;
    --hw-light: #718096;
    --hw-bg: #f5f8fb;
    --hw-mint: #f0fdf8;
    --hw-border: #e6ebf1;
    --hw-tint: #eef4ff;

    --gradient-primary: linear-gradient(135deg, #1e40af 0%, #059669 100%);
    --gradient-hero: linear-gradient(135deg, #0f2b46 0%, #1e40af 35%, #0891b2 70%, #059669 100%);
    --gradient-accent: linear-gradient(90deg, #1e40af, #0891b2, #059669);
    --gradient-dark: linear-gradient(135deg, #0f2b46 0%, #1e3a5f 50%, #0f2b46 100%);

    --hw-radius-sm: 10px;
    --hw-radius: 16px;
    --hw-radius-lg: 20px;
    --hw-shadow: 0 4px 20px rgba(15, 43, 70, 0.06);
    --hw-shadow-hover: 0 18px 40px rgba(8, 145, 178, 0.14);
    --hw-shadow-btn: 0 8px 20px rgba(30, 64, 175, 0.25);

    --hw-topnav-height: 64px;
    --hw-sidebar-width: 264px;

    /* Legacy names still referenced by page styles */
    --primary-color: var(--hw-blue);
    --secondary-color: #64748b;
    --success-color: var(--hw-emerald);
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --info-color: var(--hw-teal);
    --light-bg: var(--hw-bg);
    --border-color: var(--hw-border);

    /* Bootstrap overrides so stock components pick up the brand */
    --bs-primary: #1e40af;
    --bs-primary-rgb: 30, 64, 175;
    --bs-success: #059669;
    --bs-success-rgb: 5, 150, 105;
    --bs-info: #0891b2;
    --bs-info-rgb: 8, 145, 178;
    --bs-dark: #0f2b46;
    --bs-dark-rgb: 15, 43, 70;
    --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-body-color: #1e293b;
    --bs-body-bg: #f5f8fb;
    --bs-border-color: #e6ebf1;
    --bs-link-color: #1e40af;
    --bs-link-color-rgb: 30, 64, 175;
    --bs-link-hover-color: #0891b2;
    --bs-link-hover-color-rgb: 8, 145, 178;
    --bs-border-radius: 0.625rem;
    --bs-border-radius-lg: 1rem;
    --bs-focus-ring-color: rgba(8, 145, 178, 0.25);
}

body {
    background: var(--hw-bg);
    color: var(--hw-text);
    font-family: var(--bs-body-font-family);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    color: inherit;
    font-weight: 700;
    letter-spacing: -0.01em;
}

code {
    color: var(--hw-teal);
}

/* Bootstrap ships opacity-0/25/50/75/100 only; pages use 90 for header subtitles */
.opacity-90 {
    opacity: 0.9 !important;
}

.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ---------- Wordmark (matches the hoaware.com text logo) ---------- */
.hoaware-logo {
    font-weight: 800;
    font-size: 1.45rem;
    letter-spacing: -0.02em;
    line-height: 1;
    text-decoration: none;
    display: inline-flex;
    align-items: baseline;
}

.hoaware-logo .hoa {
    background: linear-gradient(135deg, #1e40af 0%, #0284c7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hoaware-logo .ware {
    background: linear-gradient(135deg, #0891b2 0%, #059669 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hoaware-logo .tm {
    font-size: 0.55em;
    color: var(--hw-light);
    margin-left: 1px;
    align-self: flex-start;
}

.hoaware-logo-white .hoa,
.hoaware-logo-white .ware {
    background: none;
    -webkit-text-fill-color: #fff;
    color: #fff;
}

.hoaware-logo-white .tm {
    color: rgba(255, 255, 255, 0.7);
}

.brand-tag {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.3rem 0.6rem;
    border-radius: 50px;
    background: var(--hw-tint);
    color: var(--hw-blue);
}

/* ---------- Top navigation ---------- */
.navbar-custom {
    height: var(--hw-topnav-height);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--hw-border);
    box-shadow: 0 2px 12px rgba(15, 43, 70, 0.04);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.navbar-custom .navbar-text {
    color: var(--hw-muted);
    font-size: 0.9rem;
}

.navbar-custom .user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.env-pill {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.env-pill::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.env-pill.env-production { background: #fee2e2; color: #b91c1c; }
.env-pill.env-test { background: #e0f2fe; color: #0369a1; }
.env-pill.env-development { background: #d1fae5; color: #047857; }

/* ---------- Layout ---------- */
.app-shell {
    display: flex;
    min-height: calc(100vh - var(--hw-topnav-height));
}

.app-main {
    flex: 1 1 auto;
    min-width: 0; /* lets wide tables scroll instead of pushing the layout */
    padding: 2rem;
}

@media (max-width: 991.98px) {
    .app-main {
        padding: 1.25rem;
    }
}

/* ---------- Sidebar ---------- */
.sidebar {
    background: #fff;
    border-right: 1px solid var(--hw-border);
}

@media (min-width: 992px) {
    .sidebar {
        width: var(--hw-sidebar-width);
        flex: 0 0 var(--hw-sidebar-width);
        position: sticky;
        top: var(--hw-topnav-height);
        height: calc(100vh - var(--hw-topnav-height));
        overflow-y: auto;
    }
}

@media (max-width: 991.98px) {
    .sidebar.offcanvas-lg {
        width: var(--hw-sidebar-width);
    }
}

.sidebar .offcanvas-body {
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0.85rem;
    height: 100%;
}

.sidebar-heading {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--hw-light);
    padding: 0 0.85rem;
    margin-bottom: 0.6rem;
}

.sidebar .nav-link {
    color: var(--hw-muted);
    font-weight: 500;
    font-size: 0.925rem;
    padding: 0.65rem 0.85rem;
    border-radius: 12px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar .nav-link i:first-child {
    width: 1.25rem;
    text-align: center;
    margin-right: 0.65rem !important;
    color: var(--hw-light);
    transition: color 0.2s ease;
}

.sidebar .nav-link:hover {
    background: var(--hw-tint);
    color: var(--hw-blue);
}

.sidebar .nav-link:hover i:first-child {
    color: var(--hw-blue);
}

.sidebar .nav-link.active {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: var(--hw-shadow-btn);
}

.sidebar .nav-link.active i:first-child {
    color: #fff;
}

.sidebar .nav-link .badge {
    margin-left: auto;
}

.sidebar .nav-link .env-badge {
    font-size: 0.6rem;
}

.sidebar-footer {
    margin-top: auto;
    padding: 1rem 0.85rem 0;
    border-top: 1px solid var(--hw-border);
    font-size: 0.8rem;
    color: var(--hw-light);
}

/* ---------- Page header ---------- */
.page-header {
    position: relative;
    overflow: hidden;
    background: var(--gradient-hero);
    color: #fff;
    padding: 2rem 2.25rem;
    border-radius: var(--hw-radius-lg);
    margin-bottom: 2rem;
    box-shadow: 0 12px 32px rgba(15, 43, 70, 0.18);
}

.page-header::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 85% 20%, rgba(255, 255, 255, 0.16) 0, transparent 40%),
        radial-gradient(circle at 10% 110%, rgba(52, 211, 153, 0.25) 0, transparent 45%);
    pointer-events: none;
}

.page-header > * {
    position: relative;
    z-index: 1;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.page-header p {
    color: rgba(255, 255, 255, 0.85);
}

.page-header .btn {
    border-radius: 50px;
    font-weight: 600;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

.page-header .btn-light {
    color: var(--hw-blue);
    border: none;
    box-shadow: 0 6px 16px rgba(15, 43, 70, 0.2);
}

.page-header .btn-light:hover {
    background: #fff;
    transform: translateY(-1px);
}

@media (max-width: 767.98px) {
    .page-header {
        padding: 1.5rem;
    }

    .page-header .d-flex.justify-content-between {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }
}

/* ---------- Cards ---------- */
.card {
    border: 1px solid rgba(15, 43, 70, 0.05);
    border-radius: var(--hw-radius);
    box-shadow: var(--hw-shadow);
}

.card > .card-header:first-child {
    border-radius: var(--hw-radius) var(--hw-radius) 0 0;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--hw-border);
    font-weight: 600;
    padding: 0.9rem 1.25rem;
}

.card-header.bg-primary,
.card-header-custom,
.modal-header-custom {
    background: var(--gradient-primary) !important;
    color: #fff;
    border-bottom: none;
}

.card-header-custom {
    padding: 1rem 1.5rem;
}

/* Brand-colored header icons sit on a white tile so they read against the gradient */
.card-header-custom h5 > i:first-child {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: #fff;
    border-radius: 8px;
    font-size: 1rem;
    vertical-align: middle;
    box-shadow: 0 2px 6px rgba(15, 43, 70, 0.15);
}

.stats-card {
    position: relative;
    overflow: hidden;
    background: #fff;
    border-radius: var(--hw-radius-lg);
    padding: 1.4rem 1.5rem;
    border: 1px solid rgba(15, 43, 70, 0.05);
    box-shadow: var(--hw-shadow);
    height: 100%;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--hw-shadow-hover);
}

.stats-card:hover::before {
    transform: scaleX(1);
}

.stats-card h3 {
    font-weight: 800;
    letter-spacing: -0.02em;
}

.stats-card .rounded {
    border-radius: 14px !important;
}

.row > [class*="col-"] > .stats-card {
    margin-bottom: 1rem;
}

/* ---------- Tables ---------- */
.table-container {
    background: #fff;
    border-radius: var(--hw-radius-lg);
    border: 1px solid rgba(15, 43, 70, 0.05);
    box-shadow: var(--hw-shadow);
    overflow-x: auto;
}

.table {
    --bs-table-hover-bg: #f6f9ff;
    margin-bottom: 0;
}

.table th {
    background: #f8fafc;
    border-bottom: 1px solid var(--hw-border);
    font-weight: 600;
    color: var(--hw-light);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.table td {
    border-color: #f0f3f7;
    vertical-align: middle;
}

/* ---------- Buttons ---------- */
.btn {
    font-weight: 600;
    border-radius: var(--hw-radius-sm);
    transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: #1e40af;
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #1e3a8a;
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-bg: #1e3a8a;
    --bs-btn-active-border-color: transparent;
    --bs-btn-disabled-bg: #1e40af;
    --bs-btn-disabled-border-color: transparent;
    background-image: var(--gradient-primary);
    box-shadow: var(--hw-shadow-btn);
}

.btn-primary:hover,
.btn-primary:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(30, 64, 175, 0.32);
}

.btn-outline-primary {
    --bs-btn-color: #1e40af;
    --bs-btn-border-color: #1e40af;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #1e40af;
    --bs-btn-hover-border-color: #1e40af;
    --bs-btn-active-bg: #1e3a8a;
    --bs-btn-active-border-color: #1e3a8a;
}

.btn-success {
    --bs-btn-bg: #059669;
    --bs-btn-border-color: #059669;
    --bs-btn-hover-bg: #047857;
    --bs-btn-hover-border-color: #047857;
}

.btn-info {
    --bs-btn-color: #fff;
    --bs-btn-bg: #0891b2;
    --bs-btn-border-color: #0891b2;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #0e7490;
    --bs-btn-hover-border-color: #0e7490;
}

.btn-sm {
    border-radius: 8px;
}

.btn-lg {
    border-radius: 50px;
}

.action-buttons .btn {
    padding: 0.25rem 0.5rem;
    margin: 0 0.125rem;
}

.btn-close-white {
    filter: brightness(0) invert(1);
}

/* ---------- Badges, pills, alerts ---------- */
.badge {
    font-weight: 600;
    border-radius: 50px;
    padding: 0.4em 0.75em;
    letter-spacing: 0.01em;
}

.nav-pills .nav-link {
    color: var(--hw-muted);
    font-weight: 600;
    border-radius: 50px;
    padding: 0.45rem 1.1rem;
}

.nav-pills .nav-link:hover {
    background: var(--hw-tint);
    color: var(--hw-blue);
}

.nav-pills .nav-link.active {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: var(--hw-shadow-btn);
}

.nav-tabs .nav-link.active {
    color: var(--hw-blue);
    font-weight: 600;
}

.alert {
    border: none;
    border-radius: 14px;
    box-shadow: var(--hw-shadow);
}

.status-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-active {
    background-color: #d1fae5;
    color: var(--hw-emerald);
}

.status-inactive {
    background-color: #fee2e2;
    color: var(--danger-color);
}

/* ---------- Forms ---------- */
.form-control,
.form-select {
    border-color: #d8e0ea;
    border-radius: var(--hw-radius-sm);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--hw-teal);
    box-shadow: 0 0 0 0.2rem rgba(8, 145, 178, 0.18);
}

.form-check-input:checked {
    background-color: var(--hw-blue);
    border-color: var(--hw-blue);
}

.form-label {
    font-weight: 500;
    color: var(--hw-text);
}

.form-floating textarea {
    min-height: 150px;
}

/* ---------- Modals & dropdowns ---------- */
.modal-content {
    border: none;
    border-radius: var(--hw-radius-lg);
    box-shadow: 0 24px 60px rgba(15, 43, 70, 0.25);
    overflow: hidden;
}

.modal-header {
    border-bottom-color: var(--hw-border);
}

.modal-footer {
    border-top-color: var(--hw-border);
    background: #fafbfd;
}

.dropdown-menu {
    border: 1px solid var(--hw-border);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(15, 43, 70, 0.12);
    padding: 0.4rem;
}

.dropdown-item {
    border-radius: 8px;
}

.dropdown-item.active,
.dropdown-item:active {
    background: var(--gradient-primary);
}

.list-group-item-action:hover {
    background: var(--hw-tint);
}

/* ---------- DataTables ---------- */
.dataTables_wrapper .dataTables_length select {
    padding: 0.375rem 2rem 0.375rem 0.75rem;
}

.dataTables_wrapper .dataTables_filter input {
    border-radius: 50px;
    padding-left: 1rem;
}

.dataTables_wrapper .dataTables_info {
    color: var(--hw-light);
    font-size: 0.875rem;
}

.page-link {
    color: var(--hw-blue);
    border-radius: 8px !important;
    margin: 0 2px;
    border-color: var(--hw-border);
}

.active > .page-link,
.page-link.active {
    background: var(--gradient-primary);
    border-color: transparent;
}

/* ---------- Auth pages (login, maintenance) ---------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: var(--gradient-hero);
    position: relative;
    overflow: hidden;
}

.auth-page::before,
.auth-page::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.45;
    pointer-events: none;
}

.auth-page::before {
    width: 420px;
    height: 420px;
    background: #0ea5e9;
    top: -120px;
    right: -100px;
}

.auth-page::after {
    width: 380px;
    height: 380px;
    background: #34d399;
    bottom: -140px;
    left: -100px;
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 30px 70px rgba(15, 43, 70, 0.35);
    overflow: hidden;
}

.auth-card .auth-card-accent {
    height: 5px;
    background: var(--gradient-accent);
}
