/* ==========================================================================
   ZnZ RND Software - PWA & Mobile-Friendly Theme Enhancements
   Clean, Modern, Touch-Optimized Design System (Safe for Bootstrap 3)
   ========================================================================== */

:root {
    --pwa-primary: #2A3F54;
    --pwa-primary-dark: #1E2D3B;
    --pwa-accent: #1ABB9C;
    --pwa-accent-hover: #169F85;
    --pwa-blue: #3498DB;
    --pwa-purple: #9B59B6;
    --pwa-orange: #E67E22;
    --pwa-red: #E74C3C;
    --pwa-teal: #17a2b8;
    --pwa-bg: #F7F9FA;
    --pwa-card-bg: #FFFFFF;
    --pwa-text-main: #2C3E50;
    --pwa-text-muted: #7F8C8D;
    --pwa-border: #E8ECEF;
    --pwa-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --pwa-shadow-md: 0 6px 20px rgba(42, 63, 84, 0.08);
    --pwa-shadow-lg: 0 12px 30px rgba(42, 63, 84, 0.12);
    --pwa-radius-sm: 8px;
    --pwa-radius-md: 14px;
    --pwa-radius-lg: 20px;
    --pwa-bottom-nav-height: 64px;
}

/* --------------------------------------------------------------------------
   1. General Mobile & Touch Optimization
   -------------------------------------------------------------------------- */
body {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    text-rendering: optimizeLegibility;
}

/* Ensure smooth scrolling across devices */
html, body {
    overflow-x: hidden;
    scroll-behavior: smooth;
}

/* Safe area support for iOS notch and home indicator bar */
@supports (padding: max(0px)) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* --------------------------------------------------------------------------
   2. Modern Mobile-Friendly Dashboard Components
   -------------------------------------------------------------------------- */
.pwa-dashboard-wrapper {
    padding: 10px 5px 80px 5px;
}

@media (min-width: 768px) {
    .pwa-dashboard-wrapper {
        padding: 15px 15px 40px 15px;
    }
}

/* User Welcome Banner Card */
.pwa-welcome-card {
    background: linear-gradient(135deg, #2A3F54 0%, #1a2736 100%);
    color: #ffffff;
    border-radius: var(--pwa-radius-lg);
    padding: 24px 20px;
    box-shadow: var(--pwa-shadow-lg);
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
}

.pwa-welcome-card::after {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(26, 187, 156, 0.25) 0%, rgba(26, 187, 156, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
}

.pwa-welcome-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    position: relative;
    z-index: 2;
}

.pwa-user-avatar-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
}

.pwa-user-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #1ABB9C;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.pwa-user-info h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 4px 0;
    color: #ffffff;
    letter-spacing: -0.3px;
}

.pwa-user-info p {
    font-size: 13px;
    color: #d1d8e0;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pwa-dept-badge {
    background: rgba(26, 187, 156, 0.2);
    color: #1ABB9C;
    border: 1px solid rgba(26, 187, 156, 0.4);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.pwa-welcome-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pwa-btn-sm {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 14px;
    border-radius: var(--pwa-radius-sm);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.pwa-btn-sm:hover, .pwa-btn-sm:focus {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-1px);
}

/* Quick Search & Filter Bar */
.pwa-search-section {
    margin-bottom: 25px;
}

.pwa-search-box {
    position: relative;
    width: 100%;
}

.pwa-search-box input {
    width: 100%;
    height: 50px;
    padding: 12px 18px 12px 46px;
    background: #ffffff;
    border: 1px solid #E0E6ED;
    border-radius: var(--pwa-radius-md);
    font-size: 14px;
    color: #2C3E50;
    box-shadow: var(--pwa-shadow-sm);
    transition: all 0.2s ease;
}

.pwa-search-box input:focus {
    border-color: #1ABB9C;
    box-shadow: 0 0 0 3px rgba(26, 187, 156, 0.15);
    outline: none;
}

.pwa-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #95a5a6;
    font-size: 16px;
    pointer-events: none;
}

/* Section Titles */
.pwa-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 25px 0 15px 0;
}

.pwa-section-title {
    font-size: 16px;
    font-weight: 700;
    color: #2A3F54;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.pwa-section-title i {
    color: #1ABB9C;
}

