/* ===================================================
   Global
   =================================================== */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Tajawal', sans-serif;
    background-color: #f0f2f5;
    color: #1a1a2e;
    font-size: 0.95rem;
}

/* ===================================================
   Login page
   =================================================== */
.login-bg {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    border: none;
    border-radius: 16px;
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, #714B67, #017E84);
    color: white;
    border: none;
}

.login-logo {
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

/* ===================================================
   Navbar
   =================================================== */
.app-navbar {
    background: linear-gradient(90deg, #714B67 0%, #017E84 100%);
    padding: 0.6rem 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* ===================================================
   Cards / sections
   =================================================== */
.card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.section-header {
    background-color: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    padding: 0.6rem 1rem;
}

.section-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ===================================================
   Customer info box
   =================================================== */
.customer-info-box {
    background: linear-gradient(135deg, #f0fff4, #e6fffa);
    border: 1px solid #9ae6b4;
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

.info-label {
    font-size: 0.72rem;
    color: #718096;
    font-weight: 500;
    margin-bottom: 2px;
}

.info-value {
    font-size: 0.9rem;
    color: #1a202c;
    word-break: break-word;
}

/* ===================================================
   Select2 RTL fix
   =================================================== */
.select2-container--default .select2-selection--single {
    height: 42px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    display: flex;
    align-items: center;
    padding: 0 10px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: normal;
    padding: 0;
    color: #212529;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    top: 50%;
    transform: translateY(-50%);
    left: 8px;
    right: auto;
}

.select2-container--default .select2-results__option--highlighted {
    background-color: #017E84 !important;
}

.select2-dropdown {
    border-color: #ced4da;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 9999;
}

.select2-search--dropdown .select2-search__field {
    border-radius: 4px;
    border-color: #ced4da;
}

/* ===================================================
   Product search dropdown
   =================================================== */
.product-results-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    z-index: 1050;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 320px;
    overflow-y: auto;
    margin-top: 4px;
}

.product-result-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

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

.product-result-item:hover {
    background-color: #f0fff4;
}

.product-result-item .p-name {
    font-weight: 600;
    font-size: 0.9rem;
    flex: 1;
}

.product-result-item .p-barcode {
    font-size: 0.78rem;
    color: #718096;
    background: #edf2f7;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.product-result-item .p-qty {
    font-size: 0.8rem;
}

.product-result-item .p-price {
    font-size: 0.85rem;
    font-weight: 700;
    color: #017E84;
    white-space: nowrap;
}

.product-result-no-results {
    padding: 16px;
    text-align: center;
    color: #a0aec0;
    font-size: 0.9rem;
}

/* ===================================================
   Order lines table
   =================================================== */
.table-order thead th {
    background: linear-gradient(135deg, #714B67, #017E84);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    border: none;
    white-space: nowrap;
    padding: 10px 12px;
}

.table-order tbody td {
    vertical-align: middle;
    padding: 8px 12px;
    font-size: 0.88rem;
    border-color: #f0f4f8;
}

.table-order tbody tr:hover {
    background-color: #f7fafc;
}

.table-total-row td {
    background-color: #edf2f7;
    border-top: 2px solid #cbd5e0;
    padding: 10px 12px;
}

.qty-input {
    max-width: 90px;
    text-align: center;
    font-weight: 600;
}

.qty-input:focus {
    border-color: #017E84;
    box-shadow: 0 0 0 0.2rem rgba(1, 126, 132, 0.2);
}

.btn-delete-line {
    width: 30px;
    height: 30px;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    border-radius: 50%;
}

/* ===================================================
   Success modal
   =================================================== */
.success-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #38a169, #48bb78);
    border-radius: 50%;
    font-size: 2rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-weight: 900;
}

/* ===================================================
   Floating alerts
   =================================================== */
.alerts-float {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    width: min(90vw, 460px);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alerts-float .alert {
    margin-bottom: 0;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    font-size: 0.9rem;
    padding: 10px 16px;
}

/* ===================================================
   Misc utilities
   =================================================== */
.badge-local_draft  { background-color: #718096; }
.badge-sent_to_odoo { background-color: #38a169; }
.badge-failed       { background-color: #e53e3e; }

.spinner-sm {
    width: 1rem;
    height: 1rem;
    border-width: 2px;
}
