/* Orders Page Styles */
.orders-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1.25rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e0e0e0;
}

.orders-header h2 {
    color: #2c3e50;
    margin: 0;
}

.orders-header .header-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 1rem;
}

.orders-header .filter-controls {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    gap: 0.75rem;
}

.orders-header .filter-controls select {
    flex: 1 1 200px;
    min-width: 180px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: white;
    font-family: "Sansation", sans-serif;
    font-size: 0.9rem;
}

.orders-header .action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.orders-header .action-buttons .btn-primary,
.orders-header .action-buttons .btn-secondary,
.orders-header .action-buttons button,
.orders-header .action-buttons a {
    width: 100%;
    justify-content: center;
}

.btn-primary,
.btn-secondary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-family: "Sansation", sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

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

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s ease;
}

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

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    font-size: 1.3rem;
}

.stat-content h3 {
    margin: 0 0 0.5rem 0;
    color: #7f8c8d;
    font-size: 0.9rem;
    font-weight: 400;
}

.stat-content h2 {
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
    font-size: 1.6rem;
    font-weight: 700;
}

.stat-change {
    font-size: 0.8rem;
    color: #27ae60;
}

.stat-subtitle {
    font-size: 0.8rem;
    color: #95a5a6;
}

/* Orders Table */
.orders-table-container {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #ecf0f1;
}

.table-header h3 {
    margin: 0;
    color: #2c3e50;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 0.75rem;
    color: #bdc3c7;
    font-size: 1.1rem;
}

.search-box input {
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    width: 400px;
    font-family: "Sansation", sans-serif;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.search-box input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1), 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.search-box input::placeholder {
    color: #adb5bd;
    font-style: italic;
}

.search-box i {
    color: #3498db;
    font-size: 1.2rem;
    left: 0.75rem;
}

/* Simple table controls */
.table-controls {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem 0;
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* Compact View Styles */
.compact-view .data-table td {
    padding: 0.5rem 0.5rem;
    font-size: 0.85rem;
}

.compact-view .customer-info small {
    display: none;
}

.compact-view .date-text {
    font-size: 0.8rem;
}

.compact-view .action-buttons {
    gap: 0.125rem;
}

.compact-view .btn-icon {
    padding: 0.25rem;
    font-size: 0.8rem;
}

.compact-view .status-badge {
    padding: 0.125rem 0.5rem;
    font-size: 0.7rem;
}

/* Search highlighting */
.search-highlight {
    background-color: #fff3cd;
    padding: 1px 2px;
    border-radius: 2px;
    font-weight: 600;
}

.table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    height: 30vh;
    margin-bottom: 1rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    position: relative;
}

/* Custom scrollbar styling */
.table-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Invoice-specific table wrapper */
.invoice-table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    height: 25vh;
    margin-bottom: 1rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    position: relative;
}

/* Custom scrollbar styling for invoice table */
.invoice-table-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.invoice-table-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.invoice-table-wrapper::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

.invoice-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th {
    background-color: #f8f9fa;
    padding: 1rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #e9ecef;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid #f1f2f6;
    vertical-align: middle;
}

.data-table tr:hover {
    background-color: #f8f9fa;
}

.order-numbers {
    line-height: 1.3;
}

.order-numbers strong {
    color: #2c3e50;
    font-size: 0.95rem;
}

.customer-info strong {
    display: block;
    color: #2c3e50;
}

.customer-info small {
    color: #7f8c8d;
    font-size: 0.8rem;
}

/* Invoice table specific styles */
.date-text {
    color: #2c3e50;
    font-size: 0.9rem;
}

.amount-text {
    color: #27ae60;
    font-size: 0.95rem;
}

.amount-text strong {
    font-weight: 600;
}

/* Table cell hover effects */
.data-table tr:hover .amount-text {
    color: #219a52;
}

.data-table tr:hover .order-numbers a {
    color: #2980b9 !important;
}

