/* ==========================================================================
   REOG PONOROGO HERITAGE SYSTEM - MASTER COMPACT RESPONSIVE STYLESHEET
   Mobile Breakpoints: 360x800, 390x844, 430x932, <=380px
   ========================================================================== */

/* Prevent Horizontal Body Overflow */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

img, video, canvas, svg {
    max-width: 100%;
    height: auto;
}

* {
    min-width: 0;
}

/* Global Table Responsive Container */
.table-responsive {
    width: 100%;
    margin-bottom: 0.75rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
}

.table-responsive .table {
    margin-bottom: 0;
    white-space: nowrap;
}

/* ==========================================================================
   GLOBAL PAGUYUBAN CARD STYLES
   ========================================================================== */
.card-paguyuban {
    border-radius: 16px;
    overflow: hidden;
    border: none;
    background-color: #ffffff;
    box-shadow: 0 8px 24px rgba(0,0,0,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    height: auto !important;
    display: flex;
    flex-direction: column;
}

.card-paguyuban:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.08);
}

.paguyuban-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background-color: #f3f4f6;
    flex-shrink: 0;
}

.paguyuban-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.paguyuban-image-wrapper .verified-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(34, 197, 94, 0.95);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 999px;
    padding: 4px 10px;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.paguyuban-image-wrapper .status-badge {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background-color: rgba(15, 23, 42, 0.85);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 999px;
    padding: 4px 10px;
    z-index: 2;
}

.paguyuban-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: visible;
}

.paguyuban-name {
    font-size: 1.05rem;
    line-height: 1.35;
    font-weight: 700;
    color: #111827;
    margin: 0 0 6px 0;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}

.paguyuban-meta {
    font-size: 0.8rem;
    color: #6b7280;
    margin-bottom: 8px;
    line-height: 1.4;
}

.paguyuban-description {
    font-size: 0.825rem;
    line-height: 1.45;
    color: #4b5563;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.paguyuban-link {
    font-size: 0.85rem;
    font-weight: 600;
    color: #c79a28;
    text-decoration: none;
    margin-top: auto;
    display: inline-flex;
    align-items: center;
}

.paguyuban-link:hover {
    color: #b18417;
    text-decoration: underline;
}

/* ==========================================================================
   TABLET & MOBILE BREAKPOINT (< 992px) - LEFT DRAWER SIDEBARS & NAV
   ========================================================================== */
