/* ============================================================================
   INVOICE SYSTEM - MOBILE STYLES
   Styles for screens 768px and narrower
   Only loaded on mobile via: media="(max-width: 768px)"
   ============================================================================ */

/* ============================================================================
   HIDE TABLES ON MOBILE
   ============================================================================ */
.table-wrapper {
    display: none !important;
}

/* Hide tooltips on mobile (no hover) */
.action-btn-wrapper .tooltip {
    display: none !important;
}

/* ============================================================================
   HEADER - Mobile Adjustments
   ============================================================================ */
header {
    padding: 12px 15px;
}

header h1 {
    font-size: 18px;
    margin-bottom: 8px;
}

.user-info {
    font-size: 13px;
}

/* ============================================================================
   NAVIGATION - Mobile
   ============================================================================ */
nav {
    padding: 8px 10px;
}

nav a {
    padding: 8px 10px;
    font-size: 13px;
    margin-right: 5px;
}

/* ============================================================================
   CONTAINER - Mobile
   ============================================================================ */
.container {
    padding: 10px;
}

/* ============================================================================
   CARDS - Mobile
   ============================================================================ */
.card {
    padding: 12px;
    margin-bottom: 15px;
}

.card h2 {
    font-size: 16px;
}

/* ============================================================================
   STATS - Mobile (2 column)
   ============================================================================ */
.stats {
    gap: 10px;
}

.stat-box {
    flex: 1 1 calc(50% - 10px);
    min-width: calc(50% - 10px);
    padding: 12px;
}

.stat-box .number {
    font-size: 24px;
}

/* ============================================================================
   FILTER FORMS - Mobile (stacked)
   ============================================================================ */
.filter-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.filter-form .form-group {
    width: 100%;
    margin-bottom: 0;
}

.filter-form label {
    font-size: 12px;
    font-weight: normal;
    color: #666;
}

/* ============================================================================
   MOBILE INVOICE CARDS
   ============================================================================ */
.mobile-invoice-cards {
    display: block;
}

.invoice-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.invoice-card.missing {
    border-left: 4px solid #e74c3c;
    background: #fff9f9;
}

.invoice-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.invoice-card-vendor {
    font-weight: bold;
    font-size: 16px;
    color: #2c3e50;
    flex: 1;
    margin-right: 10px;
    word-break: break-word;
}

.invoice-card-status {
    flex-shrink: 0;
}

.invoice-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 15px;
    margin-bottom: 12px;
}

.invoice-card-field {
    display: flex;
    flex-direction: column;
}

.invoice-card-field.full-width {
    grid-column: 1 / -1;
}

.invoice-card-label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.invoice-card-value {
    font-size: 14px;
    color: #333;
}

.invoice-card-value.missing {
    color: #e74c3c;
    font-style: italic;
}

.invoice-card-value.amount {
    font-weight: bold;
    color: #27ae60;
}

.invoice-card-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.invoice-card-actions .btn {
    flex: 1;
    text-align: center;
    padding: 12px 15px;
    font-size: 14px;
}

.invoice-card-reason {
    margin-top: 8px;
    padding: 8px;
    background: #fff3cd;
    border-radius: 4px;
    font-size: 12px;
    color: #856404;
}

/* ============================================================================
   POTENTIAL DUPLICATE - Mobile Cards
   ============================================================================ */
