/* Custom styles for Pass System */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.main-content {
    margin-left: 0;
    transition: margin-left 0.3s ease;
}

@media (min-width: 992px) {
    .main-content {
        margin-left: 250px;
    }
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100vh;
    background-color: #343a40;
    z-index: 1040;
    transition: transform 0.3s ease;
    padding-top: 20px;
}

.sidebar-sticky {
    position: sticky;
    top: 20px;
    height: calc(100vh - 40px);
    overflow-y: auto;
}

.sidebar .nav-link {
    color: #adb5bd;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
}

.sidebar .nav-link:hover {
    color: #ffffff;
    background-color: #495057;
    text-decoration: none;
}

.sidebar .nav-link.active {
    color: #ffffff;
    background-color: #007bff;
}

.sidebar .nav-link i {
    margin-right: 0.5rem;
    width: 1rem;
}

.sidebar .badge {
    background-color: #dc3545;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.navbar-toggler {
    border: none;
    padding: 0.5rem;
    font-size: 1.25rem;
}

.card {
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-2px);
}

@media print {
    .sidebar, .navbar {
        display: none !important;
    }
    body * {
        visibility: hidden;
    }
    .receipt-content, .receipt-content * {
        visibility: visible;
    }
    .receipt-content {
        position: absolute;
        left: 0;
        top: 0;
        width: 50mm;
        font-size: 8pt;
        line-height: 1.1;
        margin: 0;
        padding: 2mm;
    }
    .receipt-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 7pt;
    }
    .receipt-table td {
        padding: 1mm 0;
        border-bottom: 1px dotted #000;
    }
}

/* Tablet optimizations */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }
    .main-content {
        margin-left: 0;
    }
    .navbar-nav {
        flex-direction: column;
        align-items: flex-start;
    }
    .navbar-toggler {
        margin-left: auto;
    }
}

