﻿/* ---------------------------------------------------------
   SiteTracker - Mobile styles
   Applied only on screens <= 767.98px via _Layout link tag
---------------------------------------------------------- */

/* ===== Modal slide-up animation ===== */
@keyframes quickModalSlideUp {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 767.98px) {

    /* =========================
       GLOBAL
       ========================= */

    /* Because navbar is fixed-top */
    body {
        padding-top: 64px;
    }

    /* =========================
       NAVBAR (mobile)
       ========================= */

    .navbar {
        min-height: 60px;
    }

        .navbar .navbar-brand {
            font-size: 1.15rem;
            font-weight: 700;
            white-space: nowrap;
        }

    /* Burger */
    .navbar-toggler {
        padding: 8px 10px;
        border-radius: 10px;
    }

    /* Top row stays a row, collapse drops underneath */
    .navbar .content-wrapper {
        display: flex;
        align-items: center;
        flex-wrap: wrap; /* lets collapse go to next line */
        width: 100%;
    }

    /* Right controls pinned right on the top row */
    .nav-right-controls {
        margin-left: auto;
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: nowrap;
    }

    /* Icon buttons bigger */
    #notifBellBtn,
    .user-menu-btn {
        height: 44px !important;
        min-width: 44px;
        font-size: 1.05rem;
        border-radius: 12px !important;
    }

    /* Hide the desktop dark button on mobile (use dropdown item) */
    #darkModeToggle {
        display: none !important;
    }

    /* Collapse panel under the top row */
    #mainNavbar {
        width: 100%;
        flex-basis: 100%;
        order: 100;
        margin-top: 8px;
        padding: 10px 12px 14px;
        background: rgba(255, 255, 255, 0.98);
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: 0 0 14px 14px;
    }

    .dark-mode #mainNavbar {
        background: rgba(30, 30, 30, 0.98);
        border-top-color: #444;
    }

    #mainNavbar .navbar-nav,
    #mainNavbar .nav-item {
        width: 100%;
    }

    #mainNavbar .nav-link {
        font-size: 1.05rem;
        padding: 12px 12px;
        border-radius: 12px;
    }

        #mainNavbar .nav-link:active {
            transform: scale(0.99);
        }

        #mainNavbar .nav-link:hover {
            background: rgba(0, 0, 0, 0.06);
        }

    .dark-mode #mainNavbar .nav-link:hover {
        background: rgba(255, 255, 255, 0.08);
    }

    .dropdown-menu .dropdown-item,
    .mobile-user-menu .dropdown-item {
        padding: 12px 14px;
        font-size: 1.05rem;
    }

    /* =========================
       SITES INDEX (mobile cards)
       ========================= */

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

    .site-card {
        border: 1px solid rgba(0, 0, 0, .08);
        border-radius: 14px;
        padding: 12px;
        background: #fff;
        box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
        /* IMPORTANT: stops borders/background bleeding past rounded corners */
        overflow: hidden;
        background-clip: padding-box;
    }

    .dark-mode .site-card {
        background: #2b2b2b;
        border-color: #444;
        box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
    }

    /* Emergency jobs: keep a clean red border in BOTH modes */
    .emergency-card {
        border: 2px solid rgba(220, 53, 69, 0.85) !important;
    }

    .dark-mode .emergency-card {
        border: 2px solid rgba(220, 53, 69, 0.95) !important;
    }

    /* Site ID + Site name on ONE line */
    .site-card-title {
        display: flex;
        align-items: center;
        gap: 6px;
        font-weight: 700;
        line-height: 1.2;
    }

    .site-card-code {
        font-weight: 800;
        white-space: nowrap;
    }

    .site-card-name {
        flex: 1;
        min-width: 0; /* REQUIRED for ellipsis in flex */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .site-card-subtext {
        margin-top: 4px;
        font-size: .9rem;
        color: rgba(0, 0, 0, .6);
    }

    .dark-mode .site-card-subtext {
        color: rgba(255, 255, 255, .7);
    }

    /* =========================
       QUICK EDIT MODAL (mobile)
       ========================= */

    #siteQuickModal .modal-dialog {
        display: flex;
        align-items: center;
        min-height: 100vh;
        margin: 0;
        padding: 0 12px;
    }

    #siteQuickModal .modal-content {
        width: 100%;
        max-width: 520px;
        margin: auto;
        border-radius: 18px;
        animation: quickModalSlideUp 0.25s ease-out;
        overflow: hidden; /* stops header/borders bleeding */
    }

    .dark-mode #siteQuickModal .modal-content {
        background-color: #1f1f1f;
    }

    #siteQuickModal .modal-title {
        font-size: 1.25rem;
        font-weight: 700;
    }

    #siteQuickModal strong {
        font-size: 1.05rem;
    }

    #siteQuickModal,
    #siteQuickModal span,
    #siteQuickModal p {
        font-size: 1rem;
        line-height: 1.5;
    }

        #siteQuickModal input,
        #siteQuickModal textarea,
        #siteQuickModal select {
            font-size: 1.05rem;
            padding: 10px 12px;
        }

        #siteQuickModal .btn {
            font-size: 1rem;
            padding: 10px 14px;
        }

        #siteQuickModal .modal-footer {
            padding: 16px;
            gap: 10px;
        }

            #siteQuickModal .modal-footer .btn-primary {
                flex-grow: 1;
            }

    /* =========================
       EDIT / POSTPONE / DELETE MODAL
       ========================= */

    #siteEditModal .modal-dialog {
        display: flex;
        align-items: center;
        min-height: 100vh;
        margin: 0;
        padding: 0 12px;
    }

    #siteEditModal .modal-content {
        width: 100%;
        max-width: 520px;
        margin: auto;
        border-radius: 18px;
        animation: quickModalSlideUp 0.25s ease-out;
        overflow: hidden;
    }

    .dark-mode #siteEditModal .modal-content {
        background-color: #1f1f1f;
    }

    #siteEditModal .btn {
        font-size: 1rem;
        padding: 10px 14px;
        border-radius: 12px;
    }

    #siteEditModal .modal-footer {
        padding: 16px;
        gap: 10px;
        flex-wrap: wrap;
    }

    /* =========================
       CREATE PAGE (mobile)
       ========================= */

    .create-site-wrap {
        padding-left: 12px;
        padding-right: 12px;
    }

        .create-site-wrap .mx-auto {
            max-width: 100% !important;
        }

        .create-site-wrap .card {
            border-radius: 14px;
            overflow: hidden; /* stops header bleed */
        }

        .create-site-wrap .card-header {
            font-weight: 800;
            padding: 12px 14px;
        }

        .create-site-wrap #emergencyInstallButton {
            padding: 12px 14px;
            font-size: 1.05rem;
            border-radius: 12px;
        }

        .create-site-wrap .save-row {
            justify-content: stretch !important;
        }

            .create-site-wrap .save-row .btn {
                width: 100%;
                border-radius: 12px;
            }

    /* =========================
       ADHOC 2nd DATE REMOVE BUTTON (clear + obvious)
       ========================= */

    #adhocSecondDateRow {
        position: relative;
        padding-top: 52px; /* space for remove button */
    }

    /* This assumes you have a remove button with id="adhocRemoveSecondDateBtn"
       on Create page. If not, add it there (like your other page). */
    #adhocRemoveSecondDateBtn {
        position: absolute;
        top: 8px;
        right: 12px;
        height: 42px;
        padding: 0 14px;
        border-radius: 12px;
        font-weight: 800;
        font-size: 1rem;
        line-height: 42px;
        /* Make it “obvious” */
        border-width: 2px;
    }

    /* If an old remove-column exists, hide it on mobile */
    #adhocSecondDateRow .col-md-2 {
        display: none;
    }

    /* =========================
       EDIT PAGE (Edit.cshtml) – MOBILE POLISH
       ========================= */

    .edit-page-wrap {
        padding: 0 12px;
    }

        .edit-page-wrap .card {
            border-radius: 16px;
            overflow: hidden; /* FIX: stops header bleeding past rounded corners */
            box-shadow: 0 2px 12px rgba(0,0,0,.08);
        }

    .dark-mode .edit-page-wrap .card {
        box-shadow: 0 2px 14px rgba(0,0,0,.35);
    }

    /* Remove offset squeeze */
    .edit-page-wrap .offset-md-2,
    .edit-page-wrap .offset-md-3,
    .edit-page-wrap .offset-md-4 {
        margin-left: 0 !important;
    }

    /* Stack common columns */
    .edit-page-wrap .col-md-2,
    .edit-page-wrap .col-md-4,
    .edit-page-wrap .col-md-6,
    .edit-page-wrap .col-md-8 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }

    .edit-page-wrap h2 {
        font-size: 1.25rem;
        line-height: 1.2;
        margin-bottom: 8px;
    }

    .edit-page-wrap h4 {
        font-size: 1.1rem;
        font-weight: 800;
        margin-top: 10px;
        margin-bottom: 8px;
    }

    /* Turn each section into a panel */
    .edit-section {
        border: 1px solid rgba(0,0,0,.08);
        border-radius: 14px;
        padding: 12px;
        margin-bottom: 12px;
        background: rgba(255,255,255,.7);
        overflow: hidden; /* prevents inner borders bleeding */
    }

    .dark-mode .edit-section {
        background: rgba(30,30,30,.55);
        border-color: #444;
    }

    .edit-page-wrap .form-label {
        font-size: 0.95rem;
        font-weight: 700;
        margin-bottom: 6px;
    }

    .edit-page-wrap input.form-control,
    .edit-page-wrap select.form-select,
    .edit-page-wrap textarea.form-control {
        font-size: 1.05rem;
        padding: 12px 12px;
        border-radius: 12px;
    }

    /* Checkboxes easier to tap */
    .edit-page-wrap .form-check-input {
        width: 1.25rem;
        height: 1.25rem;
        transform: scale(1.15);
    }

    /* Tracking/buttons bigger */
    .edit-page-wrap .tracking-add-btn,
    .edit-page-wrap .tracking-save-btn,
    .edit-page-wrap .tracking-cancel-btn,
    .edit-page-wrap .tracking-history-toggle,
    .edit-page-wrap .edit-field-btn {
        padding: 10px 12px;
        border-radius: 12px;
        font-size: 1rem;
    }

    .edit-page-wrap .view-mode {
        flex-wrap: wrap;
        gap: 10px !important;
    }

    .edit-page-wrap .tracking-current-link {
        font-size: 1.05rem;
        font-weight: 800;
        word-break: break-all;
    }

    #PageSaveButton {
        width: 100%;
        padding: 12px 14px;
        border-radius: 14px;
        font-size: 1.05rem;
        font-weight: 800;
    }

    #saveToast {
        right: 12px !important;
        left: 12px !important;
        width: auto !important;
        text-align: center;
        border-radius: 12px !important;
    }

    /* =========================
       EDIT PAGE MODALS – match quick edit
       ========================= */

    #unpostponeInfoModal .modal-dialog,
    #scheduleCheckModal .modal-dialog {
        display: flex;
        align-items: center;
        min-height: 100vh;
        margin: 0;
        padding: 0 12px;
    }

    #unpostponeInfoModal .modal-content,
    #scheduleCheckModal .modal-content {
        width: 100%;
        max-width: 520px;
        margin: auto;
        border-radius: 18px;
        animation: quickModalSlideUp 0.25s ease-out;
        overflow: hidden;
    }

    /* =========================
       EDIT CORE (EditCore.cshtml) – MOBILE POLISH
       ========================= */

    .editcore-page-wrap {
        padding: 0 12px;
    }

        .editcore-page-wrap .card {
            border-radius: 16px;
            overflow: hidden; /* FIX: header bleed + border bleed */
            box-shadow: 0 2px 12px rgba(0,0,0,.08);
        }

    .dark-mode .editcore-page-wrap .card {
        box-shadow: 0 2px 14px rgba(0,0,0,.35);
    }

    .editcore-page-wrap .card-header {
        font-weight: 800;
        font-size: 1.05rem;
        padding: 12px 14px;
    }

    .editcore-page-wrap .card-body {
        padding: 14px;
    }

    .editcore-page-wrap .row > [class^="col-"],
    .editcore-page-wrap .row > [class*=" col-"] {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }

    .editcore-page-wrap .form-label {
        font-size: .95rem;
        font-weight: 700;
        margin-bottom: 6px;
    }

    .editcore-page-wrap input.form-control,
    .editcore-page-wrap select.form-select,
    .editcore-page-wrap textarea.form-control {
        font-size: 1.05rem;
        padding: 12px 12px;
        border-radius: 12px;
    }

    .editcore-page-wrap .form-check-input {
        width: 1.25rem;
        height: 1.25rem;
        transform: scale(1.15);
    }

    .editcore-page-wrap .btn,
    .editcore-page-wrap .btn.btn-sm {
        font-size: 1rem;
        padding: 10px 14px;
        border-radius: 12px;
    }

    .editcore-page-wrap button[type="submit"].btn-primary {
        width: 100%;
        padding: 12px 14px;
        border-radius: 14px;
        font-weight: 800;
    }

    /* =========================
       ACCESS DENIED – MOBILE
       ========================= */

    .access-denied-card {
        max-width: 100%;
        margin: 0 12px;
        padding: 20px !important;
        border-radius: 16px;
        overflow: hidden;
    }

        .access-denied-card .display-4 {
            font-size: 3rem;
            margin-bottom: 12px;
        }

        .access-denied-card .card-title {
            font-size: 1.6rem;
            margin-bottom: 12px;
        }

        .access-denied-card .card-text {
            font-size: 1.05rem;
            line-height: 1.5;
        }

        .access-denied-card code {
            display: inline-block;
            word-break: break-all;
            font-size: 0.9rem;
            padding: 4px 6px;
            border-radius: 6px;
            background: rgba(0,0,0,0.05);
        }

    .dark-mode .access-denied-card code {
        background: rgba(255,255,255,0.1);
    }

    #redirectCountdown {
        font-size: 1.2rem;
    }

    .access-home-btn {
        width: 100%;
        font-size: 1.1rem;
        padding: 12px 16px;
        border-radius: 12px;
    }
}

