/* =====================================================
 * 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); }

/* ── 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.95rem;
    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.95rem; vertical-align: middle;
}
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;
}
.select-pending   { background: #fff3cd; color: #856404; }
.select-completed { background: #d4edda; color: #155724; }
.select-delivered { background: #cce5ff; color: #004085; }

/* ── 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-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: 900px; 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);
}

/* ── Order Items Row ── */
.orders-item-row {
    display: grid; grid-template-columns: 2fr 1fr 1fr auto;
    gap: 10px; align-items: center; background: white;
    padding: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.orders-item-row input { padding: 10px; border: 1px solid var(--border); border-radius: 0; width: 100%; }
.orders-btn-remove-item {
    color: #ef4444; background: #fee2e2; border: none; width: 35px; height: 35px; border-radius: 0; cursor: pointer; transition: 0.2s;
}
.orders-btn-remove-item:hover { background: #ef4444; color: white; }
.orders-discount-box { display: flex; gap: 5px; }
.orders-discount-input { flex: 1; }
.orders-discount-select { width: 80px; padding: 0 5px; }
.orders-items-header-row {
    font-weight: 700; border-bottom: 1px solid var(--border);
    padding-bottom: 10px; margin-top: 30px; margin-bottom: 20px;
    display: flex; justify-content: space-between; align-items: center;
}
.orders-items-list-container { display: flex; flex-direction: column; gap: 12px; }

/* ── Modal Internal ── */
.modal-section-title { font-weight: 700; border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-top: 30px; margin-bottom: 20px; }
.modal-total-display { font-size: 1.2rem; color: var(--primary); font-weight: 800; flex: 1; }

/* ── Bottom Action Bar ── */
.app-bottom-bar {
    position: relative; height: 80px; background: #ffffff;
    display: flex; align-items: center; justify-content: center; 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; }

.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: var(--spacing-card); padding: 0 0 var(--spacing-card) 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: monospace; 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;
}
