/* ============================================
   נמל אשדוד - מערכת ניהול הזמנות אוניות
   עיצוב: נקי, פשוט, מודרני
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box }

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    direction: rtl;
    font-size: 14px;
    color: #1a1a2e;
    line-height: 1.5;
}

/* --- Header --- */
.header {
    background: linear-gradient(135deg, #0d2b4a 0%, #1a3f5e 100%);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 12px rgba(0,0,0,.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left { display:flex; align-items:center; gap:12px }
.header-left img { height:28px; width:auto; }
.header-divider { width:1px; height:30px; background:rgba(255,255,255,.15) }
.header-title { color:rgba(255,255,255,.85); font-size:14px; font-weight:500 }
.header-right { display:flex; align-items:center; gap:10px }
.header-badge {
    font-size:11px;
    padding:3px 10px;
    border-radius:20px;
    background:rgba(255,255,255,.12);
    color:rgba(255,255,255,.75);
    font-weight:500;
}
.header-badge-dev {
    background:rgba(16,185,129,.25);
    color:#6ee7b7;
}
.header-badge-prod {
    background:rgba(249,115,22,.25);
    color:#fbbf24;
}
.header-badge-grok {
    background:rgba(99,102,241,.25);
    color:#a5b4fc;
}
.header-user { color:rgba(255,255,255,.55); font-size:12px }
.header-link { color:rgba(255,255,255,.45); font-size:12px; text-decoration:none; transition:color .2s }
.header-link:hover { color:#fff }

/* --- Container & Layout --- */
.wrapper { max-width:1200px; margin:0 auto; padding:20px }

/* --- Top Bar --- */
.top-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.top-bar h1,
.top-bar h2 { font-size:20px; font-weight:700; color:#0d2b4a; letter-spacing:-.3px }

/* --- Filters & Controls --- */
.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

input, select, textarea {
    padding: 10px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    font-size: 13px;
    outline: none;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
    font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
input::placeholder, textarea::placeholder { color:#9ca3af }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all .2s ease;
    line-height: 1.3;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.15) }
.btn:active { transform: translateY(0) }

.btn-primary {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: #fff;
}
.btn-primary:hover { background: linear-gradient(135deg, #1e40af, #1d4ed8) }

.btn-navy {
    background: #0d2b4a;
    color: #fff;
}
.btn-navy:hover { background: #0a223b }

.btn-success {
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: #4b5563;
    padding: 6px 12px;
}
.btn-ghost:hover {
    background: rgba(0,0,0,.05);
    box-shadow: none;
    transform: none;
}

.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 8px }
.btn-lg { padding: 14px 28px; font-size: 16px }
.btn-full { width: 100%; text-align: center }
.btn-icon { padding: 6px; min-width: 32px; min-height: 32px; border-radius: 8px }

/* --- Action Bar --- */
.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
}

/* --- Tabs --- */
.tab-bar {
    display: flex;
    gap: 2px;
    margin-bottom: 20px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 4px;
    width: fit-content;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.tab {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 500;
    color: #4b5563;
    background: transparent;
    border: none;
    transition: all .2s;
}
.tab:hover:not(.active) { background: #f3f4f6 }
.tab.active {
    background: #0d2b4a;
    color: #fff;
    box-shadow: 0 2px 8px rgba(13,43,74,.3);
}

/* --- Card --- */
.card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    border: 1px solid #e5e7eb;
    overflow: hidden;
}
.card-header {
    padding: 14px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

/* --- Tables --- */
.table-wrap {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    border: 1px solid #e5e7eb;
    overflow: hidden;
    margin-bottom: 20px;
}
table { width:100%; border-collapse:collapse }
th {
    background: #f8fafc;
    text-align: right;
    padding: 10px 12px;
    font-weight: 600;
    color: #0d2b4a;
    font-size: 12px;
    white-space: nowrap;
    border-bottom: 1px solid #e5e7eb;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: #64748b;
}
td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: 13px;
}
tr:last-child td { border-bottom: none }
tr:hover td { background: #f8fafc }

/* --- Order Card (agent view) --- */
.order-card {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 8px;
    background: #fff;
    overflow: hidden;
    transition: box-shadow .2s;
}
.order-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08) }
.order-card-header {
    padding: 10px 14px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}
.order-ship-name { font-weight: 600; color:#0d2b4a; font-size:16px }
.order-meta { display:flex; align-items:center; gap:6px; font-size:12px; color:#6b7280; margin-top:4px }
.order-actions { display:flex; align-items:center; gap:4px }

/* --- Container row --- */
.container-header {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 6px 14px;
    background: #f1f5f9;
    font-size: 10px;
    color: #64748b;
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.container-row {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px 14px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 13px;
}
.container-row:last-child { border-bottom: none }
.container-col-label { width:45px; text-align:center; font-weight:500 }
.container-col-type { width:60px; text-align:center }
.container-col-dest { width:55px; text-align:center }
.container-col-qty { width:45px; text-align:center; font-weight:500 }
.container-col-admin { width:45px; text-align:center }
.container-sep { color:#d1d5db }

/* --- Status Badges --- */
.status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid transparent;
    text-align: center;
}
.status-green { color:#15803d; background:#f0fdf4; border-color:#bbf7d0 }
.status-red { color:#b91c1c; background:#fef2f2; border-color:#fecaca }
.status-blue { color:#2563eb; background:#eff6ff; border-color:#bfdbfe }
.status-gray { color:#4b5563; background:#f9fafb; border-color:#e5e7eb }

/* --- Empty State --- */
.empty-state {
    padding: 48px 20px;
    text-align: center;
    color: #9ca3af;
    font-size: 15px;
}

/* --- Text utilities --- */
.text-muted { color:#6b7280 }
.text-center { text-align:center }
.text-sm { font-size:12px }

/* --- Modal --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.4);
    z-index: 999;
    backdrop-filter: blur(2px);
}
.modal {
    background: #fff;
    border-radius: 14px;
    max-width: 500px;
    margin: 40px auto;
    padding: 28px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 80px rgba(0,0,0,.25);
}
.modal h3 { font-size:20px; font-weight:700; color:#0d2b4a; margin-bottom:20px }
.modal label { display:block; font-size:13px; font-weight:500; color:#374151; margin-bottom:6px }
.modal input,
.modal select,
.modal textarea { width:100%; padding:12px 14px; border:1.5px solid #d1d5db; border-radius:10px; font-size:14px; outline:none; background:#fff; margin-bottom:14px; font-family:inherit }
.modal input:focus,
.modal select:focus,
.modal textarea:focus { border-color:#2563eb; box-shadow:0 0 0 3px rgba(37,99,235,.15) }
.modal .btn-row { display:flex; gap:10px; padding-top:8px }

/* --- Loading --- */
.loading-overlay {
    display: none;
    position: fixed;
    top:0; left:0; right:0; bottom:0;
    background: rgba(255,255,255,.7);
    z-index: 9998;
    direction: rtl;
}
.loading-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    background: #0d2b4a;
    color: #fff;
    padding: 28px 44px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0,0,0,.25);
    text-align: center;
    z-index: 9999;
    direction: rtl;
}
.loading-box .spinner {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255,255,255,.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}
@keyframes spin { to { transform:rotate(360deg) } }

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,.2);
    direction: rtl;
    text-align: center;
    max-width: 90vw;
}
.toast-success { background:#059669; color:#fff }
.toast-error { background:#dc2626; color:#fff }
.toast-info { background:#2563eb; color:#fff }

/* --- Checkbox label --- */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    color: #374151;
}
.checkbox-label input[type="checkbox"] {
    width: auto;
    padding: 0;
    accent-color: #2563eb;
}

/* --- Sticky Footer --- */
.sticky-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 90;
    padding: 14px 20px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -4px 12px rgba(0,0,0,.08);
}
.sticky-spacer { padding-bottom: 80px }

/* --- Site Footer --- */
.site-footer {
    background: #0d2b4a;
    color: rgba(255,255,255,.35);
    font-size: 12px;
    text-align: center;
    padding: 20px;
    margin-top: 40px;
}

/* --- Button text utilities --- */
.btn-text{background:none;border:none;cursor:pointer;font-size:12px;padding:4px 8px;border-radius:4px;transition:background .15s}
.btn-text:hover{background:rgba(0,0,0,.05)}
.btn-red{color:#dc2626}
.btn-red:hover{background:#fef2f2}
.btn-blue{color:#0066cc}
.btn-blue:hover{background:#e6f2ff}

/* --- Amber alert row --- */
.amber { background: #fef3c7 !important }
.amber td { background: #fef3c7 !important }
tr.amber:hover td { background: #fde68a !important }

/* --- Section header (table) --- */
.section-header {
    background: #f1f5f9 !important;
    padding: 8px 12px !important;
    font-weight: 700;
    font-size: 13px;
    color: #0d2b4a;
}
.section-header td { background: #f1f5f9 !important }

/* --- Notes box --- */
.notes-box {
    padding: 8px 14px;
    font-size: 12px;
    color: #6b7280;
    border-top: 1px solid #f1f5f9;
    background: #fefce8;
    border-radius: 0 0 10px 10px;
}

/* --- User management buttons & mobile cards --- */
.user-btn {
    display:inline-block;
    padding:6px 12px;
    border-radius:8px;
    font-size:13px;
    cursor:pointer;
    border:1px solid;
    transition:all .15s;
    font-family:inherit;
    line-height:1.4;
}
.user-btn-edit {
    background:#e6f2ff;
    color:#0066cc;
    border-color:#b3d4ff;
}
.user-btn-edit:hover { background:#d1e6ff }
.user-btn-del {
    background:#fef2f2;
    color:#dc2626;
    border-color:#fecaca;
}
.user-btn-del:hover { background:#fde8e8 }

/* Mobile cards (hidden on desktop) */
.mobile-cards { display:none }
.user-card {
    background:#fff;
    border:1px solid #e5e7eb;
    border-radius:12px;
    padding:14px 16px;
    margin-bottom:10px;
    box-shadow:0 1px 3px rgba(0,0,0,.04);
}
.user-card-row {
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:4px 0;
    border-bottom:1px solid #f3f4f6;
    font-size:14px;
}
.user-card-row:last-of-type { border-bottom:none }
.user-card-label {
    color:#6b7280;
    font-size:12px;
    font-weight:500;
    min-width:50px;
}
.user-card-actions {
    display:flex;
    gap:6px;
    padding-top:10px;
    margin-top:6px;
    border-top:1px solid #e5e7eb;
    flex-wrap:wrap;
}

/* Responsive: on mobile hide table, show cards */
@media (max-width: 768px) {
    .desktop-table { display:none }
    .mobile-cards { display:block }
}

/* --- Grid helpers --- */
.grid-3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:10px }
