/* GESTION LOCATIVE MOBILE
   Important : toutes les modifications d'interface sont dans max-width:1024px.
   Le desktop reste géré par app.css / app_modules.css.
*/

.mobile-topbar,
.mobile-menu-panel,
.mobile-menu-backdrop,
.gestion-mobile-page {
    display: none;
}

/* Correction connexion uniquement mobile */
@media (max-width:768px) {
    body.auth-page {
        min-height: 100svh !important;
        padding: 24px 14px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background-attachment: scroll !important;
    }

    body.auth-page .auth-card {
        width: min(100%, 520px) !important;
        margin: 0 auto !important;
        padding: 28px 22px !important;
        border-radius: 24px !important;
    }
}

/* Menu mobile uniquement */
@media (max-width:1024px) {
    body.has-mobile-menu {
        padding-top: 70px !important;
        overflow-x: hidden !important;
    }

    body.has-mobile-menu .mobile-topbar {
        display: flex !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 70px;
        z-index: 100000;
        align-items: center;
        gap: 12px;
        padding: 10px 14px;
        background: #0f1f38;
        color: #fff;
        box-shadow: 0 8px 24px rgba(15,23,42,.28);
    }

    .mobile-menu-button {
        width: 46px;
        height: 46px;
        border: 0;
        border-radius: 14px;
        background: #2563eb;
        color: #fff;
        font-size: 24px;
        font-weight: 900;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-brand {
        display: flex;
        flex-direction: column;
        line-height: 1.1;
        font-size: 17px;
        font-weight: 900;
    }

    .mobile-brand small {
        color: rgba(255,255,255,.72);
        font-size: 12px;
        margin-top: 3px;
    }

    .mobile-menu-backdrop.open {
        display: block !important;
        position: fixed;
        inset: 0;
        z-index: 100001;
        background: rgba(15,23,42,.50);
    }

    .mobile-menu-panel {
        position: fixed;
        top: 0;
        left: 0;
        width: min(86vw, 340px);
        height: 100vh;
        z-index: 100002;
        background: #0f1f38;
        color: #fff;
        padding: 18px;
        transform: translateX(-110%);
        transition: transform .22s ease;
        display: block !important;
        box-shadow: 18px 0 45px rgba(0,0,0,.35);
    }

    .mobile-menu-panel.open {
        transform: translateX(0);
    }

    .mobile-menu-title {
        font-size: 20px;
        font-weight: 950;
        margin-bottom: 18px;
    }

    .mobile-menu-links {
        display: grid;
        gap: 10px;
    }

    .mobile-menu-links a {
        display: flex;
        align-items: center;
        gap: 10px;
        min-height: 46px;
        padding: 10px 12px;
        border-radius: 14px;
        color: #fff;
        text-decoration: none;
        font-weight: 850;
        background: rgba(255,255,255,.08);
    }

    .mobile-menu-links a.active,
    .mobile-menu-links a:hover {
        background: rgba(37,99,235,.9);
    }

    body.has-mobile-menu .sidebar,
    body.has-mobile-menu .app-sidebar,
    body.has-mobile-menu .layout-sidebar,
    body.has-mobile-menu aside.sidebar,
    body.has-mobile-menu nav.sidebar {
        display: none !important;
    }

    body.has-mobile-menu .main-content {
        margin-left: 0 !important;
        max-width: 100% !important;
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    body.has-mobile-menu .app-shell {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    .gestion-mobile-page {
        display: block;
    }

    .desktop-only-warning {
        display: none !important;
    }

    .gestion-title {
        font-size: 24px;
        font-weight: 950;
        color: #0f172a;
        margin: 14px 0 16px;
    }

    .mobile-section {
        background: rgba(255,255,255,.96);
        border: 1px solid rgba(226,232,240,.9);
        border-radius: 22px;
        overflow: hidden;
        box-shadow: 0 14px 34px rgba(15,23,42,.12);
        margin-bottom: 16px;
    }

    .mobile-section-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 13px 14px;
        border-bottom: 1px solid #e2e8f0;
        background: linear-gradient(180deg,#fff,#fbfdff);
    }

    .mobile-section-title {
        font-size: 17px;
        font-weight: 950;
        color: #0f172a;
        margin: 0;
    }

    .mobile-add-btn {
        width: 36px;
        height: 36px;
        border-radius: 12px;
        border: 0;
        background: #2563eb;
        color: #fff;
        font-size: 22px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        font-weight: 900;
    }

    .apart-table {
        width: 100%;
        table-layout: fixed;
        font-size: 11px;
        margin: 0;
    }

    .apart-table th,
    .apart-table td {
        padding: 8px 5px !important;
        vertical-align: middle;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .apart-table th {
        background: #f8fafc;
        color: #334155;
        font-weight: 950;
    }

    .apart-ref { width: 18%; font-weight: 950; color:#0f172a; }
    .apart-type { width: 26%; }
    .apart-cap { width: 10%; text-align:center; }
    .apart-icon { width: 13%; text-align:center; }
    .apart-detail { width: 17%; text-align:center; }

    .icon-mini {
        display: inline-flex;
        width: 31px;
        height: 30px;
        border-radius: 9px;
        align-items: center;
        justify-content: center;
        border: 1px solid #cbd5e1;
        background: #fff;
        text-decoration: none;
        font-size: 14px;
    }

    .detail-mini {
        min-height: 30px !important;
        padding: 3px 7px !important;
        border-radius: 9px !important;
        font-size: 11px !important;
    }

    .calendar-controls {
        padding: 13px 14px;
        display: grid;
        gap: 10px;
        border-bottom: 1px solid #e2e8f0;
    }

    .calendar-controls label {
        font-size: 11px;
        font-weight: 900;
        color: #64748b;
        text-transform: uppercase;
        letter-spacing: .03em;
    }

    .calendar-nav {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
        gap: 8px;
    }

    .calendar-nav a {
        border: 1px solid #cbd5e1;
        background: #fff;
        color: #0f172a;
        border-radius: 12px;
        padding: 9px 8px;
        font-weight: 850;
        font-size: 12px;
        text-align: center;
        text-decoration: none;
    }

    .calendar-month {
        font-size: 16px;
        font-weight: 950;
        color: #0f172a;
        text-align: center;
        min-width: 92px;
    }

    .calendar-legend {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px 14px;
        border-bottom: 1px solid #e2e8f0;
        font-size: 11px;
        font-weight: 850;
        color: #475569;
    }

    .legend-pill { display:inline-flex; align-items:center; gap:6px; }
    .legend-color { width:22px; height:7px; border-radius:999px; display:inline-block; }

    .month-grid {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        background: #e2e8f0;
        gap: 1px;
    }

    .weekday {
        background: #f8fafc;
        padding: 7px 3px;
        text-align: center;
        font-size: 10px;
        font-weight: 950;
        color: #334155;
    }

    .week-row {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        background: #e2e8f0;
        gap: 1px;
        position: relative;
    }

    .month-day {
        min-height: 72px;
        background: rgba(255,255,255,.96);
        padding: 5px 4px;
        position: relative;
    }

    .month-day.muted {
        background: rgba(248,250,252,.78);
        color: #94a3b8;
    }

    .month-day.today {
        outline: 2px solid #2563eb;
        outline-offset: -2px;
        background: #eff6ff;
    }

    .day-num {
        font-size: 11px;
        font-weight: 950;
        color: #0f172a;
    }

    .event-bar {
        position: absolute;
        height: 24px;
        border-radius: 999px;
        color: #fff;
        font-size: 11px;
        font-weight: 900;
        line-height: 24px;
        padding: 0 9px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        z-index: 5;
        text-decoration: none;
        box-shadow: 0 6px 14px rgba(15,23,42,.18);
    }

    .event-confirmed { background: linear-gradient(135deg,#16a34a,#15803d); }
    .event-option { background: linear-gradient(135deg,#f59e0b,#f97316); }
    .event-past { background: linear-gradient(135deg,#374151,#111827); }

    .reserv-list {
        display: grid;
        gap: 8px;
        padding: 12px;
    }

    .reserv-item {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 8px;
        align-items: center;
        border: 1px solid #e2e8f0;
        border-radius: 14px;
        padding: 10px;
        background: #fff;
        text-decoration: none;
        color: inherit;
    }

    .reserv-title {
        font-size: 14px;
        font-weight: 950;
        color: #0f172a;
    }

    .reserv-sub {
        font-size: 12px;
        color: #64748b;
        font-weight: 750;
        margin-top: 2px;
    }

    .status-dot {
        width: 10px;
        height: 10px;
        border-radius: 999px;
        display: inline-block;
        margin-right: 5px;
    }

    .drawer-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15,23,42,.50);
        z-index: 120000;
    }

    .drawer-overlay.open { display:block; }

    .gestion-drawer {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        max-height: 84vh;
        overflow-y: auto;
        background: #fff;
        z-index: 120001;
        border-radius: 22px 22px 0 0;
        padding: 18px;
        transform: translateY(110%);
        transition: transform .22s ease;
        box-shadow: 0 -18px 50px rgba(15,23,42,.32);
    }

    .gestion-drawer.open { transform: translateY(0); }

    .drawer-handle {
        width: 44px;
        height: 5px;
        border-radius: 999px;
        background: #cbd5e1;
        margin: 0 auto 14px;
    }

    .drawer-title {
        font-size: 20px;
        font-weight: 950;
        color: #0f172a;
        margin-bottom: 4px;
    }

    .drawer-subtitle {
        font-size: 13px;
        font-weight: 750;
        color: #64748b;
        margin-bottom: 14px;
    }

    .drawer-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px 14px;
        margin-bottom: 16px;
    }

    .drawer-label {
        display: block;
        font-size: 11px;
        font-weight: 900;
        color: #64748b;
        text-transform: uppercase;
        letter-spacing: .03em;
        margin-bottom: 3px;
    }

    .drawer-value {
        display: block;
        font-size: 14px;
        font-weight: 850;
        color: #0f172a;
        word-break: break-word;
    }

    .drawer-actions {
        display: grid;
        gap: 9px;
    }

    .drawer-actions a,
    .drawer-actions button {
        min-height: 42px;
        width: 100%;
        border-radius: 12px;
    }
}

/* Si la page Gestion locative est ouverte sur ordinateur */
@media (min-width:1025px) {
    .desktop-only-warning {
        display: block;
        background: #fff3cd;
        border: 1px solid #ffe69c;
        color: #664d03;
        padding: 14px;
        border-radius: 12px;
        font-weight: 750;
    }
}