/* First In Properties - Custom Styles */
/* Brand: Same palette as First In Upholstery */

/* Source of truth for anything rendered in a browser. HTML email and generated PDFs
   cannot use var(), so the same palette is mirrored as constants in includes/Brand.php —
   change a value here and you must change it there too. */
:root {
    --fip-primary: #0d6efd;
    --fip-primary-rgb: 13, 110, 253;  /* keep in sync with --fip-primary for rgba() uses */
    --fip-dark: #1a2a3a;
    --fip-accent: #dc3545;
    --fip-light: #f8f9fa;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--fip-dark) 0%, var(--fip-primary) 100%);
    min-height: 60vh;
    display: flex;
    align-items: center;
    color: #fff;
}

.hero-section h1 {
    font-size: 2.5rem;
    font-weight: 700;
}

/* Property Card */
.property-card {
    border: none;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.property-card:hover {
    transform: translateY(-4px);
}

.property-status-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.85rem;
    padding: 0.35em 0.8em;
}

/* Auth Cards */
.auth-card {
    max-width: 480px;
    margin: 2rem auto;
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.auth-card .card-header {
    background: var(--fip-dark);
    color: #fff;
    border-radius: 0.75rem 0.75rem 0 0 !important;
    text-align: center;
    padding: 1.5rem;
}

/* Google OAuth Button */
.btn-google {
    background: #fff;
    color: #444;
    border: 1px solid #ddd;
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: background 0.2s, box-shadow 0.2s;
}

.btn-google:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    color: #333;
}

.btn-google img {
    width: 20px;
    height: 20px;
    margin-right: 0.5rem;
}

/* Dashboard Cards */
.dashboard-stat {
    border: none;
    border-radius: 0.75rem;
    border-left: 4px solid var(--fip-primary);
}

.dashboard-stat.accent {
    border-left-color: var(--fip-accent);
}

.dashboard-stat.success {
    border-left-color: #198754;
}

.dashboard-stat.warning {
    border-left-color: #ffc107;
}

/* Sidebar */
.admin-sidebar {
    background: var(--fip-dark);
    min-height: calc(100vh - 56px);
    position: sticky;
    top: 56px;
}

.admin-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.7);
    padding: 0.6rem 1rem;
    border-radius: 0.375rem;
    margin: 0.1rem 0.5rem;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.admin-sidebar .nav-link i {
    width: 1.5rem;
    text-align: center;
    margin-right: 0.5rem;
}

.sidebar-heading {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 1rem 1rem 0.3rem;
}

/* Form Controls */
.form-control:focus,
.form-select:focus {
    border-color: var(--fip-primary);
    /* Match Bootstrap 5.3's focus ring (0.25rem / 0.25 alpha) so form controls are no
       fainter than buttons/links — a WCAG 2.4.7 concern on the controls keyboard users
       spend the most time in. Uses the brand var so a rebrand can't desync it from the border. */
    box-shadow: 0 0 0 0.25rem rgba(var(--fip-primary-rgb), 0.25);
}

/* Accessibility */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--fip-primary);
    color: #fff;
    padding: 0.5rem 1rem;
    z-index: 9999;
    text-decoration: none;
}

.skip-link:focus {
    top: 0;
}

*:focus-visible {
    outline: 2px solid var(--fip-primary);
    outline-offset: 2px;
}

/* Unread row in the navbar's notification dropdown.

   The dropdown is a child of <nav data-bs-theme="dark">, so the dark colour mode cascades
   into it and .dropdown-item text renders LIGHT (--bs-dropdown-link-color, ~#dee2e6).
   Bootstrap's .bg-light is a fixed near-white (#f8f9fa) that ignores the colour mode, so
   using it as the unread cue painted light-grey text onto an almost-white row — the unread
   notifications were the only ones in the menu you could not read, i.e. exactly the ones
   that matter. Tint with the brand colour at low alpha instead: it reads as "unread"
   against the dark menu, leaves the inherited text colour legible, and would still work if
   this dropdown ever moved to a light surface. Do not swap this back to a .bg-* utility —
   only .bg-body-* are colour-mode aware, and none of them carry the accent. */
