/* =====================================================
 * 04-components.css - Shared UI Components
 * Buttons, Tables, Forms, Badges, Cards, Modals
 * ===================================================== */

/* ── View Header ── */
.orders-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 24px 0;
    gap: 16px;
    flex-wrap: wrap;
}

.orders-title-section h1 {
    font-size: 2rem;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.orders-title-section p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.orders-header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* ── Buttons ── */
.orders-btn-primary,
.btn-submit {
    background: var(--primary);
    color: white;
    border: none;
    height: var(--btn-height);
    padding: 0 24px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: none;
}

.orders-btn-primary:hover,
.btn-submit:hover {
    background: var(--primary-dark);
}

.orders-btn-secondary,
.btn-secondary {
    background: var(--bg-white);
    color: var(--text-dark);
    border: 1px solid var(--border);
    height: var(--btn-height);
    padding: 0 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.orders-btn-secondary:hover,
.btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--primary);
}

.btn-add-item-small {
    background: #f0ecff;
    color: var(--primary);
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.2s;
}

.btn-add-item-small:hover {
    background: var(--primary);
    color: white;
}

.actions-btn {
    width: var(--btn-height);
    height: var(--btn-height);
    border: 1px solid var(--border);
    background: #f8f9fa;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.actions-btn:hover {
    background: var(--primary);
    color: white;
}

.copy-small-btn {
    background: transparent;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 0.8rem;
    margin-right: 5px;
    transition: 0.2s;
}

.copy-small-btn:hover {
    color: var(--primary);
}

.whatsapp-btn {
    background: transparent;
    border: none;
    color: #25D366;
    cursor: pointer;
    font-size: 1.1rem;
    margin-right: 8px;
    transition: 0.2s;
    vertical-align: middle;
}

.whatsapp-btn:hover {
    color: #128C7E;
    transform: scale(1.15);
}

/* ── Stat Cards ── */
.orders-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-card);
}

.orders-stat-card {
    background: var(--bg-white);
    padding: var(--spacing-card);
    text-align: center;
    border: 1px solid var(--border);
    transition: all 0.2s;
    box-shadow: none;
}

.orders-stat-card:hover {
    border-color: var(--primary);
    background: #f8f9fa;
}

.orders-stat-card h3 {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.orders-stat-card p {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--primary);
}

.orders-stat-card p.accent {
    color: var(--accent-dark);
}

/* ── Filters / Search bar ── */
.orders-filters-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.orders-search-bar {
    position: relative;
    width: 400px;
}

.orders-search-bar i {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.orders-search-bar input {
    width: 100%;
    height: var(--btn-height);
    padding: 0 45px 0 15px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-white);
    font-size: 1rem;
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.orders-search-bar input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(95, 61, 196, 0.1);
}

.orders-status-filter {
    width: 160px;
    height: var(--btn-height);
    padding: 0 10px;
    border-radius: var(--radius-sm);
}

/* ── Table ── */
.orders-table-container {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 700;
    text-align: right;
    padding: 18px var(--margin-main);
    font-size: 0.85rem;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 16px var(--margin-main);
    border-bottom: 1px solid var(--border);
    color: var(--text-dark);
    font-size: 0.85rem;
    vertical-align: middle;
}

td:first-child {
    font-family: 'RTA', Tahoma, sans-serif !important;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #fbfbfe;
}

/* ── Status Select ── */
.status-select {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    outline: none;
    text-align: center;
    min-width: 110px;
    appearance: none;
}


/* ── Status Badge ── */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* ── Badge Utilities ── */
.badge {
    display: inline-block;
    padding: 4px 12px;
    font-weight: 700;
    font-size: 0.85rem;
}

.badge-soft-primary {
    background: #f0ecff;
    color: var(--primary);
}

.badge-soft-orange {
    background: #fff7ed;
    color: #ea580c;
}

.badge-soft-muted {
    background: #f1f3f5;
    color: var(--text-muted);
}

.badge-danger-soft {
    background: #fff5f5;
    color: #e05252;
    border: 1px solid #fca5a5;
}

