/* ============================================================================
   INVOICE SYSTEM - BASE STYLES
   Shared styles for both desktop and mobile
   ============================================================================ */

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background: #f5f5f5;
    color: #333;
    overflow-x: hidden;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ============================================================================
   HEADER
   ============================================================================ */
header {
    background: #2c3e50;
    color: white;
    padding: 15px 20px;
    margin-bottom: 0;
}

header h1 {
    font-size: 20px;
    display: block;
    margin-bottom: 10px;
}

.user-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.user-info span {
    margin-right: 10px;
}

.user-info a {
    color: #ecf0f1;
}

/* ============================================================================
   NAVIGATION
   ============================================================================ */
nav {
    background: #34495e;
    padding: 10px 15px;
    margin-bottom: 20px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

nav a {
    color: white;
    text-decoration: none;
    margin-right: 10px;
    padding: 8px 12px;
    display: inline-block;
    border-radius: 3px;
}

nav a:hover, nav a.active {
    background: #2c3e50;
}

/* ============================================================================
   CARDS / BOXES
   ============================================================================ */
.card {
    background: white;
    border: 1px solid #ddd;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    overflow: visible;
}

.card h2 {
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* ============================================================================
   FORMS
   ============================================================================ */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px; /* Prevents zoom on iOS */
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #3498db;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */
.btn {
    display: inline-block;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    margin: 3px;
    text-align: center;
    min-height: 44px; /* Touch-friendly minimum */
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn:hover {
    opacity: 0.9;
}

.btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
    min-height: 32px;
}

/* ============================================================================
   STATUS BADGES
   ============================================================================ */
.status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
}

.status-pending {
    background: #f39c12;
    color: white;
}

.status-approved {
    background: #27ae60;
    color: white;
}

.status-denied {
    background: #e74c3c;
    color: white;
}

.status-hold {
    background: #95a5a6;
    color: white;
}

/* Category badges */
.category-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 15px;
    font-weight: bold;
    font-size: 12px;
}

.category-badge.cv { 
    background: #e8f4fc; 
    color: #3498db; 
}

.category-badge.rv { 
    background: #fef5e7; 
    color: #e67e22; 
}

.category-badge.ev { 
    background: #f5eef8; 
    color: #9b59b6; 
}

/* Reason badges (Admin Queue) */
.reason-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.reason-badge.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

/* ============================================================================
   ALERTS
   ============================================================================ */
.alert {
    padding: 12px 15px;
    margin-bottom: 15px;
    border-radius: 5px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ============================================================================
   MISSING INFO HIGHLIGHT
   ============================================================================ */
.missing {
    background-color: #ffcccc !important;
}

.missing-cell {
    background-color: #ffe0e0;
    color: #c0392b;
}

/* ============================================================================
   LOGIN PAGE
   ============================================================================ */
.login-container {
    max-width: 400px;
    margin: 50px auto;
    padding: 0 20px;
}

.login-container h1 {
    text-align: center;
    margin-bottom: 20px;
}

/* ============================================================================
   STATS DASHBOARD
   ============================================================================ */
.stats {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.stat-box {
    flex: 1 1 150px;
    min-width: 120px;
    background: white;
    border: 1px solid #ddd;
    padding: 15px;
    text-align: center;
    border-radius: 5px;
}

.stat-box h3 {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.stat-box .number {
    font-size: 28px;
    font-weight: bold;
    color: #2c3e50;
}

/* ============================================================================
   MODAL
   ============================================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.modal {
    position: relative;
    background: white;
    padding: 20px;
    border-radius: 10px;
    max-width: 600px;
    width: 100%;
    margin: 20px auto;
    z-index: 1001;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.modal-close {
    cursor: pointer;
    font-size: 28px;
    color: #666;
    padding: 5px 10px;
}

/* ============================================================================
   PDF VIEWER
   ============================================================================ */
.pdf-viewer {
    width: 100%;
    height: 60vh;
    min-height: 400px;
    max-height: 700px;
    border: 1px solid #ddd;
    object-fit: contain;
}

/* ============================================================================
   ADMIN QUEUE INFO
   ============================================================================ */
.admin-queue-info {
    background: #e8f4fc;
    border: 1px solid #b8daef;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 15px;
    font-size: 14px;
}

.admin-queue-info strong {
    color: #2980b9;
}

/* ============================================================================
   ASSIGNMENT STATUS
   ============================================================================ */
.assignment-status {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.assignment-status.assigned {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.assignment-status.unassigned {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-10 { margin-top: 10px; }
.mb-10 { margin-bottom: 10px; }

.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* ============================================================================
   POTENTIAL DUPLICATE STYLES
   ============================================================================ */

/* Duplicate label badge */
.duplicate-label {
    display: inline-block;
    background: #ff9800;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Reference link to original invoice */
.duplicate-ref {
    color: #856404;
    font-size: 11px;
}

.duplicate-ref a {
    color: #0056b3;
    text-decoration: underline;
}

/* Status badge for duplicates */
.status-duplicate {
    background: #ff9800;
    color: white;
}

/* Duplicate banner (for mobile cards) */
.duplicate-banner {
    background: #ff9800;
    color: white;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    margin: -5px -15px 10px -15px;
    border-radius: 0;
}

.duplicate-banner a {
    color: white;
    text-decoration: underline;
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */
@media print {
    nav, header, .btn, .action-buttons {
        display: none !important;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    .card {
        border: none;
        box-shadow: none;
    }
}