@media (max-width: 991.98px) {
    /* Navbar Main Mobile Adjustments */
    .navbar-main {
        min-height: 56px;
        padding-top: 4px !important;
        padding-bottom: 4px !important;
    }

    .navbar-main .brand-box {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.9rem !important;
        border-radius: 8px !important;
    }

    .navbar-main .brand-title {
        font-size: 0.95rem !important;
        line-height: 1.2 !important;
    }

    .navbar-main .brand-subtitle {
        font-size: 0.65rem !important;
        line-height: 1 !important;
    }

    .navbar-main .navbar-toggler {
        width: 36px !important;
        height: 36px !important;
        padding: 4px !important;
        font-size: 1.1rem !important;
    }

    .navbar-main .navbar-collapse {
        background-color: #fdfaf2;
        padding: 0.75rem 1rem !important;
        border-radius: 12px;
        margin-top: 0.4rem;
        box-shadow: 0 8px 20px rgba(0,0,0,0.06);
    }

    .navbar-main .nav-link {
        padding: 0.45rem 0.5rem !important;
        font-size: 0.85rem !important;
        border-bottom: 1px dashed #e5e7eb;
    }

    .navbar-main .nav-item:last-child .nav-link {
        border-bottom: none;
    }

    /* ==========================================================
       USER PANEL: LEFT DRAWER SIDEBAR (SLIDE FROM LEFT)
       ========================================================== */
    .user-shell {
        flex-direction: column !important;
    }

    .ud-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        height: 100vh !important;
        width: 270px !important;
        max-width: 82vw !important;
        z-index: 1050 !important;
        background: #ffffff !important;
        box-shadow: 4px 0 25px rgba(0,0,0,0.15) !important;
        transform: translateX(-100%) !important;
        transition: transform 0.28s ease-in-out !important;
        overflow-y: auto !important;
        padding: 16px !important;
        display: flex !important;
        flex-direction: column !important;
        border-right: 1px solid var(--border-subtle, #e5e7eb) !important;
    }

    .ud-sidebar.show {
        transform: translateX(0) !important;
    }

    .ud-sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        backdrop-filter: blur(2px);
        z-index: 1040;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.28s ease, visibility 0.28s ease;
    }

    .ud-sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    .ud-brand {
        margin-bottom: 12px !important;
        gap: 10px !important;
    }

    .ud-brand-icon {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.95rem !important;
        border-radius: 8px !important;
    }

    .ud-sidebar .brand-title {
        font-size: 0.95rem !important;
    }

    .ud-sidebar .brand-subtitle {
        font-size: 0.7rem !important;
    }

    .ud-nav {
        display: flex !important;
        flex-direction: column !important;
        gap: 4px !important;
        margin-top: 8px !important;
    }

    .ud-nav li a, 
    .ud-nav li button {
        padding: 9px 12px !important;
        margin-bottom: 0 !important;
        font-size: 0.85rem !important;
        border-radius: 10px !important;
        min-height: 40px !important;
        width: 100% !important;
    }

    .ud-nav li .icon {
        width: 24px !important;
        height: 24px !important;
        font-size: 0.8rem !important;
    }

    .ud-sidebar-footer {
        margin-top: 12px !important;
        padding-top: 10px !important;
        border-top: 1px dashed var(--border-subtle, #e5e7eb) !important;
    }

    .ud-main {
        padding: 12px 12px !important;
    }

    /* ==========================================================
       ADMIN PANEL: LEFT DRAWER SIDEBAR (SLIDE FROM LEFT)
       ========================================================== */
    .admin-shell {
        flex-direction: column !important;
    }

    .admin-sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        height: 100vh !important;
        width: 270px !important;
        max-width: 82vw !important;
        z-index: 1050 !important;
        background: #ffffff !important;
        box-shadow: 4px 0 25px rgba(0,0,0,0.15) !important;
        transform: translateX(-100%) !important;
        transition: transform 0.28s ease-in-out !important;
        overflow-y: auto !important;
        padding: 16px !important;
        display: flex !important;
        flex-direction: column !important;
        border-right: 1px solid var(--border-subtle, #e5e7eb) !important;
    }

    .admin-sidebar.show {
        transform: translateX(0) !important;
    }

    .admin-sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        backdrop-filter: blur(2px);
        z-index: 1040;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.28s ease, visibility 0.28s ease;
    }

    .admin-sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    .admin-brand {
        margin-bottom: 12px !important;
        gap: 10px !important;
    }

    .admin-brand-icon {
        width: 34px !important;
        height: 34px !important;
        font-size: 16px !important;
    }

    .admin-brand-title {
        font-size: 0.95rem !important;
    }

    .admin-brand-subtitle {
        font-size: 0.7rem !important;
    }

    .admin-nav {
        display: flex !important;
        flex-direction: column !important;
    }

    .admin-nav .nav-link {
        padding: 8px 12px !important;
        font-size: 0.825rem !important;
        border-radius: 10px !important;
        margin-bottom: 4px !important;
        min-height: 38px !important;
    }

    .admin-nav .nav-link .icon-pill {
        width: 28px !important;
        height: 28px !important;
        font-size: 13px !important;
    }

    .admin-sidebar-footer {
        margin-top: 12px !important;
        padding-top: 10px !important;
        border-top: 1px dashed var(--border-subtle, #e5e7eb) !important;
    }

    .admin-main {
        padding: 12px 12px !important;
    }
}

/* ==========================================================================
   MOBILE BREAKPOINT (< 768px) - TOTAL COMPACT OVERRIDES
   ========================================================================== */