/* ── Modals (Unified) ── */
.orders-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
}

.orders-modal-overlay.active {
    display: flex;
    opacity: 1;
}

.orders-modal-container {
    background: var(--bg-white);
    width: 800px;
    max-width: 95%;
    max-height: 90vh;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2), 0 0 0 1px var(--border);
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    border-radius: 0;
}

.orders-modal-container.modal-sm {
    max-width: 450px;
    width: 100%;
}

.orders-modal-container.modal-md {
    max-width: 650px;
    width: 100%;
}

.orders-modal-container.modal-lg {
    max-width: 950px;
    width: 100%;
}

.orders-modal-container.modal-xl {
    max-width: 1200px;
    width: 100%;
}

.orders-modal-overlay.active .orders-modal-container {
    transform: scale(1);
}

.orders-modal-header {
    padding: var(--margin-main);
    border-bottom: 2px solid var(--primary-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
}

.orders-modal-header h2 {
    color: var(--primary);
    font-size: 1.4rem;
    font-weight: 900;
}

.orders-btn-close-modal {
    background: #f8fafc;
    border: 1px solid var(--border);
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    color: var(--text-dark);
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.orders-btn-close-modal:hover {
    background: #fee2e2;
    color: #ef4444;
    border-color: #fca5a5;
}

.orders-modal-body,
.orders-order-form-modal {
    padding: var(--margin-main);
    overflow-y: auto;
    flex: 1;
}

.orders-modal-footer {
    padding: var(--margin-main);
    background: #fbfbfc;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
}

.orders-modal-footer button {
    height: var(--btn-height);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 800;
    transition: all 0.2s;
}

/* ── Form Elements ── */
.orders-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--margin-main);
    margin-bottom: 10px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.form-group label {
    font-weight: 800;
    color: var(--text-dark);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 14px 18px;
    border: 1px solid var(--border);
    font-size: 1rem;
    outline: none;
    transition: 0.2s;
    background: #fcfcfd;
    color: var(--text-dark);
    width: 100%;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(142, 113, 240, 0.1);
}

/* ── Specific Notes Textarea Style ── */
#orders-notes {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 15px;
    font-size: 0.95rem;
    line-height: 1.6;
    background: #ffffff;
    transition: all 0.3s ease;
    min-height: 100px;
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

#orders-notes:focus {
    border-color: var(--primary);
    background: #fdfcff;
    box-shadow: 0 0 0 4px rgba(142, 113, 240, 0.1), inset 0 2px 4px rgba(0, 0, 0, 0.01);
}

/* ── Modal Internal ── */
.modal-section-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 20px;
    margin-bottom: 24px;
    transition: all 0.3s ease;
}

.modal-section-card:hover {
    border-color: var(--primary-light);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    background: #ffffff;
}

.modal-section-title {
    font-weight: 900;
    padding-bottom: 12px;
    margin-bottom: 20px;
    color: var(--primary);
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px dashed var(--border);
}

.modal-section-title i {
    opacity: 0.7;
}

.modal-total-display {
    font-size: 1.25rem;
    color: var(--primary);
    font-weight: 900;
    flex: 1;
}

.modal-total-display strong {
    font-size: 1.6rem;
    margin: 0 4px;
}

/* ── Item Card Design ── */
.orders-item-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    background: #ffffff;
    padding: 16px;
    border: 1px solid var(--border);
    margin-bottom: 12px;
    position: relative;
    transition: all 0.2s;
}

