/* ============================================================================
   منصة المناقصات - شركة الجوف للتنمية الزراعية
   تصميم عربي RTL باستخدام هوية لونية خضراء زراعية
   ============================================================================ */

:root {
    --color-primary: #1f7a4d;
    --color-primary-dark: #145536;
    --color-primary-light: #e8f5ee;
    --color-accent: #c9a227;
    --color-danger: #c0392b;
    --color-warning: #b8860b;
    --color-success: #1f7a4d;
    --color-info: #2563eb;
    --color-text: #1f2937;
    --color-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-bg: #f5f7f6;
    --color-white: #ffffff;
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: 'Tajawal', 'Segoe UI', Tahoma, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.7;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 12px; font-weight: 700; color: var(--color-primary-dark); }
p { margin: 0 0 10px; }

/* ---------------------------------------------------------------- Layout */
.app-wrapper { display: flex; min-height: 100vh; }

.topbar {
    position: fixed;
    top: 0; right: 0; left: 0;
    height: var(--topbar-height);
    background: var(--color-primary-dark);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    box-shadow: var(--shadow);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 17px; }
.topbar .brand img { height: 34px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar a { color: #fff; }
.topbar .user-chip { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.08); padding: 6px 14px; border-radius: 20px; font-size: 14px; }
.notif-badge { background: var(--color-danger); color:#fff; border-radius: 999px; font-size: 11px; padding: 1px 6px; margin-inline-start: 4px; }

.sidebar {
    position: fixed;
    top: var(--topbar-height);
    right: 0;
    width: var(--sidebar-width);
    bottom: 0;
    background: var(--color-white);
    border-inline-start: 1px solid var(--color-border);
    padding: 18px 0;
    overflow-y: auto;
    z-index: 90;
}
.sidebar .role-tag {
    margin: 0 16px 14px;
    padding: 6px 12px;
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    font-size: 13px;
    border-radius: 8px;
    text-align: center;
    font-weight: 700;
}
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: var(--color-text);
    font-size: 14.5px;
    border-inline-start: 3px solid transparent;
}
.sidebar nav a:hover { background: var(--color-primary-light); text-decoration: none; }
.sidebar nav a.active {
    background: var(--color-primary-light);
    border-inline-start-color: var(--color-primary);
    color: var(--color-primary-dark);
    font-weight: 700;
}
.sidebar .menu-section-title { padding: 14px 20px 6px; font-size: 12px; color: var(--color-muted); font-weight: 700; }

.main-content {
    margin-inline-start: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 26px 30px;
    width: 100%;
}
.main-content.no-sidebar { margin-inline-start: 0; }

@media (max-width: 900px) {
    .sidebar { display: none; }
    .main-content { margin-inline-start: 0; }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 22px;
}
.page-header h1 { font-size: 22px; margin: 0; }
.breadcrumb { font-size: 13px; color: var(--color-muted); margin-bottom: 6px; }
.breadcrumb a { color: var(--color-muted); }

/* ---------------------------------------------------------------- Cards */
.card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-header h2, .card-header h3 { margin: 0; font-size: 17px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--color-white); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat-card .stat-value { font-size: 28px; font-weight: 800; color: var(--color-primary-dark); }
.stat-card .stat-label { color: var(--color-muted); font-size: 13.5px; margin-top: 4px; }
.stat-card.accent { border-inline-start: 4px solid var(--color-primary); }

/* ---------------------------------------------------------------- Forms */
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], input[type=tel], input[type=file],
select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14.5px;
    background: #fff;
    color: var(--color-text);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}
textarea { resize: vertical; min-height: 100px; }
.help-text { font-size: 12.5px; color: var(--color-muted); margin-top: 4px; }
.field-error { color: var(--color-danger); font-size: 12.5px; margin-top: 4px; }
.required { color: var(--color-danger); }

/* ---------------------------------------------------------------- Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 14.5px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-outline { background: #fff; color: var(--color-primary); border-color: var(--color-primary); }
.btn-outline:hover { background: var(--color-primary-light); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-secondary { background: #eef0f2; color: var(--color-text); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { display: block; width: 100%; }

/* ---------------------------------------------------------------- Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
table th, table td { padding: 12px 14px; text-align: right; border-bottom: 1px solid var(--color-border); }
table th { background: #fafbfa; font-weight: 700; color: var(--color-primary-dark); white-space: nowrap; }
table tr:hover td { background: #fafcfb; }

/* ---------------------------------------------------------------- Badges */
.badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12.5px; font-weight: 700; }
.badge-green { background: #e6f4ea; color: #1f7a4d; }
.badge-gray { background: #eef0f2; color: #4b5563; }
.badge-blue { background: #e8f0fe; color: #1d4ed8; }
.badge-yellow { background: #fef7e0; color: #92650a; }
.badge-red { background: #fdecea; color: #b3261e; }

/* ---------------------------------------------------------------- Alerts */
.alert { padding: 14px 18px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; border: 1px solid transparent; }
.alert-success { background: #e6f4ea; color: #1f7a4d; border-color: #bfe3cd; }
.alert-error { background: #fdecea; color: #b3261e; border-color: #f5c6c0; }
.alert-info { background: #e8f0fe; color: #1d4ed8; border-color: #c9dcfd; }
.alert-warning { background: #fef7e0; color: #92650a; border-color: #f6e3ab; }

/* ---------------------------------------------------------------- Misc */
.text-muted { color: var(--color-muted); }
.text-danger { color: var(--color-danger); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.flex { display: flex; } .gap-2 { gap: 8px; } .gap-3 { gap: 14px; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.countdown { font-weight: 700; color: var(--color-danger); }
.empty-state { text-align: center; padding: 50px 20px; color: var(--color-muted); }

/* ---------------------------------------------------------------- Auth pages */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary)); padding: 20px; }
.auth-box { background: #fff; border-radius: var(--radius); padding: 34px; width: 100%; max-width: 440px; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.auth-box .logo-title { text-align: center; margin-bottom: 22px; }
.auth-box .logo-title h1 { font-size: 18px; }

/* ---------------------------------------------------------------- Public landing */
.hero { background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary)); color: #fff; padding: 70px 20px; text-align: center; }
.hero h1 { color: #fff; font-size: 30px; margin-bottom: 12px; }
.hero p { font-size: 16px; opacity: .92; max-width: 640px; margin: 0 auto 22px; }
.public-nav { background: #fff; border-bottom: 1px solid var(--color-border); padding: 0 24px; height: var(--topbar-height); display: flex; align-items: center; justify-content: space-between; }
.container { max-width: 1180px; margin: 0 auto; padding: 40px 20px; }
.tender-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.tender-card { background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.tender-card h3 { font-size: 16px; margin-bottom: 8px; }
.tender-card .meta { font-size: 13px; color: var(--color-muted); margin-bottom: 4px; }

/* ---------------------------------------------------------------- Print (محضر فتح المظاريف) */
@media print {
    .no-print { display: none !important; }
    body { background: #fff; }
    .main-content { margin: 0; padding: 0; }
    .card { box-shadow: none; border: 1px solid #999; }
}
