
/* =====================================================
   AHSAN JEWELERS
   RESPONSIVE STYLESHEET
   Mobile | Tablet | Desktop
   Theme colors are controlled by style.css
===================================================== */

/* -----------------------------
   GLOBAL RESPONSIVE SETTINGS
----------------------------- */

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

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

input,
select,
textarea,
button {
    max-width: 100%;
}

.mobile-menu-toggle {
    display: none;
}

.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive > .table {
    min-width: 640px;
    margin-bottom: 0;
}

.page-content,
.main-area,
.topbar,
.panel,
.stat-card {
    min-width: 0;
}

/* -----------------------------
   LARGE TABLETS
   1100px and below
----------------------------- */

@media (max-width: 1100px) {

    .page-content {
        padding-left: 22px;
        padding-right: 22px;
    }

    .topbar {
        padding-left: 22px;
        padding-right: 22px;
    }

    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .content-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .category-grid,
    .report-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* -----------------------------
   TABLET AND MOBILE
   Sidebar navigation
   900px and below
----------------------------- */

@media (max-width: 900px) {

    .mobile-menu-toggle {
        display: inline-flex;
        flex: 0 0 42px;
        width: 42px;
        height: 42px;
        align-items: center;
        justify-content: center;
        border: 1px solid currentColor;
        border-radius: 9px;
        background: #ded2bd;
        color: inherit;
        font-size: 19px;
        cursor: pointer;
        transition: opacity 0.2s ease;
    }

    .mobile-menu-toggle:hover {
        opacity: 0.8;
    }

    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(290px, 86vw);
        max-width: 86vw;
        height: 100vh;
        height: 100dvh;
        padding: 20px 16px 18px !important;
        border-radius: 0 15px 15px 0;
        align-items: stretch !important;

        transform: translateX(-105%);
        visibility: hidden;

        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;

        z-index: 1100;

        box-shadow: 8px 0 28px rgba(0, 0, 0, 0.14);

        transition:
            transform 0.25s ease,
            visibility 0.25s ease;
    }

    .sidebar.is-open {
        transition:0.5s;
        transform: translateX(0);
        visibility: visible;
        
    }

    .sidebar .brandLogo,
    .sidebar .brand-logo {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
    }

    .sidebar .brand-logo img,
    .sidebar .brandLogo img {
        width: 108px;
        max-width: 100%;
        height: auto;
        object-fit: contain;
    }

    .sidebar .brand-name,
    .sidebar .menu-heading,
    .sidebar .menu-item span {
        display: initial !important;
    }

    .sidebar .menu-heading {
        display: block !important;
    }

    .sidebar .menu-item {
        display: flex;
        align-items: center;
        justify-content: flex-start !important;
        gap: 12px;
        padding: 12px !important;
        width: 100%;
    }

    .sidebar .menu-item i {
        flex: 0 0 20px;
        width: 20px;
        font-size: 15px;
        text-align: center;
    }

    .main-area {
        width: 100%;
        min-width: 0;
        margin-left: 0 !important;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1090;

        background: #ded2bd;

        opacity: 0;
        visibility: hidden;
        pointer-events: none;

        transition:
            opacity 0.2s ease,
            visibility 0.2s ease;
    }

    .sidebar-backdrop.is-visible {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    .topbar {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 12px;
    }

    .topbar-title {
        flex: 1 1 auto;
        min-width: 0;
    }

    .topbar-right {
        display: flex;
        align-items: center;
        gap: 12px;
        min-width: 0;
    }

    .table-responsive {
        margin-bottom: 12px;
    }
}

/* -----------------------------
   MOBILE
   650px and below
----------------------------- */

@media (max-width: 650px) {

    .topbar {
        min-height: 66px;
        padding: 11px 14px;
        gap: 9px;
    }

    .mobile-menu-toggle {
        flex-basis: 38px;
        width: 38px;
        height: 38px;
        font-size: 17px;
    }

    .topbar-title {
        flex: 1 1 auto;
        min-width: 0;
    }

    .topbar-title h2 {
        font-size: 16px;
        line-height: 1.3;
        margin-bottom: 2px;
    }

    .topbar-title p {
        font-size: 10px;
        line-height: 1.4;
    }

    .topbar-right {
        width: auto;
        flex-wrap: wrap;
        justify-content: flex-end;
        gap: 8px;
    }

    .top-date {
        display: none;
    }

    .admin-chip {
        gap: 6px;
        min-width: 0;
    }

    .page-content {
        padding: 17px 13px 14px;
    }

    .page-heading {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 10px;
    }

    .page-heading h1 {
        font-size: 25px;
        line-height: 1.3;
    }

    .page-heading p {
        font-size: 13px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .stat-card {
        min-width: 0;
        padding: 13px 10px;
        gap: 9px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        flex: 0 0 36px;
        font-size: 15px;
    }

    .stat-card h3 {
        font-size: 16px;
        overflow-wrap: anywhere;
    }

    .stat-card span,
    .stat-card small {
        overflow-wrap: anywhere;
    }

    .toolbar {
        display: flex;
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .toolbar .form-select,
    .toolbar .form-control {
        width: 100%;
        max-width: none;
    }

    .panel {
        padding: 14px;
        min-width: 0;
    }

    .panel-head {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 10px;
    }

    .form-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 14px;
    }

    .category-grid,
    .report-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .form-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }

    .form-actions > * {
        max-width: 100%;
    }

    .login-page {
        min-height: 100vh;
        min-height: 100svh;
        padding: 16px;
        background-attachment: scroll;
        background-position: center center;
    }

    .login-wrap {
        width: min(100%, 440px);
    }

    .login-card {
        width: 100%;
        padding: 26px 20px;
    }

    .login-logo img {
        width: 125px;
        height: auto;
    }

    .login-card h1 {
        font-size: 30px;
    }

    .login-options {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
    }

    .login-options input {
        margin-left: 0;
    }

    .page-footer {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        text-align: center;
    }

    .table {
        font-size: 12px;
    }

    .table td,
    .table th {
        white-space: nowrap;
    }

    .modal-dialog {
        margin: 10px;
    }

    .modal-content {
        max-width: calc(100vw - 20px);
    }

    .btn {
        max-width: 100%;
    }
}

/* -----------------------------
   SMALL MOBILE
   420px and below
----------------------------- */

@media (max-width: 420px) {

    .topbar {
        min-height: 62px;
        padding: 10px;
        gap: 8px;
    }

    .topbar-title h2 {
        font-size: 14px;
    }

    .topbar-title p {
        font-size: 9px;
    }

    .topbar-right {
        gap: 7px;
    }

    .admin-chip {
        font-size: 12px;
    }

    .page-content {
        padding-left: 10px;
        padding-right: 10px;
    }

    .page-heading h1 {
        font-size: 22px;
    }

    .stats-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .category-grid,
    .report-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .login-card {
        padding: 22px 16px;
    }

    .panel {
        padding: 12px;
    }

    .btn {
        white-space: normal;
    }

    .sidebar {
        width: min(275px, 88vw);
    }
}

/* -----------------------------
   LANDSCAPE MOBILE
----------------------------- */

@media (max-width: 900px) and (orientation: landscape) {

    .sidebar {
        padding-top: 12px !important;
        padding-bottom: 12px !important;
    }

    .sidebar .menu-item {
        padding-top: 9px !important;
        padding-bottom: 9px !important;
    }

    .login-page {
        align-items: flex-start;
    }
}

/* -----------------------------
   ACCESSIBILITY
   Reduced motion preference
----------------------------- */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