.products-summary {
    color: #7f8c8d;
    font-size: 0.85rem;
}

.profit-amount {
    color: #27ae60;
    font-weight: 600;
}

/* Status Badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-processing {
    background-color: #cce5ff;
    color: #0066cc;
}

.status-shipped {
    background-color: #e2e3ff;
    color: #6c5ce7;
}

.status-completed {
    background-color: #d5f4e6;
    color: #27ae60;
}

.status-cancelled {
    background-color: #fadbd8;
    color: #e74c3c;
}

/* Invoice-specific status styles */
.status-paid {
    background-color: #d5f4e6;
    color: #27ae60;
}

.status-overdue {
    background-color: #fadbd8;
    color: #e74c3c;
}

.status-draft {
    background-color: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.status-sent {
    background-color: #cce5ff;
    color: #0066cc;
}

/* Payment status styles */
.status-partial {
    background-color: #fff3cd;
    color: #856404;
}

.status-unpaid {
    background-color: #fadbd8;
    color: #e74c3c;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.25rem;
}

.btn-icon {
    padding: 0.5rem;
    border: none;
    border-radius: 6px;
    background-color: #ecf0f1;
    color: #7f8c8d;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background-color: #3498db;
    color: white;
}

.btn-icon i {
    font-size: 1rem;
}

.complete-btn {
    background-color: #28a745 !important;
    color: white !important;
}

.complete-btn:hover {
    background-color: #218838 !important;
    transform: scale(1.05);
}

.mark-paid-btn {
    background-color: #4caf50 !important;
    color: white !important;
}

.mark-paid-btn:hover {
    background-color: #45a049 !important;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.mark-unpaid-btn {
    background-color: #ff9800 !important;
    color: white !important;
}

.mark-unpaid-btn:hover {
    background-color: #f57c00 !important;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
}

.edit-btn {
    background-color: #3498db !important;
    color: white !important;
}

.edit-btn:hover {
    background-color: #2980b9 !important;
    transform: scale(1.05);
}

.pending-btn {
    background-color: #ff9800 !important;
    color: white !important;
}

.pending-btn:hover {
    background-color: #f57c00 !important;
    transform: scale(1.05);
}

/* Pagination */
.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid #ecf0f1;
}

.pagination-info {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background-color: white;
    color: #7f8c8d;
    cursor: pointer;
    font-family: "Sansation", sans-serif;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #ecf0f1;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

.close {
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
    transition: color 0.2s ease;
}

.close:hover {
    color: #000;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1.5rem;
    border-top: 1px solid #ecf0f1;
}

/* Order Details */
.order-details {
    font-size: 0.9rem;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #ecf0f1;
}

.order-header h4 {
    margin: 0;
    color: #2c3e50;
}

.order-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.info-section h5 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1rem;
    border-bottom: 1px solid #ecf0f1;
    padding-bottom: 0.5rem;
}

.info-section p {
    margin: 0.5rem 0;
    color: #7f8c8d;
}

.products-section h5 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1rem;
    border-bottom: 1px solid #ecf0f1;
    padding-bottom: 0.5rem;
}

.products-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.products-table th {
    background-color: #f8f9fa;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid #dee2e6;
}

.products-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #f1f2f6;
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: "Sansation", sans-serif;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Radio Button Styles */
.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.radio-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: #2c3e50;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.radio-option:hover {
    background-color: #f8f9fa;
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-radius: 50%;
    margin-right: 8px;
    position: relative;
    transition: all 0.3s ease;
}

.radio-option input[type="radio"]:checked + .radio-custom {
    border-color: #3498db;
    background-color: #3498db;
}