@media (max-width: 767.98px) {
    .dashboard-mobile-list {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .dashboard-site-card {
        border: 1px solid rgba(0,0,0,.08);
        border-radius: 14px;
        padding: 12px;
        background: #fff;
        box-shadow: 0 2px 10px rgba(0,0,0,.06);
        cursor: pointer;
        overflow: hidden;
        background-clip: padding-box;
    }

    .dark-mode .dashboard-site-card {
        background: #2b2b2b;
        border-color: #444;
        box-shadow: 0 2px 10px rgba(0,0,0,.35);
    }

    .dashboard-site-title {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
        font-weight: 800;
    }

    .dashboard-site-code {
        white-space: nowrap;
        font-weight: 900;
    }

    .dashboard-site-name {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-weight: 800;
    }

    .dashboard-site-meta {
        font-size: .95rem;
        color: rgba(0,0,0,.65);
    }

    .dark-mode .dashboard-site-meta {
        color: rgba(255,255,255,.7);
    }

    /* Keep emergency border on mobile in both modes */
    .dashboard-site-card.emergency-card {
        border: 2px solid rgba(220,53,69,.95) !important;
    }

    .dashboard-chart-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        justify-content: stretch;
    }

    .dashboard-chart-actions .btn {
        flex: 1 1 auto;
    }

    .dashboard-mobile-list {
        display: flex;
        flex-direction: column;
        gap: 15px; /* was ~12px, this is +3px */
    }
}
@media (max-width: 767.98px) {

    .login-page-wrap {
        min-height: calc(100vh - 64px);
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 12px;
    }

    .login-card {
        width: 100%;
        max-width: 520px;
        border-radius: 18px;
        overflow: hidden;
    }

        .login-card .card-body {
            padding: 18px;
        }

    .login-icon {
        font-size: 2.2rem;
        line-height: 1;
        margin-bottom: 6px;
    }

    .login-card h2 {
        font-size: 1.5rem;
        font-weight: 800;
    }

    .login-card .form-label {
        font-weight: 700;
        margin-bottom: 6px;
    }

    .login-card .form-control {
        font-size: 1.05rem;
        padding: 12px 12px;
        border-radius: 12px;
    }

    .login-card .pw-toggle-btn {
        min-width: 54px;
        border-radius: 12px;
        font-size: 1.1rem;
    }

    .login-submit-btn {
        margin-top: 14px;
        padding: 12px 14px;
        border-radius: 14px;
        font-size: 1.05rem;
        font-weight: 800;
    }

    .dark-mode .login-card {
        background: #1f1f1f;
        color: #f3f3f3;
        border: 1px solid #2f2f2f;
    }

        .dark-mode .login-card .form-control {
            background: #151515;
            color: #f3f3f3;
            border-color: #2f2f2f;
        }

        .dark-mode .login-card .pw-toggle-btn {
            border-color: #3a3a3a;
        }
}