.notif-unread {
    background-color: rgba(var(--fip-primary-rgb), 0.18);
    box-shadow: inset 3px 0 0 var(--fip-primary);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .hero-section h1 { font-size: 1.75rem; }
    .hero-section { min-height: 40vh; }

    /* Touch targets */
    .btn, .nav-link, .dropdown-item {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Form inputs. font-size stays here — iOS zoom is a viewport concern, not a pointer
       one. The 44px minimum moved to the @media (pointer: coarse) block below, where it
       belongs alongside the button rule. */
    .form-control, .form-select {
        font-size: 16px; /* Prevents iOS zoom */
    }
}

@media (max-width: 576px) {
    .auth-card { margin: 1rem; }
}

/* Touch targets on any coarse-pointer (touch) device, regardless of viewport width.
   Bootstrap's .btn-sm renders ~31px tall; force the 44px WCAG 2.5.5 minimum so small
   action buttons (Pay Now, View as, ticket/message actions) stay tappable. */
@media (pointer: coarse) {
    .btn, .nav-link, .dropdown-item {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    /* Centre only buttons. nav-links and dropdown-items are text menu rows (user menu,
       notifications) that must stay left-aligned like every other list in the app —
       centring them made the me-2 icons float mid-row and read as a rendering bug,
       including on touch laptops at full desktop width (pointer:coarse has no width bound). */
    .btn {
        justify-content: center;
    }
    /* Same reasoning as .btn above, and the same ~31px problem: .form-control-sm and
       .form-select-sm are all over the admin UI (documents, maintenance, expenses,
       recurring charges, inspections). This rule was previously inside the
       max-width: 768px query, so on an iPad in landscape or a touch laptop — the exact
       devices this pointer-based query exists to catch — every small field fell back to
       Bootstrap's default height while the buttons beside them looked correctly sized. */
    .form-control, .form-select {
        min-height: 44px;
    }
}

/* Corner "remove" control on a photo thumbnail (inspections, property gallery).
   Replaces the inline `width:32px;height:32px` this was previously written as — that
   overrode the 44px coarse-pointer minimum above, leaving a 32px DESTRUCTIVE target that
   is both hard to hit and easy to mis-hit on a phone, where the miss deletes a photo.
   The visible circle stays 32px so the thumbnail isn't swamped; the hit area grows to
   44x44 on touch via a transparent ::before, which is what the pointer actually tests. */
.photo-delete-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    transform: translate(35%, -35%);
}

@media (pointer: coarse) {
    .photo-delete-btn {
        /* Beat the generic `.btn { min-height: 44px }` — the circle must stay round. */
        min-height: 32px;
    }
    .photo-delete-btn::before {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        width: 44px;
        height: 44px;
        transform: translate(-50%, -50%);
    }
}

/*
 * Destructive photo control that sits in normal flow inside a flex row (admin/property).
 * .photo-delete-btn cannot be reused here: it is absolutely positioned over a thumbnail and
 * expands its hit area with a ::before that assumes a positioned ancestor. This variant has to
 * get its target size from the box itself — the generic `.btn { min-height: 44px }` already
 * covers height on coarse pointers, but an icon-only button stays a thin vertical sliver
 * horizontally, directly beside a caption input the user is also trying to tap.
 */
@media (pointer: coarse) {
    .photo-delete-inline {
        min-width: 44px;
    }
}

/* Drop-zone dashed outline — Bootstrap 5.3 has no .border-dashed utility, so the dashed
   affordance that signals "drop here" has to live here. */
.dropzone {
    border-style: dashed !important;
}

/* Drop-zone active state, so the brand color stays reachable from :root rather than being
   assigned inline in JS (where a rebrand silently misses it). */
.dropzone-active {
    border-color: var(--fip-primary) !important;
    background: rgba(var(--fip-primary-rgb), 0.06);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .property-card { transition: none; }
}
