/**
 * Rida Restaurant Management Software (RRMS)
 * Modern Enterprise Responsive App Stylesheet
 */

:root {
    --rrms-primary: #d96d44;
    --rrms-primary-hover: #b8502e;
    --rrms-dark: #202a30;
    --rrms-sidebar-bg: #ffffff;
    --rrms-bg: #f8f9fa;
    --rrms-font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --rrms-serif-family: 'Playfair Display', Georgia, serif;
    --sidebar-width: 244px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--rrms-font-family);
    background-color: var(--rrms-bg);
    color: #2b353b;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.font-serif {
    font-family: var(--rrms-serif-family);
}

.cursor-pointer {
    cursor: pointer;
}

.transition-transform {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.transition-transform:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08) !important;
}

/* =========================================================
   1. MASTER WRAPPER & RESPONSIVE SIDEBAR DRAWER
   ========================================================= */
.rrms-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    background: #ffffff !important;
    color: #1e293b !important;
    border-right: 1px solid #e2e8f0 !important;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    z-index: 1050;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar .brand {
    color: #0f172a !important;
    padding-bottom: 16px;
}

.sidebar .brand small {
    color: #d96d44 !important;
    font-weight: 700;
}

.sidebar .nav-link {
    color: #475569 !important;
    border-radius: 10px;
    padding: 10px 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.15s ease;
}

.sidebar .nav-link:hover, .sidebar .nav-link.active {
    background: #fff7ed !important;
    color: #d96d44 !important;
    font-weight: 600;
}

.sidebar .nav-link.active span {
    color: #d96d44 !important;
}

.sidebar .nav-label {
    color: #94a3b8 !important;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 16px 12px 6px;
}

.sidebar-bottom {
    border-top: 1px solid #e2e8f0 !important;
    padding: 14px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-bottom strong {
    color: #0f172a !important;
    font-size: 13px;
}

.sidebar-bottom small {
    color: #64748b !important;
    font-size: 11px;
}

/* Sidebar Backdrop for Mobile/Tablet Offcanvas */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

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

.rrms-main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
    width: calc(100% - var(--sidebar-width));
    transition: margin-left 0.25s ease, width 0.25s ease;
}

/* Tablet & Mobile Breakpoints for Layout */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
        width: 280px;
        max-width: 85vw;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .rrms-main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
}

/* =========================================================
   2. TOP NAVBAR & HEADER RESPONSIVENESS
   ========================================================= */
.rrms-navbar {
    min-height: 64px;
    position: sticky;
    top: 0;
    z-index: 1020;
}

@media (max-width: 576px) {
    .rrms-navbar {
        padding: 8px 12px !important;
    }
    
    .rrms-navbar .dropdown button {
        padding: 4px 8px !important;
        font-size: 11px !important;
    }
}

/* =========================================================
   3. POS TERMINAL RESPONSIVE WORKSPACE & MENU GRID
   ========================================================= */
.pos-screen-body {
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

.pos-app-container {
    height: 100vh;
    width: 100%;
}

.pos-topbar {
    min-height: 56px;
    flex-shrink: 0;
}

.pos-workspace {
    height: calc(100vh - 56px);
}

.pos-category-tabs {
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
}

.pos-category-tabs::-webkit-scrollbar {
    display: none;
}

#menuItemsGrid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)) !important;
    gap: 14px !important;
    padding: 4px 2px 20px 2px;
}

.pos-item-col {
    width: 100% !important;
    max-width: 100% !important;
}

.menu-item-card {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #e2e8f0;
    border-radius: 14px !important;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    display: flex;
    flex-direction: column;
}

.menu-item-card:hover {
    transform: translateY(-3px);
    border-color: #d96d44;
    box-shadow: 0 10px 20px -5px rgba(217, 109, 68, 0.2), 0 4px 8px rgba(0, 0, 0, 0.04) !important;
}

.menu-item-card:active {
    transform: scale(0.98);
}

.item-image-wrapper {
    height: 140px;
    width: 100%;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
}

.item-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-item-card:hover .item-image-wrapper img {
    transform: scale(1.05);
}

.item-card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    letter-spacing: 0.3px;
    z-index: 2;
}

.item-title-pro {
    font-size: 13.5px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.35;
    min-height: 36px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 2px;
}

.pos-price-tag {
    font-size: 15px;
    font-weight: 800;
    color: #d96d44;
    letter-spacing: -0.2px;
    font-family: 'DM Sans', sans-serif;
}

.pos-add-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff2ec;
    color: #d96d44;
    border: 1.5px solid rgba(217, 109, 68, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    transition: all 0.2s ease;
}

.menu-item-card:hover .pos-add-btn {
    background: #d96d44;
    color: #ffffff;
    border-color: #d96d44;
    transform: scale(1.08);
}

.pos-cart-panel {
    width: 400px;
    min-width: 380px;
    flex-shrink: 0;
}

/* POS Tablet & Mobile Responsiveness */
@media (max-width: 992px) {
    .pos-screen-body {
        overflow: auto;
        height: auto;
        min-height: 100vh;
    }

    .pos-app-container {
        height: auto;
        min-height: 100vh;
    }

    .pos-workspace {
        height: auto;
        flex-direction: column;
    }

    .pos-topbar {
        padding: 8px 12px !important;
        flex-wrap: wrap;
        gap: 8px;
    }

    #menuItemsGrid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
        gap: 10px !important;
    }

    .item-image-wrapper {
        height: 115px !important;
    }

    .item-title-pro {
        font-size: 12.5px !important;
        min-height: 32px !important;
    }

    .pos-price-tag {
        font-size: 13.5px !important;
    }

    .pos-cart-panel {
        width: 100% !important;
        min-width: 100% !important;
        border-left: none !important;
        border-top: 1px solid #e2e8f0;
    }
}

@media (max-width: 576px) {
    #menuItemsGrid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .item-image-wrapper {
        height: 105px !important;
    }

    .pos-topbar .flex-grow-1 {
        order: 3;
        width: 100%;
        max-width: 100% !important;
        margin: 4px 0 0 0 !important;
    }
}

/* =========================================================
   4. KDS RESPONSIVENESS
   ========================================================= */
.kds-container {
    min-height: 100vh;
}

.kds-ticket-card {
    background: #2b353b;
    color: #fff;
    border-radius: 12px;
    border-left: 5px solid #ffc107;
    margin-bottom: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

.kds-ticket-card.preparing {
    border-left-color: #0d6efd;
}

.kds-ticket-card.ready {
    border-left-color: #198754;
}

.kds-ticket-card .ticket-items {
    list-style: none;
    padding: 0;
    margin: 8px 0;
}

.kds-ticket-card .ticket-items li {
    padding: 4px 0;
    border-bottom: 1px dashed rgba(255,255,255,0.12);
    font-size: 13px;
}

@media (max-width: 992px) {
    .kds-board .row {
        height: auto !important;
    }

    .kds-board .col-md-4 {
        height: auto !important;
        min-height: 420px;
        margin-bottom: 16px;
    }

    .kds-container header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 12px;
    }
}

/* =========================================================
   5. DATA TABLES & FORMS RESPONSIVENESS
   ========================================================= */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* =========================================================
   6. GLOBAL TOAST COMPONENT
   ========================================================= */
.toast {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: #202a30;
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    transform: translateY(90px);
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1090;
    font-size: 13px;
    font-weight: 500;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

@media (max-width: 576px) {
    .toast {
        left: 15px;
        right: 15px;
        bottom: 15px;
        text-align: center;
    }
}