/* =========================
   NOTIFICATIONS MODAL – MOBILE FRIENDLY
   ========================= */
@media (max-width: 767.98px) {

    /* Center modal vertically + add side padding */
    #notificationsModal .modal-dialog {
        display: flex;
        align-items: center;
        min-height: 100vh;
        margin: 0;
        padding: 0 12px;
    }

    /* Modal sizing */
    #notificationsModal .modal-content {
        width: 100%;
        max-width: 520px;
        margin: auto;
        border-radius: 18px;
        animation: quickModalSlideUp 0.25s ease-out;
    }

    /* Header */
    #notificationsModal .modal-header {
        padding: 14px 16px;
    }

    #notificationsModal .modal-title {
        font-size: 1.25rem;
        font-weight: 800;
    }

    /* Body scrolls nicely on long lists */
    #notificationsModal .modal-body {
        padding: 12px 14px;
        max-height: 55vh;
        overflow-y: auto;
    }

    /* Notifications list items */
    #notificationsModal .list-group-item {
        border-radius: 12px;
        margin-bottom: 8px;
        padding: 12px;
        font-size: 1rem;
    }

    /* Footer buttons stack nicely */
    #notificationsModal .modal-footer {
        padding: 14px;
        gap: 10px;
        flex-wrap: wrap;
    }

        #notificationsModal .modal-footer .btn {
            flex: 1;
            font-size: 1rem;
            padding: 10px 14px;
            border-radius: 12px;
        }

    /* Dark mode polish */
    .dark-mode #notificationsModal .modal-content {
        background-color: #1f1f1f;
        border: 1px solid #2f2f2f;
    }

    .dark-mode #notificationsModal .list-group-item {
        backgr
