:root {
    --bg-body: #f5f5f7;
    --bg-card: #ffffff;
    --text-main: #1d1d1f;
    --text-muted: #86868b;
    --accent-blue: #0066cc;
    --border-color: #d2d2d7;
    --success: #34c759;
    --warning: #ff9f0a;
    --danger: #ff3b30;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    direction: rtl;
}

/* الهيدر العلوي */
.navbar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 15px 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    color: var(--text-main);
}

.brand i {
    font-size: 24px;
}

.nav-stats {
    display: flex;
    gap: 15px;
}

.badge-stat {
    background: #e8e8ed;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-main);
}

.badge-stat.alert {
    background: rgba(255, 59, 48, 0.1);
    color: var(--danger);
}

/* المحتوى */
.main-content {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.hero-section {
    text-align: center;
    margin-bottom: 30px;
}

.hero-section h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
}

.hero-section p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

/* شريط البحث وزر الإضافة */
.search-action-row {
    display: flex;
    gap: 15px;
    max-width: 800px;
    margin: 0 auto;
}

.search-box-tradeline {
    position: relative;
    flex: 1;
}

.search-box-tradeline i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box-tradeline input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 12px 45px 12px 15px;
    border-radius: 12px;
    font-size: 14px;
    color: var(--text-main);
    outline: none;
    transition: 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.search-box-tradeline input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.15);
}

.btn-primary-apple {
    background: var(--accent-blue);
    color: #fff;
    border: none;
    padding: 0 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
    white-space: nowrap;
}

.btn-primary-apple:hover {
    background: #0051a8;
}

/* فلاتر الأقسام */
.categories-bar {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.filter-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: 0.2s;
}

.filter-btn.active, .filter-btn:hover {
    background: var(--text-main);
    color: #fff;
    border-color: var(--text-main);
}

/* الجدول النظيف */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
}

.tradeline-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
}

.tradeline-table th, .tradeline-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.tradeline-table th {
    background: #fafafa;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
}

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

.tradeline-table tr:hover {
    background: #fbfbfd;
}

/* الحالات (Badges) */
.status-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}
.status-in { background: rgba(52, 199, 89, 0.12); color: #248a3d; }
.status-low { background: rgba(255, 159, 10, 0.12); color: #b76e00; }
.status-out { background: rgba(255, 59, 48, 0.12); color: #c91c14; }

.action-group {
    display: flex;
    gap: 12px;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    transition: 0.2s;
}

.btn-edit-action { color: var(--accent-blue); }
.btn-print-action { color: #173b35; }
.btn-delete-action { color: var(--danger); }
.action-btn:hover { opacity: 0.7; }

/* النافذة المنبثقة (Modal) */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-card {
    background: var(--bg-card);
    width: 100%;
    max-width: 500px;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.close-modal {
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
}

.input-group {
    margin-bottom: 15px;
}

.input-row {
    display: flex;
    gap: 15px;
}

.input-row .input-group {
    flex: 1;
}

.input-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.input-group input, .input-group select {
    width: 100%;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    color: var(--text-main);
    outline: none;
}

.input-group input:focus, .input-group select:focus {
    border-color: var(--accent-blue);
    background: #fff;
}

.btn-submit-apple {
    width: 100%;
    background: var(--text-main);
    color: #fff;
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: 0.2s;
}

.btn-submit-apple:hover {
    opacity: 0.85;
}