/* Mobile optimizations for POS */
@media (max-width: 480px) {
    .card-body {
        padding: 1rem;
    }
    .btn {
        width: 100%;
    }
    .navbar-toggler {
        width: 50px;
        height: 50px;
    }
    .input-group {
        flex-direction: column;
    }
    .input-group-text {
        width: 100%;
        text-align: center;
    }
    /* Admin pages responsiveness */
    .admin-form .row > div {
        margin-bottom: 15px;
    }
    .admin-form .btn {
        margin-top: 10px;
    }
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

/* Dashboard buttons */
.btn-lg {
    border-radius: 10px;
    font-size: 1.1rem;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.btn-primary {
    background-color: #007bff;
    border-color: #007bff;
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

/* Passes cards */
.card {
    transition: transform 0.2s ease-in-out;
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.card-title {
    color: #007bff;
    font-size: 1.25rem;
}

.card-text strong {
    color: #495057;
}

/* Cart table */
.table {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.table th {
    background-color: #007bff;
    color: white;
    font-weight: bold;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 123, 255, 0.05);
}

/* Forms */
.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Alerts */
.alert {
    border-radius: 8px;
}

/* Reports cards */
.card.text-center {
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Receipt on screen */
.receipt-container {
    max-width: 300px;
    margin: 20px auto;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
    font-size: 14px;
    font-weight: bold;
}

@media (max-width: 768px) {
    .receipt-container {
        max-width: 100%;
        margin: 10px auto;
        padding: 5px;
        border: none;
        border-radius: 0;
    }
}

.header {
    font-weight: bold;
    text-align: center;
    margin-bottom: 5px;
}

.header.arabic {
    direction: rtl;
    font-family: 'Arial Unicode MS', 'Tahoma', sans-serif;
    unicode-bidi: embed;
}

.details {
    font-size: 0.85rem;
    margin-bottom: 10px;
    line-height: 1.3;
}

.details strong {
    display: inline-block;
    width: 40%;
    text-align: left;
    font-weight: bold;
}

.details br + * {
    display: inline-block;
    width: 60%;
    text-align: right;
    margin-left: 40%;
}

table.receipt-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}

table.receipt-table th:first-child,
table.receipt-table td:first-child {
    text-align: left;
    width: 10%;
}

table.receipt-table th:nth-child(2),
table.receipt-table td:nth-child(2) {
    text-align: left;
    width: 50%;
}

table.receipt-table th:nth-child(3),
table.receipt-table td:nth-child(3) {
    text-align: right;
    width: 20%;
    white-space: nowrap;
}

table.receipt-table th:last-child,
table.receipt-table td:last-child {
    text-align: right;
    width: 20%;
    white-space: nowrap;
}

table.receipt-table th, table.receipt-table td {
    padding: 4px;
    border: 1px solid #000;
    font-size: 0.85rem;
}

.total {
    font-weight: bold;
    background-color: #f8f9fa;
}

/* Mobile table responsiveness */
@media (max-width: 480px) {
    .receipt-container table.receipt-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .receipt-container table.receipt-table thead,
    .receipt-container table.receipt-table tbody,
    .receipt-container table.receipt-table th,
    .receipt-container table.receipt-table td,
    .receipt-container table.receipt-table tr {
        display: table;
        width: 100%;
    }
    
    .receipt-container table.receipt-table th,
    .receipt-container table.receipt-table td {
        min-width: 60px;
    }
}

/* Print styles for thermal POS printer (58mm width) - Match PDF exactly */
@media print {
    body * {
        visibility: hidden;
    }
    
    .receipt-container, .receipt-container * {
        visibility: visible;
    }
    
    .receipt-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 58mm;
        margin: 0;
        padding: 2mm;
        font-size: 7pt;
        line-height: 1.1;
        color: black;
        background: white;
        font-family: 'Courier New', monospace; /* For alignment */
    }
    
    .header {
        font-size: 8pt;
        margin: 1mm 0;
        text-align: center;
    }
    
    .details {
        font-size: 7pt;
        margin: 0.5mm 0;
        text-align: left;
    }
    
    .details strong {
        display: inline-block;
        width: 40%;
        text-align: left;
    }
    
    .details br + * {
        text-align: right;
        margin-left: 40%;
    }
    
    table.receipt-table {
        font-size: 7pt;
        margin: 1mm 0;
        border: none;
    }
    
    table.receipt-table th,
    table.receipt-table td {
        padding: 0.5mm 1mm;
        border: none;
        white-space: nowrap;
    }
    
    table.receipt-table th:first-child,
    table.receipt-table td:first-child {
        text-align: left;
        padding-left: 0;
    }
    
    table.receipt-table th:nth-child(2),
    table.receipt-table td:nth-child(2) {
        text-align: left;
    }
    
    table.receipt-table th:nth-child(3),
    table.receipt-table td:nth-child(3),
    table.receipt-table th:last-child,
    table.receipt-table td:last-child {
        text-align: right;
        padding-right: 0;
    }
    
    table.receipt-table .total td {
        font-weight: bold;
    }
    
    .no-print {
        display: none !important;
    }
    
    @page {
        size: 58mm auto;
        margin: 0;
    }
}

/* Mobile responsiveness - Enhanced for POS devices */
@media (max-width: 991.98px) {
    .main-content {
        margin-left: 0 !important;
        padding-top: 20px;
    }
    
    .container-fluid {
        padding: 0 10px;
    }
    
    .card {
        margin-bottom: 20px;
        border-radius: 8px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .card-body form .row > div {
        margin-bottom: 15px;
    }
    
    .input-group, .form-control, .form-select {
        min-height: 48px; /* Larger touch targets */
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .btn {
        min-height: 48px;
        font-size: 1rem;
        padding: 0.75rem 1.5rem;
        border-radius: 8px;
        width: 100%; /* Full width on small screens */
        margin-bottom: 10px;
    }
    
    .table-responsive {
        font-size: 0.9rem;
        -webkit-overflow-scrolling: touch;
    }
    
    .table th, .table td {
        padding: 8px 4px;
        white-space: nowrap;
    }
    
    /* Offcanvas wider on mobile */
    .offcanvas {
        width: 280px;
    }
    
    /* Navbar full width */
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .navbar-toggler {
        padding: 0.5rem;
    }
}

@media (max-width: 576px) {
    body {
        font-size: 14px;
    }
    
    h1, h2, h3 {
        font-size: 1.25rem;
    }
    
    .btn-lg, .btn {
        min-height: 50px;
        font-size: 1rem;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
    
    /* Stack cards vertically */
    .row > * {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Compact forms */
    .form-label {
        font-size: 0.9rem;
        margin-bottom: 5px;
    }
    
    .table {
        font-size: 0.8rem;
    }
    
    /* POS-specific: Portrait optimization */
    @media (orientation: portrait) and (max-height: 800px) {
        .main-content {
            padding-bottom: 20px;
        }
        
        .offcanvas-body {
            padding: 10px;
        }
        
        .nav-link {
            padding: 0.75rem 0.5rem;
            font-size: 0.95rem;
        }
    }
    
    /* Hide non-essential on very small */
    .badge {
        font-size: 0.75rem;
        min-width: 20px;
        height: 20px;
    }
}

/* High contrast for POS readability */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid #000;
    }
    
    .btn {
        border-width: 2px;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Fix Qty input-group to stay inline on mobile */
@media (max-width: 480px) {
    .input-group.mb-2 {
        flex-direction: row !important;
    }
    .input-group.mb-2 .input-group-text {
        width: auto;
        text-align: left;
    }
}

}