@media (max-width: 767.98px) {

    /* Container Padding */
    .container, .container-fluid {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* Strict Spacing Overrides */
    section {
        padding-top: 20px !important;
        padding-bottom: 20px !important;
    }

    .py-5 {
        padding-top: 1.25rem !important; /* 20px */
        padding-bottom: 1.25rem !important;
    }

    .py-4 {
        padding-top: 1rem !important; /* 16px */
        padding-bottom: 1rem !important;
    }

    .py-3 {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }

    .my-5 {
        margin-top: 1.25rem !important;
        margin-bottom: 1.25rem !important;
    }

    .mb-5 {
        margin-bottom: 1rem !important;
    }

    .mb-4 {
        margin-bottom: 0.75rem !important;
    }

    .mb-3 {
        margin-bottom: 0.6rem !important;
    }

    .p-5 {
        padding: 0.85rem !important;
    }

    .p-4 {
        padding: 0.75rem !important;
    }

    .gap-4 {
        gap: 0.5rem !important;
    }

    .gap-5 {
        gap: 0.75rem !important;
    }

    /* Strict Typography Hierarchy */
    body {
        font-size: 13.5px !important;
        line-height: 1.45 !important;
    }

    h1, .h1, .hero-title {
        font-size: 23px !important;
        line-height: 1.25 !important;
        font-weight: 700 !important;
    }

    h2, .h2, .section-title, .admin-page-title {
        font-size: 18px !important;
        line-height: 1.3 !important;
        font-weight: 700 !important;
    }

    h3, .h3 {
        font-size: 16px !important;
        line-height: 1.3 !important;
    }

    h4, .h4 {
        font-size: 15px !important;
    }

    h5, .h5 {
        font-size: 14px !important;
    }

    h6, .h6 {
        font-size: 13px !important;
    }

    p, .text-muted {
        font-size: 13px !important;
    }

    .small, small {
        font-size: 11.5px !important;
    }

    /* Compact Buttons Mobile */
    .btn {
        font-size: 12.5px !important;
        padding: 7px 11px !important;
        min-height: 36px !important;
        border-radius: 8px !important;
    }

    .btn-sm {
        font-size: 11px !important;
        padding: 4px 8px !important;
        min-height: 30px !important;
        border-radius: 6px !important;
    }

    .btn-gold, .btn-outline-gold {
        padding: 7px 12px !important;
        font-size: 12px !important;
        border-radius: 8px !important;
    }

    /* Form Controls Mobile */
    .form-control, .form-select, .input-group-text {
        font-size: 13px !important;
        padding: 7px 10px !important;
        min-height: 38px !important;
        border-radius: 8px !important;
    }

    .form-label {
        font-size: 12px !important;
        margin-bottom: 3px !important;
        font-weight: 500 !important;
    }

    /* Hero Image & Overlay Fixes */
    .col-lg-6 img[alt="Reog Ponorogo"],
    .hero-image {
        max-height: 210px !important;
        height: 210px !important;
        width: 100% !important;
        object-fit: cover !important;
        border-radius: 12px !important;
    }

    .hero-stat-badge-floating {
        position: relative !important;
        left: 0 !important;
        transform: none !important;
        margin: 8px 0 0 0 !important;
        width: 100% !important;
        padding: 8px 12px !important;
        border-radius: 10px !important;
    }

    /* Cards Mobile Scaling */
    .card {
        border-radius: 12px !important;
    }

    .card-body {
        padding: 12px 14px !important;
    }

    /* Paguyuban Cards Mobile Compact */
    .card-paguyuban {
        border-radius: 14px !important;
        margin-bottom: 12px !important;
        height: auto !important;
    }

    .paguyuban-image-wrapper {
        aspect-ratio: 16 / 9 !important;
        height: auto !important;
        width: 100% !important;
    }

    .paguyuban-image-wrapper img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    .paguyuban-image-wrapper .verified-badge {
        font-size: 0.65rem !important;
        padding: 3px 8px !important;
        top: 8px !important;
        left: 8px !important;
    }

    .paguyuban-content {
        padding: 12px !important;
    }

    .paguyuban-name {
        font-size: 14.5px !important;
        line-height: 1.35 !important;
        margin-bottom: 4px !important;
        font-weight: 700 !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
        white-space: normal !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        min-height: 2.7em !important;
        height: auto !important;
    }

    .paguyuban-meta {
        font-size: 11.5px !important;
        margin-bottom: 6px !important;
        line-height: 1.35 !important;
    }

    .paguyuban-description {
        font-size: 11.5px !important;
        line-height: 1.4 !important;
        margin-bottom: 10px !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }

    .paguyuban-link {
        font-size: 11.5px !important;
        font-weight: 600 !important;
    }

    .card-berita img,
    .news-thumb {
        height: 135px !important;
        object-fit: cover !important;
    }

    .card-berita > div:first-child {
        height: 135px !important;
    }

    .stat-card {
        padding: 10px 8px !important;
        border-radius: 10px !important;
    }

    .stat-card h3, .dash-number {
        font-size: 21px !important;
        line-height: 1.1 !important;
    }

    .stat-card .fs-3 {
        font-size: 1.25rem !important;
    }

    .stat-card small, .dash-label {
        font-size: 11px !important;
    }

    .dash-card {
        padding: 12px 14px !important;
        border-radius: 12px !important;
    }

    /* Auth Login & Register Cards */
    .login-card {
        max-width: 350px !important;
        width: 100% !important;
        padding: 18px 16px !important;
        border-radius: 16px !important;
        margin: 0 auto !important;
    }

    .login-title {
        font-size: 22px !important;
    }

    .login-subtitle {
        font-size: 12px !important;
        margin-bottom: 12px !important;
    }

    .login-shell {
        min-height: auto !important;
        padding: 18px 0 !important;
    }

    /* News Page 2-Column Grid Mobile Adjustment */
    .news-row {
        border-radius: 12px !important;
        overflow: hidden !important;
        box-shadow: 0 4px 14px rgba(0,0,0,0.05) !important;
        background: #ffffff !important;
        margin-bottom: 0 !important;
    }

    .news-thumb-wrapper {
        width: 100% !important;
        min-width: 0 !important;
        aspect-ratio: 16 / 9 !important;
        height: auto !important;
        overflow: hidden !important;
        position: relative !important;
    }

    .news-thumb-wrapper img, .news-thumb {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
    }

    .news-ribbon {
        font-size: 8px !important;
        padding: 2px 6px !important;
    }

    .news-content {
        padding: 10px 10px 12px !important;
    }

    .news-meta {
        font-size: 10px !important;
        margin-bottom: 4px !important;
    }

    .news-item-title {
        font-size: 12.5px !important;
        line-height: 1.35 !important;
        font-weight: 700 !important;
        margin-bottom: 4px !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 3 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }

    .news-read-more {
        font-size: 10.5px !important;
        font-weight: 600 !important;
    }

    /* Tables Font & Cell Padding */
    .table td, .table th {
        padding: 6px 8px !important;
        font-size: 11.5px !important;
    }

    /* Modals Compact */
    .modal-dialog {
        margin: 12px !important;
        max-width: calc(100% - 24px) !important;
    }

    .modal-content {
        padding: 12px !important;
        border-radius: 12px !important;
    }

    /* Footer Mobile */
    footer, .footer {
        padding: 20px 0 16px !important;
        margin-top: 30px !important;
    }

    /* Horizontal Scroll Helper Utilities */
    .pg-tabs, .category-filter-container {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
    }
    .pg-tabs::-webkit-scrollbar, .category-filter-container::-webkit-scrollbar {
        display: none !important;
    }
    .pg-tabs .nav-item, .category-pill {
        flex: 0 0 auto !important;
        white-space: nowrap !important;
    }
}


/* ==========================================================================
   SMALL MOBILE BREAKPOINT (<= 380px)
   ========================================================================== */
@media (max-width: 380px) {
    .ud-sidebar, .admin-sidebar {
        width: 250px !important;
    }

    h1, .h1, .hero-title {
        font-size: 20px !important;
    }

    h2, .h2, .section-title {
        font-size: 16.5px !important;
    }

    .paguyuban-name {
        font-size: 13px !important;
        min-height: 2.7em !important;
        height: auto !important;
    }

    .news-item-title {
        font-size: 11.5px !important;
    }

    .paguyuban-content, .news-content, .card-body {
        padding: 8px 9px !important;
    }

    .btn {
        width: 100%;
        margin-bottom: 4px;
        font-size: 11.5px !important;
    }
}