.orders-item-row:hover {
    border-color: var(--primary-light);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.item-row-main {
    display: grid;
    grid-template-columns: 2fr 80px 100px 100px 40px;
    gap: 15px;
    align-items: flex-end;
}

.orders-btn-remove-item {
    width: 40px;
    height: 42px;
    background: #fff5f5;
    color: #ef4444;
    border: 1px solid #fee2e2;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s;
}

.orders-btn-remove-item:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

/* ── Bottom Action Bar ── */
.app-bottom-bar {
    position: relative;
    height: 80px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 24px;
    z-index: 99;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.bottom-bar-btn {
    height: var(--btn-height);
    padding: 0 24px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.bottom-bar-btn i {
    font-size: 1.1rem;
}

.bottom-bar-btn-primary {
    background: var(--primary);
    color: white;
}

.bottom-bar-btn-primary:hover {
    background: var(--primary-dark);
}

.bottom-bar-btn-secondary {
    background: #f8fafc;
    color: var(--text-dark);
    border: 1px solid var(--border);
}

.bottom-bar-btn-secondary:hover {
    background: #ffffff;
    border-color: var(--primary-light);
}

.bottom-bar-btn-danger {
    background: #fee2e2;
    color: #e05252;
    border: 1px solid #fca5a5;
}

.bottom-bar-btn-danger:hover {
    background: #e05252;
    color: white;
}

.bottom-bar-btn-purple {
    background: #8e71f0;
    color: #ffffff;
}

.bottom-bar-btn-purple:hover {
    background: #7048e8;
    transform: translateY(-2px);
}

.delete-all-btn {
    background: #ef4444;
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.delete-all-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.btn-export-shiply,
.btn-export-miss {
    background: #10b981 !important;
    color: white !important;
    border-color: #059669 !important;
}

.btn-export-shiply:hover,
.btn-export-miss:hover {
    background: #059669 !important;
}

/* ── Text Utilities ── */
.text-brand {
    color: var(--primary);
}

.text-bold {
    font-weight: 700;
}

.text-small {
    font-size: 0.85rem;
}

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

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* ── Layout Utilities ── */
.u-flex-end {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: flex-end;
}

.u-p-0 {
    padding: 0 !important;
}

.u-p-0-v {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.u-pb-24 {
    padding-bottom: var(--margin-main) !important;
}

.u-bg-transparent {
    background: transparent !important;
}

.u-border-none {
    border: none !important;
}

.u-hide {
    display: none !important;
}

.u-w-full {
    width: 100% !important;
}

.u-text-center {
    text-align: center !important;
}

.u-fw-bold {
    font-weight: 800 !important;
}

.u-fs-small {
    font-size: 0.9rem !important;
}

.u-mt-10 {
    margin-top: 10px !important;
}

.u-mt-20 {
    margin-top: 20px !important;
}

.u-mb-15 {
    margin-bottom: 15px !important;
}

.u-v-border-top {
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
}

.u-mt-auto {
    margin-top: auto !important;
}

.u-mt-card {
    margin-top: var(--spacing-card) !important;
}

.u-flex-1 {
    flex: 1 !important;
}

/* ── Misc Component Classes ── */
.products-filter-group {
    margin-bottom: 24px;
    padding: 0;
}

.pos-header-spacing {
    padding: 0 !important;
}

.product-img-upload-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.status-color-input {
    height: var(--btn-height) !important;
    padding: 2px !important;
}

.id-column-style {
    display: inline-block;
    font-family: 'RTA', Tahoma, sans-serif;
    font-size: 0.82rem;
}

/* ── Remove Image Button Overlay ── */
.btn-remove-img-overlay {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 28px;
    height: 28px;
    background: #ff4d4d;
    color: white;
    border: none;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    z-index: 5;
    transition: all 0.2s;
}

.btn-remove-img-overlay:hover {
    background: #e63939;
}

/* ── Empty State ── */
.empty-state-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5rem 2rem;
    color: var(--text-muted);
    text-align: center;
    width: 100%;
}

.empty-state-icon {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    opacity: 0.2;
    color: var(--primary);
    transition: transform 0.3s ease;
}

.empty-state-text {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-muted);
}

/* ── Pagination ── */
.pagination-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pagination-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid var(--border);
    color: var(--text-dark);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: #fdfcff;
}

.pagination-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: #f8fafc;
}

.pagination-dots {
    color: #cbd5e1;
    padding: 0 4px;
    font-weight: 700;
}

.footer-pagination-left {
    flex: 1;
    display: flex;
    justify-content: flex-start;
}

.footer-actions-right {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
    /* Push to the end of the container */
}