/**
 * Admin Panel Styles
 */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    padding: 2rem;
    width: 100%;
    max-width: 450px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.login-header h2 {
    color: var(--text-light);
    font-size: 1rem;
    font-weight: normal;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-form .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

.login-form .form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.login-form .form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Password Toggle */
.password-input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    width: 100%;
    padding-right: 3.5rem;
    flex: 1;
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: #6b7280;
    font-size: 1.1rem;
    transition: color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    width: auto;
    height: auto;
    min-width: 30px;
}

.password-toggle:hover {
    color: var(--primary-color);
}

.password-toggle:focus {
    outline: none;
    color: var(--primary-color);
}

.password-toggle:active {
    transform: translateY(-50%) scale(0.95);
}

.password-toggle i {
    pointer-events: none;
    display: block;
}

.login-form button[type="submit"],
.login-form .btn {
    width: 100%;
    margin-top: 1rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    border-radius: 0.5rem;
    background: var(--primary-color);
    color: #fff;
    transition: all 0.3s;
    display: block;
    text-align: center;
}

.login-form button[type="submit"]:hover,
.login-form .btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.login-form button[type="submit"]:active,
.login-form .btn:active {
    transform: translateY(0);
}

.login-form button[type="submit"]:disabled,
.login-form .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.login-form .btn-block {
    display: block;
    width: 100%;
}

/* Dashboard */
.dashboard {
    padding: 2rem;
    min-height: calc(100vh - 80px);
    background: var(--bg-light);
}