/* Quick Action Tiles Grid */
.pwa-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

@media (min-width: 768px) {
    .pwa-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }
}

@media (min-width: 1200px) {
    .pwa-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
}

/* Action Tile Card */
.pwa-action-card {
    background: var(--pwa-card-bg);
    border-radius: var(--pwa-radius-md);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    text-decoration: none !important;
    border: 1px solid #ECEFF1;
    box-shadow: var(--pwa-shadow-sm);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: 140px;
}

.pwa-action-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--pwa-shadow-md);
    border-color: #D1D8E0;
}

.pwa-action-card:active {
    transform: scale(0.97);
}

.pwa-card-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 14px;
    transition: transform 0.2s ease;
}

.pwa-action-card:hover .pwa-card-icon-wrap {
    transform: scale(1.08);
}

.pwa-card-title {
    font-size: 14px;
    font-weight: 700;
    color: #2A3F54;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.pwa-card-subtitle {
    font-size: 11px;
    color: #7F8C8D;
    margin: 0;
    line-height: 1.3;
}

.pwa-card-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    text-transform: uppercase;
}

/* Card Color Variants */
.pwa-theme-emerald .pwa-card-icon-wrap { background: rgba(26, 187, 156, 0.12); color: #1ABB9C; }
.pwa-theme-emerald .pwa-card-badge { background: #e8f8f5; color: #1ABB9C; }

.pwa-theme-blue .pwa-card-icon-wrap { background: rgba(52, 152, 219, 0.12); color: #3498DB; }
.pwa-theme-blue .pwa-card-badge { background: #ebf5fb; color: #3498DB; }

.pwa-theme-purple .pwa-card-icon-wrap { background: rgba(155, 89, 182, 0.12); color: #9B59B6; }
.pwa-theme-purple .pwa-card-badge { background: #f5eef8; color: #9B59B6; }

.pwa-theme-orange .pwa-card-icon-wrap { background: rgba(230, 126, 34, 0.12); color: #E67E22; }
.pwa-theme-orange .pwa-card-badge { background: #fef5e7; color: #E67E22; }

.pwa-theme-red .pwa-card-icon-wrap { background: rgba(231, 76, 60, 0.12); color: #E74C3C; }
.pwa-theme-red .pwa-card-badge { background: #fdf2f2; color: #E74C3C; }

.pwa-theme-teal .pwa-card-icon-wrap { background: rgba(23, 162, 184, 0.12); color: #17a2b8; }
.pwa-theme-teal .pwa-card-badge { background: #e0f7fa; color: #00838f; }

.pwa-theme-navy .pwa-card-icon-wrap { background: rgba(42, 63, 84, 0.12); color: #2A3F54; }
.pwa-theme-navy .pwa-card-badge { background: #eaedf1; color: #2A3F54; }

/* --------------------------------------------------------------------------
   3. PWA Install Prompt Card (Smart Banner)
   -------------------------------------------------------------------------- */
.pwa-install-banner {
    display: none;
    background: linear-gradient(135deg, #1ABB9C 0%, #16a085 100%);
    color: #ffffff;
    border-radius: var(--pwa-radius-md);
    padding: 16px 20px;
    margin-bottom: 25px;
    box-shadow: 0 8px 24px rgba(26, 187, 156, 0.25);
    animation: fadeInSlide 0.4s ease-out;
}

@keyframes fadeInSlide {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.pwa-install-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.pwa-install-text-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
}

.pwa-install-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.pwa-install-text h4 {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 2px 0;
    color: #ffffff;
}

.pwa-install-text p {
    font-size: 12px;
    color: #e8f8f5;
    margin: 0;
}

.pwa-install-btn-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pwa-btn-install {
    background: #ffffff;
    color: #16a085;
    border: none;
    padding: 9px 18px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
}

.pwa-btn-install:hover {
    background: #f8f9fa;
    transform: translateY(-1px);
}

.pwa-btn-dismiss {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 18px;
    padding: 6px 10px;
    cursor: pointer;
}

/* --------------------------------------------------------------------------
   4. Mobile Bottom Navigation Bar (App Bar for Phones)
   -------------------------------------------------------------------------- */
.pwa-bottom-nav {
    display: none;
}

@media (max-width: 767px) {
    .pwa-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: var(--pwa-bottom-nav-height);
        background: #2A3F54;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
        z-index: 99999;
        align-items: center;
        justify-content: space-around;
        padding: 0 10px;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    .pwa-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: #a3b1c2;
        text-decoration: none !important;
        font-size: 10px;
        font-weight: 600;
        gap: 3px;
        padding: 6px 8px;
        border-radius: 8px;
        transition: all 0.2s ease;
        flex: 1;
        text-align: center;
    }

    .pwa-nav-item i {
        font-size: 18px;
        transition: transform 0.2s ease;
    }

    .pwa-nav-item.active, .pwa-nav-item:hover {
        color: #1ABB9C;
    }

    .pwa-nav-item.active i {
        transform: translateY(-2px);
    }

    /* Floating Center Scan Button */
    .pwa-nav-item-scan {
        position: relative;
        top: -14px;
        background: linear-gradient(135deg, #1ABB9C 0%, #16a085 100%);
        color: #ffffff !important;
        width: 52px;
        height: 52px;
        flex: 0 0 52px;
        border-radius: 50%;
        box-shadow: 0 6px 16px rgba(26, 187, 156, 0.4);
        display: flex;
        align-items: center;
        justify-content: center;
        border: 3px solid #ffffff;
    }

    .pwa-nav-item-scan i {
        font-size: 22px;
        margin: 0;
    }

    .pwa-nav-item-scan:active {
        transform: scale(0.92);
    }

    /* Add bottom padding to body content so footer nav doesn't cover elements */
    .container.body .main_container .right_col {
        padding-bottom: 75px !important;
    }
}

/* --------------------------------------------------------------------------
   5. Online / Offline Status Toast
   -------------------------------------------------------------------------- */
.pwa-status-toast {
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #2A3F54;
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--pwa-shadow-lg);
    z-index: 100000;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

.pwa-status-toast.show {
    transform: translateX(-50%) translateY(0);
}

.pwa-status-toast.online {
    background: #27ae60;
}

.pwa-status-toast.offline {
    background: #e74c3c;
}

/* --------------------------------------------------------------------------
   6. iOS Install Guide Modal
   -------------------------------------------------------------------------- */
.pwa-ios-modal {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 15px;
    right: 15px;
    max-width: 420px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: var(--pwa-radius-lg);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
    padding: 22px;
    z-index: 100001;
    animation: slideUp 0.35s ease-out;
    border: 1px solid rgba(0,0,0,0.06);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.pwa-ios-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.pwa-ios-title {
    font-size: 15px;
    font-weight: 700;
    color: #2A3F54;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pwa-ios-step {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #555;
}

.pwa-ios-step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f0f3f6;
    color: #2A3F54;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   7. Specific Page Overrides & Cleanups
   -------------------------------------------------------------------------- */
body.login-page .pwa-bottom-nav {
    display: none !important;
}

body.login-page .container.body .main_container .right_col {
    padding-bottom: 0 !important;
}

.pwa-live-clock {
    font-size: 12px;
    font-weight: 600;
    color: #1ABB9C;
    background: rgba(26, 187, 156, 0.15);
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* --------------------------------------------------------------------------
   8. Browser Recommends App Smart Bar
   -------------------------------------------------------------------------- */
.pwa-browser-recommend-bar {
    background: linear-gradient(135deg, #1ABB9C 0%, #16a085 100%);
    color: #ffffff;
    padding: 10px 16px;
    border-radius: var(--pwa-radius-md);
    margin-bottom: 20px;
    display: none; /* Shown dynamically by pwa-init.js when in browser */
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(26, 187, 156, 0.3);
    animation: fadeInDown 0.4s ease-out;
}

.pwa-recommend-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pwa-recommend-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.pwa-recommend-text h5 {
    margin: 0 0 2px 0;
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
}

.pwa-recommend-text p {
    margin: 0;
    font-size: 11px;
    color: #e8f8f5;
}

.pwa-recommend-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pwa-btn-recommend-open {
    background: #ffffff;
    color: #16a085;
    border: none;
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

.pwa-btn-recommend-open:hover {
    transform: scale(1.04);
}