.radio-option input[type="radio"]:checked + .radio-custom::after {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.company-section {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.company-section h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

/* Company Badge Styles */
.company-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 6px;
    letter-spacing: 0.5px;
}

.company-zymr {
    background-color: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

.company-qc {
    background-color: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #ce93d8;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    z-index: 9999;
    animation: slideIn 0.3s ease;
}

.notification-success {
    background-color: #27ae60;
}

.notification-error {
    background-color: #e74c3c;
}

.notification-info {
    background-color: #3498db;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .orders-header {
        gap: 4vw;
        align-items: flex-start;
    }

    .orders-header .header-actions {
        gap: 3vw;
    }

    .orders-header .filter-controls {
        gap: 3vw;
    }

    .order-stats {
        grid-template-columns: 1fr;
        gap: 4vw;
    }

    .table-header {
        flex-direction: column;
        gap: 4vw;
        align-items: flex-start;
    }

    .search-box input {
        width: 100%;
        padding: 3.5vw 3.5vw 3.5vw 9vw;
        font-size: 3.8vw;
    }

    .order-info-grid {
        grid-template-columns: 1fr;
        gap: 4vw;
    }

    .modal-content {
        width: 92vw;
        margin: 4vw auto;
        padding: 5vw;
    }

    .orders-header .action-buttons {
        gap: 3vw;
    }

    .table-pagination {
        flex-direction: column;
        gap: 4vw;
        align-items: flex-start;
    }

    .order-item {
        grid-template-columns: 1fr;
    }

    .order-item-actions {
        justify-content: flex-start;
    }

    .order-item-actions .remove-item {
        width: 100%;
    }

    .product-autocomplete-dropdown {
        max-height: 180px;
    }
}

/* Large Modal Styles for Order Creation */
.large-modal {
    max-width: 1200px !important;
    width: 95% !important;
    max-height: 90vh;
    overflow-y: auto;
}

.order-header-section {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.customer-section {
    background: #f0f8ff;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.products-section {
    background: #f0fff0;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.totals-section {
    background: #fff5f5;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.payment-section {
    background: #fffacd;
    padding: 15px;
    border-radius: 6px;
}

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

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 5px;
    color: #2c3e50;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: "Sansation", sans-serif;
    font-size: 0.9rem;
}

.order-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr 50px;
    gap: 10px;
    align-items: end;
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
}

.order-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 6px rgba(0, 123, 255, 0.12);
}

.order-item-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.order-item-field label {
    font-weight: 600;
    color: #2c3e50;
}

.order-item-field input,
.order-item-field select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: "Sansation", sans-serif;
    font-size: 0.9rem;
}

.order-item-field input[readonly] {
    background: #f8f9fa;
}

.order-item-product {
    position: relative;
}

.order-item-product-helper {
    margin-top: 4px;
    font-size: 0.75rem;
}

.order-item-product-helper a {
    color: #007bff;
    text-decoration: none;
}

.order-item-product-helper a:hover {
    text-decoration: underline;
}

.product-autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
    max-height: 200px;
    overflow-y: auto;
}

.dropdown-item {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: #f5f9ff;
}

.dropdown-empty {
    padding: 8px 10px;
    color: #666;
    font-size: 0.85rem;
}

.hide-on-mobile {
    display: block;
}

.order-item-actions {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
}

.order-item-actions .remove-item {
    background: #dc3545;
    color: #fff;
    border: none;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    min-width: 40px;
}

.order-item-actions .remove-item:hover {
    background: #c82333;
}

.btn-success {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: "Sansation", sans-serif;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-success:hover {
    background-color: #218838;
    transform: translateY(-1px);
}

/* Responsive adjustments for large modal */
@media (max-width: 1024px) {
    .large-modal {
        width: 96vw !important;
        margin: 2vw auto !important;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .order-item {
        grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
        gap: 14px;
    }
}

/* Amount Display Styles */
.amount-display {
    text-align: left;
    line-height: 1.4;
}

.amount-display .total-amount {
    font-weight: bold;
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
}

.amount-display .payment-breakdown {
    font-size: 12px;
    line-height: 1.3;
}

.amount-display .payment-breakdown > div {
    margin: 1px 0;
}