.invoice-card.potential-duplicate {
    border: 2px solid #ff9800;
    border-left: 4px solid #ff9800;
    background: linear-gradient(135deg, #fff3cd 0%, #fff 100%);
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
}

.invoice-card.potential-duplicate .invoice-card-reason {
    background: #ff9800;
    color: white;
}

/* ============================================================================
   PDF VIEWER - Mobile
   ============================================================================ */
.pdf-viewer {
    height: 350px;
}

/* ============================================================================
   MODAL - Mobile
   ============================================================================ */
.modal {
    padding: 15px;
    margin: 10px;
    width: calc(100% - 20px);
}

/* ============================================================================
   LOGIN PAGE - Mobile
   ============================================================================ */
.login-container {
    margin: 30px auto;
}

/* ============================================================================
   INFO BOXES - Mobile
   ============================================================================ */
.admin-queue-info {
    font-size: 13px;
    padding: 10px;
}

/* ============================================================================
   SMALL PHONES (480px and below)
   ============================================================================ */
@media (max-width: 480px) {
    header h1 {
        font-size: 16px;
    }
    
    nav a {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    .stat-box {
        padding: 10px;
    }
    
    .stat-box h3 {
        font-size: 11px;
    }
    
    .stat-box .number {
        font-size: 20px;
    }
    
    .pdf-viewer {
        height: 280px;
    }
    
    .card h2 {
        font-size: 15px;
    }
    
    /* Single column on very small screens */
    .invoice-card-body {
        grid-template-columns: 1fr;
    }
    
    /* Stack action buttons */
    .invoice-card-actions {
        flex-direction: column;
    }
    
    .invoice-card-actions .btn {
        width: 100%;
    }
    
    .invoice-card-vendor {
        font-size: 15px;
    }
    
    .invoice-card-value {
        font-size: 13px;
    }
}

/* ============================================================================
   VIEW INVOICE PAGE - Mobile
   ============================================================================ */

/* Invoice Details Table - Stack layout on mobile */
.details-table {
    display: block;
    width: 100%;
}

.details-table thead {
    display: none;
}

.details-table tbody {
    display: block;
}

.details-table tr {
    display: block;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.details-table tr:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.details-table th,
.details-table td {
    display: block;
    width: 100%;
    padding: 4px 0;
    border: none;
    text-align: left;
}

.details-table th {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    font-weight: 600;
    background: transparent;
}

.details-table td {
    font-size: 14px;
    padding-left: 0;
}

/* History table - horizontal scroll wrapper */
.history-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -15px;
    padding: 0 15px;
}

.history-table {
    display: table;
    min-width: 450px;
    width: 100%;
}

.history-table thead {
    display: table-header-group;
}

.history-table tbody {
    display: table-row-group;
}

.history-table tr {
    display: table-row;
}

.history-table th,
.history-table td {
    display: table-cell;
    padding: 8px 6px;
    border: 1px solid #ddd;
    font-size: 12px;
}

.history-table th {
    background: #f8f9fa;
    font-weight: bold;
    white-space: nowrap;
}

/* ============================================================================
   ACTION BUTTONS - Mobile (Stack vertically)
   ============================================================================ */
.actions-card .btn {
    display: block;
    width: 100%;
    margin: 8px 0;
}

.actions-card form[style*="inline"] {
    display: block !important;
    width: 100%;
}

.actions-card .action-btn-wrapper {
    display: block;
    width: 100%;
    margin-bottom: 8px;
}

.actions-card .action-btn-wrapper .btn {
    width: 100%;
}

.actions-card p {
    margin-bottom: 15px;
}

/* Assigned info box */
.assigned-info {
    font-size: 13px;
    padding: 10px;
}

/* ============================================================================
   APPROVAL MODAL - Mobile
   ============================================================================ */
.modal-overlay {
    padding: 10px;
    align-items: flex-start;
    padding-top: 20px;
}

.modal-overlay.show {
    display: flex;
}

.approval-modal {
    width: 100%;
    max-width: none;
    padding: 20px;
    margin: 0;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    border-radius: 12px;
}

.approval-modal h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.approval-modal > p {
    font-size: 14px;
    margin-bottom: 20px;
}

.category-options {
    flex-direction: column;
    gap: 10px;
}

.category-option {
    min-width: 100%;
    flex: none;
}

.category-option label {
    padding: 15px 12px;
}

.category-option .code {
    font-size: 22px;
}

.category-option .name {
    font-size: 10px;
}

.modal-buttons {
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
}

.modal-buttons .btn {
    width: 100%;
    padding: 14px;
}

/* ============================================================================
   EMAIL SECTION - Mobile
   ============================================================================ */
.email-section {
    margin-bottom: 10px;
}

.email-viewer {
    height: 250px;
}

.email-content {
    max-height: 300px;
}

/* ============================================================================
   PRINT STYLES - Mobile
   ============================================================================ */
@media print {
    .mobile-invoice-cards {
        display: none !important;
    }
}