.page-content {
    padding: 2rem;
    min-height: calc(100vh - 80px);
    background: var(--bg-light);
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.role-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.role-super_admin { background: #fee2e2; color: #991b1b; }
.role-admin { background: #fce7f3; color: #9d174d; }
.role-supervisor { background: #ede9fe; color: #5b21b6; }
.role-sales { background: #dbeafe; color: #1e40af; }
.role-designer { background: #fef3c7; color: #92400e; }
.role-printer { background: #e0e7ff; color: #3730a3; }
.role-finishing { background: #d1fae5; color: #065f46; }
.role-qc { background: #e0f2fe; color: #0369a1; }
.role-accounts { background: #fef9c3; color: #854d0e; }
.role-dispatch { background: #f3e8ff; color: #6b21a8; }
.role-delivery { background: #d1fae5; color: #065f46; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-content h3 {
    font-size: 2rem;
    margin-bottom: 0.25rem;
    color: var(--primary-color);
}

.stat-content p {
    color: var(--text-light);
    font-size: 0.875rem;
}

.dashboard-section {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.dashboard-section h2 {
    margin-bottom: 1.5rem;
    color: var(--text-dark);
}

/* Dashboard Section Header with Search - Universal Style */
.dashboard-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.dashboard-section-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
}

/* Search Container - Universal Style */
.search-container {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.search-container input[type="text"] {
    width: 100%;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s;
    outline: none;
    box-sizing: border-box;
}

.search-container input[type="text"]:focus {
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.search-container input[type="text"]::placeholder {
    color: #9ca3af;
}

.search-container .fa-search {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    pointer-events: none;
    z-index: 1;
}

.search-container button {
    display: none;
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0.3rem;
    font-size: 0.9rem;
    transition: color 0.2s;
    z-index: 2;
}

.search-container button:hover {
    color: #dc2626;
}

@media (max-width: 768px) {
    .dashboard-section-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-container {
        max-width: 100%;
    }
}

/* Data Table */
.data-table-container {
    overflow-x: auto;
    width: 100%;
}

.orders-table-container {
    overflow-x: visible;
    width: 100%;
    max-width: 100%;
}

/* ============================================
   UNIVERSAL TABLE LAYOUT - FIXED COLUMN WIDTHS
   Applies to: Dashboard, Orders, Invoices
   ============================================ */

.data-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    white-space: normal;
    word-break: break-word;
    margin: 0;
    border-spacing: 0;
    box-sizing: border-box;
}

.data-table th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-dark);
}

.data-table tbody tr {
    height: auto;
    min-height: 0;
    display: table-row;
}

/* Payment history table rows - ensure no excessive height */
.payment-history-table-wrap .payment-history-table.data-table tbody tr {
    height: auto !important;
    min-height: 0 !important;
}

.data-table tbody tr:hover {
    background: var(--bg-light);
}

/* ============================================
   FIXED COLUMN WIDTHS - ORDERS & DASHBOARD
   Column order: Order Number | Customer | Mobile | Status | Amount | Date | Actions
   ============================================ */

/* Order Number: 160px */
.data-table th:nth-child(1),
.data-table td:nth-child(1) {
    width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Customer: 220px max-width - Proper wrapping */
.data-table th:nth-child(2),
.data-table td:nth-child(2),
.data-table .customer-col {
    max-width: 220px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
}

/* Customer name text wrapper */
.data-table .customer-col .customer-name,
.data-table td:nth-child(2) {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
}

/* Mobile: 150px */
.data-table th:nth-child(3),
.data-table td:nth-child(3) {
    width: 150px;
    white-space: nowrap;
    text-align: center;
}

/* Status: 170px */
.data-table th:nth-child(4),
.data-table td:nth-child(4) {
    width: 170px;
    white-space: nowrap;
    text-align: center;
}

/* Amount: 130px */
.data-table th:nth-child(5),
.data-table td:nth-child(5) {
    width: 130px;
    white-space: nowrap;
    text-align: right;
}

/* Date: 130px */
.data-table th:nth-child(6),
.data-table td:nth-child(6) {
    width: 130px;
    white-space: nowrap;
    text-align: center;
}

/* Actions: 90px */
.data-table th:nth-child(7),
.data-table td:nth-child(7) {
    width: 90px;
    white-space: nowrap;
    text-align: center;
}

/* ============================================
   INVOICES TABLE - 8 COLUMNS
   Column order: Invoice Number | Order Number | Customer | Type | Date | Amount | Generated By | Actions
   ============================================ */

/* Invoice Number: 160px */
.orders-table-container .data-table th:nth-child(1),
.orders-table-container .data-table td:nth-child(1) {
    width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Order Number: 160px */
.orders-table-container .data-table th:nth-child(2),
.orders-table-container .data-table td:nth-child(2) {
    width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Customer: 220px max-width - Proper wrapping */
.orders-table-container .data-table th:nth-child(3),
.orders-table-container .data-table td:nth-child(3) {
    max-width: 220px;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
}

/* Type: 120px */
.orders-table-container .data-table th:nth-child(4),
.orders-table-container .data-table td:nth-child(4) {
    width: 120px;
    white-space: nowrap;
    text-align: center;
}

/* Date: 130px */
.orders-table-container .data-table th:nth-child(5),
.orders-table-container .data-table td:nth-child(5) {
    width: 130px;
    white-space: nowrap;
    text-align: center;
}

/* Amount: 130px */
.orders-table-container .data-table th:nth-child(6),
.orders-table-container .data-table td:nth-child(6) {
    width: 130px;
    white-space: nowrap;
    text-align: right;
}

/* Generated By: 150px */
.orders-table-container .data-table th:nth-child(7),
.orders-table-container .data-table td:nth-child(7) {
    width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

/* Actions: 90px */
.orders-table-container .data-table th:nth-child(8),
.orders-table-container .data-table td:nth-child(8) {
    width: 90px;
    white-space: nowrap;
    text-align: center;
}

/* Mobile Card Layout for Orders Table */
.orders-card-container {
    display: none;
}

.order-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.order-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.order-card-number {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.order-card-status {
    margin-top: 0.25rem;
}

.order-card-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.order-card-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.order-card-label {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.order-card-value {
    font-size: 0.95rem;
    color: var(--text-dark);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.order-card-customer {
    grid-column: 1 / -1;
}

.order-card-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

/* Responsive: Show cards on mobile, table on desktop */
@media (max-width: 768px) {
    .orders-table-container .data-table {
        display: none;
    }
    
    .orders-card-container {
        display: block;
    }
    
    .order-card-body {
        grid-template-columns: 1fr;
    }
    
    .order-card-customer {
        grid-column: 1;
    }
    
    .order-card-footer {
        flex-direction: column;
    }
    
    .order-card-footer .btn {
        width: 100%;
    }
}

@media (min-width: 769px) {
    .orders-card-container {
        display: none;
    }
    
    .orders-table-container .data-table {
        display: table;
    }
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.status-order-received { background: #dbeafe; color: #1e40af; }
.status-design-in-progress { background: #fef3c7; color: #92400e; }
.status-design-approved { background: #d1fae5; color: #065f46; }
.status-printing-in-progress { background: #e0e7ff; color: #3730a3; }
.status-printing-done { background: #ddd6fe; color: #5b21b6; }
.status-ready-for-delivery { background: #fed7aa; color: #9a3412; }
.status-delivered { background: #86efac; color: #166534; }

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    min-height: 34px;
}

/* Action buttons - uniform width for table cells */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    gap: 0.5rem;
    align-items: stretch;
}
.action-buttons .btn,
.action-buttons .btn-sm {
    min-width: 118px;
    flex: 1 1 auto;
    white-space: nowrap;
    text-align: center;
    padding: 0.5rem 0.75rem;
}

.text-center {
    text-align: center;
}

/* Forms */
.page-content {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.content-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 2rem;
    box-shadow: var(--shadow);
}

/* Orders list: type tabs (All | Regular | Walk-in) */
.orders-type-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0;
}
.orders-tab {
    padding: 0.65rem 1.25rem;
    border-radius: 8px 8px 0 0;
    text-decoration: none;
    color: #6b7280;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
    background: transparent;
    margin-bottom: -2px;
}
.orders-tab:hover {
    color: var(--primary-color, #2563eb);
    background: #f3f4f6;
}
.orders-tab.active {
    color: var(--primary-color, #2563eb);
    background: #fff;
    border: 1px solid #e5e7eb;
    border-bottom-color: #fff;
}
@media (max-width: 600px) {
    .orders-type-tabs { gap: 0.25rem; }
    .orders-tab { padding: 0.5rem 0.75rem; font-size: 0.8rem; }
}

/* Responsive: tables and inputs - no overflow */
.data-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}
.data-table th,
.data-table td {
    padding: 12px;
    vertical-align: middle;
    text-align: left;
    white-space: normal;
    word-break: break-word;
}
@media (max-width: 768px) {
    .data-table { font-size: 0.85rem; }
    .data-table th, .data-table td { padding: 0.5rem; }
}
.filter-form input,
.filter-form select,
.filter-form button {
    max-width: 100%;
    box-sizing: border-box;
}

/* Enhanced Create Order Page */
.create-order-container {
    max-width: 1200px;
    margin: 0 auto;
}

.order-form-wrapper {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.page-subtitle {
    color: #6b7280;
    font-size: 0.95rem;
    margin-top: 0.5rem;
    font-weight: 400;
}

.form-section {
    margin-bottom: 0;
    padding: 0;
    border-bottom: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.form-section:last-child {
    border-bottom: none;
}

.form-section:hover {
    background: #fafafa;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 2px solid #e2e8f0;
}

.section-header h3 {
    margin: 0;
    color: #1e293b;
    font-size: 1.25rem;
    font-weight: 700;
    flex: 1;
}

.section-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 10px;
}

.section-content {
    padding: 2rem;
}

.item-count-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.customer-section .section-icon {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.items-section .section-icon {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.details-section .section-icon {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.summary-section {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-top: 3px solid #f59e0b;
}

.summary-section .section-header {
    background: transparent;
    border-bottom: 2px solid #fbbf24;
}

.summary-section .section-icon {
    background: rgba(245, 158, 11, 0.2);
    color: #d97706;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #fff;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: #cbd5e1;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    background: #f8fafc;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.625rem;
    font-weight: 600;
    color: #374151;
    font-size: 0.95rem;
}

.form-group label::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 2px;
    opacity: 0.6;
}

.order-item {
    background: #fff;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    border: 2px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
    position: relative;
}

.order-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
    transform: translateY(-2px);
}

.order-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-color);
    border-radius: 10px 0 0 10px;
    opacity: 0;
    transition: opacity 0.3s;
}

.order-item:hover::before {
    opacity: 1;
}

/* File Upload Styles */
.file-upload-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.file-upload-area {
    position: relative;
}

.file-upload-placeholder {
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-upload-placeholder:hover {
    border-color: var(--primary-color);
    background: #f0f9ff;
}

.file-upload-placeholder.drag-over {
    border-color: var(--primary-color);
    background: #dbeafe;
    transform: scale(1.02);
}

.file-upload-placeholder i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    display: block;
}

.file-upload-placeholder p {
    margin: 0.5rem 0;
    color: #374151;
    font-weight: 600;
}

.file-upload-placeholder small {
    color: #6b7280;
    font-size: 0.875rem;
}

.uploaded-files-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.uploaded-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.uploaded-file-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.file-info i {
    color: var(--primary-color);
    font-size: 1.25rem;
}

.file-name {
    font-weight: 600;
    color: #1e293b;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    color: #6b7280;
    font-size: 0.875rem;
}

.btn-remove-file {
    background: #fee2e2;
    color: #dc2626;
    border: none;
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-file:hover {
    background: #dc2626;
    color: white;
    transform: scale(1.1);
}

.btn-add-more-files {
    margin-top: 1rem;
    padding: 0.625rem 1rem;
    background: #f0f9ff;
    color: var(--primary-color);
    border: 1px dashed var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-add-more-files:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.item-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    align-items: end;
    margin-bottom: 1rem;
}

.order-form {
    max-width: 100%;
}

.order-summary {
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 2px solid #fbbf24;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid #e5e7eb;
    font-size: 1rem;
    color: #374151;
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-total {
    font-weight: 800;
    font-size: 1.5rem;
    color: #1e293b;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    border: 2px solid #fbbf24;
}

.summary-total span:last-child {
    color: #d97706;
    font-size: 1.75rem;
}

/* Advance Received Input */
.order-summary .form-group {
    margin-bottom: 1rem;
}

.order-summary .form-group input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #fbbf24;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.order-summary .form-group input[type="number"]:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2);
}

/* Due Amount Styling */
.summary-total.summary-due {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #ef4444;
    color: #991b1b;
}

.summary-total.summary-due span:last-child {
    color: #dc2626;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding: 2rem;
    background: #f8fafc;
    border-top: 2px solid #e5e7eb;
    justify-content: flex-end;
}

.btn-create-order {
    padding: 0.875rem 2rem;
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    transition: all 0.3s ease;
}

.btn-create-order:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-add-item {
    width: 100%;
    margin-top: 1rem;
    padding: 0.875rem 1.5rem;
    border: 2px dashed var(--border-color);
    background: #f8fafc;
    color: var(--primary-color);
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-add-item:hover,
.btn-add-item:active,
.btn-add-item:focus {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    outline: none;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

@media (max-width: 768px) {
    .btn-add-item {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        min-height: 48px; /* Better touch target */
    }
}

.btn-remove-item {
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-secondary {
    background: var(--text-light);
    color: #fff;
}

.btn-secondary:hover {
    background: var(--text-dark);
}

.btn-danger {
    background: var(--error-color);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Order Details */
.order-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.order-section {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    height: auto;
    min-height: 0;
}

/* Payment section specific - ensure no excessive height */
#paymentSection {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
}

#paymentSection .payment-history-section {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
}

.order-section h2 {
    margin-bottom: 1rem;
    color: var(--text-dark);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.info-box {
    background: var(--bg-light);
    padding: 1rem;
    border-radius: 0.5rem;
    word-wrap: normal;
    overflow-wrap: normal;
    word-break: normal;
}

.info-row {
    padding: 0.5rem 0;
    word-wrap: normal !important;
    overflow-wrap: break-word !important;
    word-break: keep-all !important;
    white-space: normal;
    border-bottom: 1px solid var(--border-color);
    hyphens: none !important;
}

.info-row strong {
    display: inline-block;
    min-width: 80px;
    word-break: keep-all !important;
    white-space: nowrap;
    margin-right: 0.5rem;
}

.info-row:last-child {
    border-bottom: none;
}

.total-row {
    font-weight: bold;
    font-size: 1.125rem;
    color: var(--primary-color);
}

.status-form,
.invoice-form {
    margin-top: 1rem;
}

.filters {
    margin-bottom: 1.5rem;
}

.filter-form .form-row {
    margin-bottom: 0;
}

.filter-form .form-group {
    margin-bottom: 0;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.admin-nav {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    color: #fff;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-bottom: 3px solid var(--primary-color);
    position: relative;
}

.admin-nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.nav-menu-left,
.nav-menu-right {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.nav-menu-right {
    justify-content: flex-end;
}

.nav-brand-center {
    flex-shrink: 0;
    padding: 0 1rem;
    text-align: center;
}

.nav-brand-center h2,
.nav-brand h2 {
    color: #fff;
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.nav-brand-center h2::before,
.nav-brand h2::before {
    content: '🖨️';
    font-size: 1.35rem;
}

/* Mobile dropdown menu - hidden on desktop */
@media (min-width: 969px) {
    .nav-menu-mobile {
        display: none !important;
    }
}

.nav-menu-mobile {
    display: none;
    flex-direction: column;
    gap: 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, #374151 0%, #1f2937 100%);
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    z-index: 100;
}

.nav-menu-mobile.mobile-menu-open {
    max-height: 600px;
    padding: 0.75rem;
    overflow-y: auto;
}

.admin-nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    position: relative;
    width: 100%;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0;
    flex-shrink: 0;
    order: 1;
}

.nav-menu {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    flex: 0 0 auto;
    justify-content: flex-end;
    order: 2;
    margin-left: auto;
}

.nav-menu a {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    padding: 0.6rem 1rem;
    border-radius: 10px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    position: relative;
    white-space: nowrap;
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.15);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    backdrop-filter: blur(10px);
}

.nav-link {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    padding: 0.6rem 1rem;
    border-radius: 10px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    position: relative;
    white-space: nowrap;
}

.nav-box {
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.15);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    backdrop-filter: blur(10px);
}

.nav-menu a i,
.nav-link i {
    font-size: 0.9rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.nav-menu a:hover,
.nav-box:hover {
    background: rgba(255,255,255,0.18);
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    border-color: rgba(255,255,255,0.25);
}

.nav-menu a.active,
.nav-box.active {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.5);
    border-color: rgba(255,255,255,0.4);
    transform: translateY(-2px);
}

.nav-menu a.active::before,
.nav-box.active::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-radius: 14px;
    z-index: -1;
    opacity: 0.6;
    filter: blur(10px);
}

/* Settings dropdown (desktop) */
.nav-settings-dropdown {
    position: relative;
}
.nav-settings-dropdown .nav-link.nav-box {
    cursor: pointer;
    border: none;
    font: inherit;
    display: inline-flex;
    align-items: center;
}
.nav-settings-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.35rem;
    min-width: 200px;
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    padding: 0.5rem 0;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}
.nav-settings-dropdown.open .nav-settings-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.nav-settings-menu[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.nav-settings-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    color: #e2e8f0;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s;
}
.nav-settings-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

/* More dropdown – keeps nav compact (e.g. 75% zoom); same pattern as Settings */
.nav-more-dropdown {
    position: relative;
}
.nav-more-dropdown .nav-more-btn {
    cursor: pointer;
    border: none;
    font: inherit;
    display: inline-flex;
    align-items: center;
    background: transparent;
    color: inherit;
    padding: inherit;
}
.nav-more-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.35rem;
    min-width: 200px;
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    padding: 0.5rem 0;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}
.nav-more-dropdown.open .nav-more-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.nav-more-menu[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.nav-more-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    color: #e2e8f0;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s;
}
.nav-more-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}
.nav-more-item.active {
    background: rgba(59, 130, 246, 0.25);
    color: #fff;
}
.nav-settings-item i {
    width: 18px;
    text-align: center;
}

/* Mobile menu Settings group */
.nav-mobile-settings-wrap {
    width: 100%;
    position: relative;
    z-index: 2;
}
.nav-mobile-settings-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    cursor: pointer;
    background: transparent;
    border: none;
    color: inherit;
    font: inherit;
    text-align: left;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 0.95rem;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}
.nav-mobile-settings-btn:hover {
    background: rgba(255,255,255,0.1);
}
.nav-mobile-settings-btn i.fa-chevron-down {
    margin-left: auto;
    transition: transform 0.2s;
}
.nav-mobile-settings-wrap.open .nav-mobile-settings-btn i.fa-chevron-down {
    transform: rotate(180deg);
}
.nav-mobile-settings-sub {
    display: none;
    padding: 0.35rem 0 0 0.5rem;
    border-left: 2px solid rgba(255,255,255,0.15);
    margin-left: 0.75rem;
    visibility: visible;
    opacity: 1;
    min-height: 44px;
}
.nav-mobile-settings-wrap.open .nav-mobile-settings-sub {
    display: block;
    visibility: visible;
}
.nav-mobile-settings-sub a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9rem;
    border-radius: 8px;
    margin-bottom: 0.25rem;
}
.nav-mobile-settings-sub a:hover {
    background: rgba(255,255,255,0.06);
    color: #e2e8f0;
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    order: 3;
    margin-left: auto;
}

.mobile-menu-toggle span {
    width: 100%;
    height: 3px;
    background: #fff;
    border-radius: 3px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.nav-link-logout {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(220, 38, 38, 0.25));
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.4);
    margin-left: auto;
}

.nav-link-logout:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.35), rgba(220, 38, 38, 0.35));
    color: #fff;
    border-color: rgba(239, 68, 68, 0.6);
}

.nav-link-logout.active {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: rgba(255,255,255,0.4);
}

@media (max-width: 1200px) {
    .nav-menu {
        gap: 0.5rem;
    }
    
    .nav-menu a,
    .nav-link {
        padding: 0.55rem 0.9rem;
        font-size: 0.8rem;
    }
    
    .nav-menu a i,
    .nav-link i {
        font-size: 0.85rem;
        width: 16px;
    }
}

@media (max-width: 968px) {
    .mobile-menu-toggle {
        display: flex;
    }
    
    .nav-menu-left,
    .nav-menu-right {
        display: none !important;
    }
    
    .nav-menu-mobile {
        display: flex !important;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: linear-gradient(180deg, #374151 0%, #1f2937 100%);
        padding: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        box-shadow: 0 8px 24px rgba(0,0,0,0.3);
        z-index: 1000;
    }
    
    .nav-menu-mobile.mobile-menu-open {
        max-height: 600px;
        padding: 0.75rem;
        overflow-y: auto;
    }
    
    .nav-menu-mobile a,
    .nav-menu-mobile .nav-link {
        width: 100%;
        padding: 0.85rem 1rem;
        font-size: 0.9rem;
        justify-content: flex-start;
        border-radius: 8px;
    }
    
    .nav-brand-center {
        flex: 1;
        text-align: center;
    }
    
    .nav-brand-center h2 {
        font-size: 1rem;
        justify-content: center;
    }
    
    .admin-nav .container {
        padding: 1rem;
    }
    
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
        padding: 1rem;
        box-shadow: 0 4px 20px rgba(0,0,0,0.3);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
        z-index: 1000;
    }
    
    .nav-menu.mobile-menu-open {
        max-height: 600px;
        padding: 1rem;
    }
    
    .nav-menu a,
    .nav-link {
        width: 100%;
        padding: 0.85rem 1rem;
        font-size: 0.9rem;
        justify-content: flex-start;
        border-radius: 8px;
    }
    
    .nav-link span {
        display: inline;
    }
    
    .nav-link i {
        font-size: 1rem;
        width: 20px;
    }
    
    .nav-link-logout {
        margin-left: 0;
        margin-top: 0.5rem;
        order: 999;
    }
    
    .nav-brand h2 {
        font-size: 1rem;
    }
}

.admin-footer {
    background: var(--text-dark);
    color: #fff;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 4rem;
}

/* Orders Table Container */
.orders-table-container {
    overflow-x: visible;
    margin-top: 1rem;
    width: 100%;
    max-width: 100%;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

/* Alert Messages */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #86efac;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* Filters */
.filters {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.filter-form .form-row {
    margin-bottom: 0;
    align-items: end;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.pagination button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: #fff;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.3s;
}

.pagination button:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.pagination span {
    color: var(--text-dark);
    font-weight: 500;
}

/* Admin Sidebar */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 250px;
    background: var(--text-dark);
    color: #fff;
    padding: 1.5rem 0;
}

.admin-sidebar .logo {
    padding: 0 1.5rem;
    margin-bottom: 2rem;
}

.admin-sidebar .logo h2 {
    color: #fff;
    font-size: 1.25rem;
}

.admin-menu {
    list-style: none;
}

.admin-menu li {
    margin: 0;
}

.admin-menu a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: #fff;
    text-decoration: none;
    transition: background 0.3s;
}

.admin-menu a:hover,
.admin-menu a.active {
    background: rgba(255,255,255,0.1);
}

.admin-content {
    flex: 1;
    background: var(--bg-light);
}


/* Timeline Edit Notes Styles */
.timeline-item { position: relative; padding: 1rem; margin-bottom: 1rem; background: #fff; border: 1px solid var(--border-color); border-radius: 8px; transition: all 0.3s ease; }
.timeline-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.timeline-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 0.5rem; }
.timeline-status { font-weight: 600; color: var(--primary-color); font-size: 1.1rem; margin-bottom: 0.25rem; }
.timeline-date { font-size: 0.875rem; color: var(--text-light); margin-bottom: 0.25rem; }
.timeline-user { font-size: 0.875rem; color: var(--text-light); }
.btn-edit-notes { background: var(--primary-color); color: white; border: none; border-radius: 6px; padding: 0.5rem 0.75rem; cursor: pointer; transition: all 0.3s ease; font-size: 0.875rem; display: flex; align-items: center; gap: 0.25rem; }
.btn-edit-notes:hover { background: var(--secondary-color); transform: translateY(-2px); box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3); }
.timeline-notes-display { margin-top: 0.75rem; }
.timeline-notes { background: #f0f9ff; padding: 0.75rem; border-radius: 6px; border-left: 3px solid var(--primary-color); color: var(--text-dark); line-height: 1.6; }
.timeline-notes-empty { color: var(--text-light); font-style: italic; font-size: 0.875rem; }
.timeline-notes-edit { margin-top: 0.75rem; }
.edit-notes-textarea { width: 100%; padding: 0.75rem; border: 2px solid var(--border-color); border-radius: 6px; font-family: inherit; font-size: 0.95rem; resize: vertical; transition: border-color 0.3s; }
.edit-notes-textarea:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.edit-notes-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; }
.update-status-section { background: #fff; padding: 1.5rem; border-radius: 8px; border: 1px solid var(--border-color); margin-top: 1.5rem; }
.update-status-section h3 { margin-bottom: 1rem; color: var(--primary-color); display: flex; align-items: center; gap: 0.5rem; }
.status-form .form-row { display: grid; grid-template-columns: 1fr 2fr auto; gap: 1rem; align-items: end; }
.status-form .form-group label { display: block; margin-bottom: 0.5rem; font-weight: 600; color: var(--text-dark); }
.status-form textarea { width: 100%; padding: 0.75rem; border: 1px solid var(--border-color); border-radius: 6px; font-family: inherit; resize: vertical; }
.status-form textarea:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.status-form small { display: block; margin-top: 0.25rem; color: var(--text-light); font-size: 0.8rem; }
/* Mobile Responsive Styles */
@media (max-width: 768px) {
    /* Status Form */
    .status-form .form-row {
        grid-template-columns: 1fr;
    }
    
    .timeline-header {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-edit-notes {
        align-self: flex-end;
    }
    
    /* Page Content */
    .page-content {
        padding: 0.75rem;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    .page-header h1 {
        font-size: 1.25rem;
    }
    .page-header .btn {
        width: 100%;
    }
    .action-buttons {
        flex-direction: column;
    }
    .action-buttons .btn,
    .action-buttons .btn-sm {
        width: 100%;
        min-width: 100%;
    }
    
    /* Content Cards */
    .content-card {
        padding: 1rem;
        margin-bottom: 1rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Tables - Make scrollable */
    .data-table,
    .orders-table-container {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        display: block;
    }
    
    .data-table {
        min-width: 600px; /* Minimum width for table content */
    }
    
    .data-table thead,
    .data-table tbody,
    .data-table tr {
        display: table;
        width: 100%;
        table-layout: fixed;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem;
        font-size: 0.85rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Order Details Grid */
    .order-details-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Order Sections */
    .order-section {
        padding: 1rem;
        margin-bottom: 1rem;
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    /* Items List - Prevent overflow */
    .order-items-list,
    .items-list {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .order-item {
        min-width: 100%;
        box-sizing: border-box;
        padding: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .item-row {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .item-row .form-group {
        width: 100%;
    }
    
    /* Status Invoice Grid */
    .status-invoice-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Filters */
    .filter-form .form-row {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .filter-form .form-group {
        width: 100%;
    }
    
    .filter-form button,
    .filter-form a {
        width: 100%;
    }
    
    /* Buttons */
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        min-height: 44px; /* Better touch target */
        width: auto;
    }
    
    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        min-height: 36px;
    }
    
    /* Form Groups */
    .form-group {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    /* Info Boxes */
    .info-box {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .info-row {
        padding: 0.5rem 0;
        font-size: 0.9rem;
        word-wrap: break-word;
    }
    
    /* Timeline */
    .timeline-item {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Navigation Menu - Fix for mobile */
    .admin-nav {
        position: relative;
        z-index: 1000;
    }
    
    .admin-nav .container {
        position: relative;
        padding: 1rem;
        flex-wrap: wrap;
    }
    
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
        padding: 0;
        box-shadow: 0 4px 20px rgba(0,0,0,0.3);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
        z-index: 1001;
        margin: 0;
        order: 4;
    }
    
    .nav-menu.mobile-menu-open {
        max-height: 600px;
        padding: 1rem;
        overflow-y: auto;
    }
    
    .nav-link,
    .nav-menu a {
        width: 100%;
        padding: 0.85rem 1rem;
        font-size: 0.9rem;
        justify-content: flex-start;
        border-radius: 8px;
        box-sizing: border-box;
        margin: 0;
    }
    
    .nav-link span {
        display: inline;
    }
    
    .nav-brand {
        flex: 1;
        min-width: 0;
    }
    
    .nav-brand h2 {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Ensure menu doesn't push content down */
    .page-content {
        margin-top: 0;
    }
    
    /* Modal Responsive */
    .modal-content {
        max-width: 100% !important;
        max-height: 100vh !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }
    
    .modal-header {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .modal-header > div {
        width: 100%;
        justify-content: space-between;
    }
    
    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 1rem 0;
    }
    
    .pagination span {
        width: 100%;
        text-align: center;
        order: -1;
    }
    
    /* Invoice Table Actions */
    .data-table td:last-child {
        white-space: nowrap;
    }
    
    .data-table td:last-child > div {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    /* Summary Cards */
    .summary-display-item {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden;
        width: 100%;
    }
    
    html {
        overflow-x: hidden;
    }
    
    * {
        max-width: 100%;
    }
    
    /* Fix for items going out of display */
    .items-section,
    .order-items-section {
        width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }
}

/* ============================================
   TABLE ALIGNMENT FIXES - ALL TABLES
   Ensures consistent professional layout
   ============================================ */

/* Apply to all tables: Orders, Invoices, Payment History, Order Items */
table.data-table,
.items-table-container table,
.payment-history-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

table.data-table th,
table.data-table td,
.items-table-container table th,
.items-table-container table td,
.payment-history-table th,
.payment-history-table td {
    padding: 12px;
    vertical-align: middle;
    text-align: left;
    white-space: normal;
    word-break: break-word;
}

/* Customer column - consistent wrapping */
table.data-table td.customer-col,
table.data-table th:nth-child(2),
table.data-table td:nth-child(2),
.items-table-container table td.customer-col,
.payment-history-table td.customer-col {
    max-width: 220px;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* ============================================
   Order Details: Payment History & Order Items
   Any device: only table scrolls (horizontal);
   text never splits (no word in multiple rows)
   ============================================ */

/* Payment History - section stays fixed, only table scrolls horizontally */
.payment-history-section {
    width: 100%;
    overflow: visible;
    margin-top: 25px;
    margin-bottom: 0;
    padding-bottom: 0;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    display: block;
}

.payment-history-table-wrap {
    overflow-x: auto;
    overflow-y: visible;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    background: #fff;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    display: block;
    -webkit-overflow-scrolling: touch;
}

/* Ensure table maintains minimum width based on column widths */
.payment-history-table-wrap .payment-history-table {
    min-width: 1240px; /* Sum of all column widths: 160+130+100+180+120+200+350 = 1240px */
}

.payment-history-table-wrap .payment-history-table {
    table-layout: fixed !important;
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    display: table !important;
}

/* Proper text wrapping - prevent letter-by-letter breaking, wrap whole words only */
.payment-history-table-wrap .payment-history-table th,
.payment-history-table-wrap .payment-history-table td {
    padding: 10px 12px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    word-wrap: normal !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    line-height: 1.4;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
}

/* Header alignment */
.payment-history-table-wrap .payment-history-table th {
    text-align: left;
    font-weight: 600;
    background: var(--bg-light, #f9fafb);
    white-space: nowrap;
}

/* Column widths are now defined above with fixed pixel values */

.payment-history-table-wrap .payment-history-table tbody tr:last-child td {
    border-bottom: none;
}

.payment-history-table-wrap .payment-history-table thead {
    height: auto !important;
    min-height: 0 !important;
    display: table-header-group !important;
}

.payment-history-table-wrap .payment-history-table tbody {
    height: auto !important;
    min-height: 0 !important;
    display: table-row-group !important;
}

.payment-history-table-wrap .payment-history-table tbody tr {
    height: auto !important;
    min-height: 0 !important;
    display: table-row !important;
}

/* Ensure table cells don't have excessive height - CRITICAL */
.payment-history-table-wrap .payment-history-table th,
.payment-history-table-wrap .payment-history-table td {
    height: auto !important;
    min-height: 0 !important;
    max-height: fit-content !important;
    display: table-cell !important;
    vertical-align: top;
    padding: 10px 12px !important;
    line-height: 1.4 !important;
    box-sizing: border-box;
}

/* Prevent empty cells from expanding */
.payment-history-table-wrap .payment-history-table td:empty {
    height: auto !important;
    min-height: 0 !important;
    max-height: 1.4em !important;
    padding: 10px 12px !important;
}

/* Force payment history table to only take space of its content - CRITICAL FIX */
.payment-history-table-wrap .payment-history-table {
    height: auto !important;
    min-height: 0 !important;
    max-height: fit-content !important;
    table-layout: auto !important;
}

.payment-history-table-wrap .payment-history-table tbody {
    height: auto !important;
    min-height: 0 !important;
    max-height: fit-content !important;
}

.payment-history-table-wrap .payment-history-table tbody tr {
    height: auto !important;
    min-height: 0 !important;
    max-height: fit-content !important;
}

/* Ensure rows don't expand unnecessarily */
.payment-history-table-wrap .payment-history-table tbody tr td {
    height: auto !important;
    min-height: 0 !important;
    max-height: fit-content !important;
}

.payment-history-table-wrap .payment-history-table th {
    background: var(--bg-light, #f9fafb);
    font-weight: 600;
    white-space: nowrap;
}

/* Fixed column widths - similar to Orders table structure */
/* Date & Time: 160px */
.payment-history-table-wrap .payment-history-table th:nth-child(1),
.payment-history-table-wrap .payment-history-table td:nth-child(1) {
    width: 160px;
    min-width: 160px;
    max-width: 160px;
    white-space: nowrap;
    text-align: left;
}

/* Amount: 130px */
.payment-history-table-wrap .payment-history-table th:nth-child(2),
.payment-history-table-wrap .payment-history-table td:nth-child(2) {
    width: 130px;
    min-width: 130px;
    max-width: 130px;
    white-space: nowrap;
    text-align: right;
}

/* Mode: 100px */
.payment-history-table-wrap .payment-history-table th:nth-child(3),
.payment-history-table-wrap .payment-history-table td:nth-child(3) {
    width: 100px;
    min-width: 100px;
    max-width: 100px;
    white-space: nowrap;
    text-align: center;
}

/* Transaction ID: 180px */
.payment-history-table-wrap .payment-history-table th:nth-child(4),
.payment-history-table-wrap .payment-history-table td:nth-child(4) {
    width: 180px;
    min-width: 180px;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

/* Status: 120px */
.payment-history-table-wrap .payment-history-table th:nth-child(5),
.payment-history-table-wrap .payment-history-table td:nth-child(5) {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
    white-space: nowrap;
    text-align: center;
}

/* Processed By: 200px */
.payment-history-table-wrap .payment-history-table th:nth-child(6),
.payment-history-table-wrap .payment-history-table td:nth-child(6) {
    width: 200px;
    min-width: 200px;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

/* Notes: 350px - wraps properly */
.payment-history-table-wrap .payment-history-table th:nth-child(7),
.payment-history-table-wrap .payment-history-table td:nth-child(7) {
    width: 350px;
    min-width: 350px;
    max-width: 350px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    text-align: left;
}

/* Order Items - responsive table, no horizontal scroll, proper wrapping */
.order-section .items-table-container {
    overflow-x: visible;
    overflow-y: visible;
    width: 100%;
    max-width: 100%;
    margin: 0;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
    background: #fff;
}

.order-section .items-table-container table.data-table {
    table-layout: fixed;
    width: 100%;
    margin: 0;
    border-collapse: collapse;
}

/* Proper text wrapping - allow wrapping for better fit */
.order-section .items-table-container table.data-table th,
.order-section .items-table-container table.data-table td {
    padding: 12px 14px;
    vertical-align: top;
    text-align: left;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.order-section .items-table-container table.data-table th {
    background: var(--bg-light, #f9fafb);
    font-weight: 600;
    white-space: nowrap;
}

/* Column widths (Order Items: S.No, Item Name, Status, Size, Paper Type, Color, Side, Binding, Qty, Rate, Amount) */
.order-section .items-table-container table.data-table th:nth-child(1),
.order-section .items-table-container table.data-table td:nth-child(1) { width: 5%; }  /* S.No */
.order-section .items-table-container table.data-table th:nth-child(2),
.order-section .items-table-container table.data-table td:nth-child(2) { width: 18%; } /* Item Name - wider for wrapping */
.order-section .items-table-container table.data-table th:nth-child(3),
.order-section .items-table-container table.data-table td:nth-child(3) { width: 15%; } /* Status - wider for badge + priority */
.order-section .items-table-container table.data-table th:nth-child(4),
.order-section .items-table-container table.data-table td:nth-child(4) { width: 8%; }   /* Size */
.order-section .items-table-container table.data-table th:nth-child(5),
.order-section .items-table-container table.data-table td:nth-child(5) { width: 10%; } /* Paper Type */
.order-section .items-table-container table.data-table th:nth-child(6),
.order-section .items-table-container table.data-table td:nth-child(6) { width: 7%; }  /* Color */
.order-section .items-table-container table.data-table th:nth-child(7),
.order-section .items-table-container table.data-table td:nth-child(7) { width: 8%; }  /* Side */
.order-section .items-table-container table.data-table th:nth-child(8),
.order-section .items-table-container table.data-table td:nth-child(8) { width: 8%; }  /* Binding */
.order-section .items-table-container table.data-table th:nth-child(9),
.order-section .items-table-container table.data-table td:nth-child(9) { width: 5%; }  /* Qty */
.order-section .items-table-container table.data-table th:nth-child(10),
.order-section .items-table-container table.data-table td:nth-child(10) { width: 8%; } /* Rate */
.order-section .items-table-container table.data-table th:nth-child(11),
.order-section .items-table-container table.data-table td:nth-child(11) { width: 8%; } /* Amount */

/* Override generic customer-col so these sections never wrap text */
.payment-history-table-wrap .payment-history-table td.customer-col,
.order-section .items-table-container table.data-table td.customer-col {
    max-width: none;
    word-break: keep-all;
    white-space: nowrap;
}

/* Small screens: compact padding, maintain proper wrapping */
@media (max-width: 768px) {
    .payment-history-table-wrap .payment-history-table th,
    .payment-history-table-wrap .payment-history-table td,
    .order-section .items-table-container table.data-table th,
    .order-section .items-table-container table.data-table td {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
    
    /* Customer Information Section - Mobile Fixes */
    .info-row {
        word-break: keep-all !important;
        overflow-wrap: break-word !important;
        word-wrap: normal !important;
        white-space: normal !important;
        hyphens: none !important;
    }
    
    .info-row strong {
        word-break: keep-all !important;
        white-space: nowrap;
    }
    
    /* Mobile number - keep together */
    .info-row:has(strong:contains("Mobile")) {
        word-break: keep-all !important;
    }
    
    /* Buttons visibility on mobile */
    .page-header .btn,
    .page-header button {
        min-width: auto !important;
        white-space: nowrap !important;
        word-break: keep-all !important;
        font-size: 0.875rem !important;
        padding: 0.5rem 0.75rem !important;
    }
    
    /* Payment History - Mobile */
    .payment-history-table-wrap {
        overflow-x: auto;
    }
    
    .payment-history-table-wrap .payment-history-table {
        min-width: 600px;
    }
    
    /* Ensure tables still fit without horizontal scroll */
    .payment-history-table-wrap,
    .order-section .items-table-container,
    .orders-table-container {
        overflow-x: visible;
    }
    
    /* Slightly adjust column widths on mobile for better fit */
    .order-section .items-table-container table.data-table th:nth-child(2),
    .order-section .items-table-container table.data-table td:nth-child(2) { width: 20%; } /* Item Name */
    .order-section .items-table-container table.data-table th:nth-child(3),
    .order-section .items-table-container table.data-table td:nth-child(3) { width: 18%; } /* Status */
    
    /* Customer Information Section - Mobile Fixes */
    .info-row {
        word-break: keep-all !important;
        overflow-wrap: break-word !important;
        word-wrap: normal !important;
        white-space: normal !important;
        hyphens: none !important;
    }
    
    .info-row strong {
        word-break: keep-all !important;
        white-space: nowrap;
        display: inline-block;
        min-width: 70px;
    }
    
    /* Mobile number - keep together, no letter breaking */
    .info-box .info-row {
        word-break: keep-all !important;
        overflow-wrap: break-word !important;
    }
    
    /* Buttons visibility on mobile */
    .page-header .btn,
    .page-header button,
    .page-header a.btn {
        min-width: auto !important;
        white-space: nowrap !important;
        word-break: keep-all !important;
        font-size: 0.875rem !important;
        padding: 0.5rem 0.75rem !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 0.25rem !important;
    }
    
    /* Payment History - Mobile responsive */
    .payment-history-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .payment-history-table-wrap .payment-history-table {
        min-width: 1240px; /* Maintain fixed column widths on mobile - horizontal scroll */
    }
}

    /* iPhone specific fixes */
@media (max-width: 480px) {
    .page-content {
        padding: 0.5rem;
    }
    
    .content-card {
        padding: 0.75rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.4rem;
        font-size: 0.8rem;
    }
    
    .btn {
        padding: 0.65rem 0.85rem;
        font-size: 0.85rem;
    }
    
    .modal-header h2 {
        font-size: 1rem;
    }
    
    .btn-text {
        display: none;
    }
    
    .btn i {
        margin: 0;
    }
}

/* Global mobile: prevent display overflow, fit to screen (works in browser + app wrapper) */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
        -webkit-overflow-scrolling: touch;
    }
    body {
        position: relative;
    }
    .page-content {
        padding: 1rem;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    .page-header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    .page-header h1 {
        font-size: 1.25rem;
        word-break: break-word;
    }
    .content-card, .order-section, .card {
        max-width: 100%;
        box-sizing: border-box;
    }
    .data-table-wrapper, .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }
}
