/*
 * Earth Link Root - Debt Management System Styles
 *
 * This file contains base styles, layout, and responsive adjustments.
 */

:root {
    --primary-color: #00796B; /* Earthlink Blue */
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
    --bg-light: #f8f9fa;
    --border-color: #e6e9ee;
    --font-family: 'Arial', sans-serif;
}

/* ** 1. Base Styles and Typography ** */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-light);
    color: #343a40;
    line-height: 1.6;
    direction: rtl; /* RTL Support */
    text-align: right;
    min-height: 100vh;
}

.container {
    width: 95%;
    max-width: 1200px;
    margin-right: auto;
    margin-left: auto;
    padding: 15px;
}

/* ** 2. Header and Navigation ** */

.topbar {
    background-color: var(--primary-color);
    color: white;

    /* ✅ تقليل سماكة الشريط */
    padding: 4px 0;

    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ✅ تقليل بادينغ الكونتينر داخل الهيدر فقط */
.topbar .container {
    padding-top: 6px;
    padding-bottom: 6px;
}

.logo_row {
    display: flex;
    justify-content: space-between;
    align-items: center;

    /* ✅ ارتفاع أنحف للهيدر */
    min-height: 54px;
}

.logo {
    display: flex;
    align-items: center;
}

/* ✅ دعم الشعار كـ IMG ومنع كبره + تكبيره بشكل مرتب */
.logo img {
    display: block;
    width: auto;
    height: auto;

    /* هذا هو المهم */
    max-width: 200px;   /* كبّر الشعار بدون ما يكبر الهيدر */
    max-height: 46px;   /* يمنع زيادة ارتفاع الشريط */

    object-fit: contain;
}

/* كان موجود للسيفيجي */
.logo svg {
    width: 35px;
    height: 35px;
    fill: white;
    margin-left: 10px;
}

.company {
    font-size: 1.4rem;
    font-weight: bold;
}

.nav a {
    color: white;
    text-decoration: none;
    padding: 5px 8px;
    margin: 0 3px; /* مسافة أصغر بين الروابط */
    font-size: 0.95rem;
    transition: background-color 0.2s;
    white-space: nowrap; /* منع انقسام الروابط */
}

.nav a:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

/* ** 3. Forms and Inputs (تعديل حقول الإدخال) ** */

.card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

main.center {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px); /* ارتفاع الشاشة مطروحاً منه الهيدر والفوتر */
    padding: 20px;
}

main.center .card {
    width: 100%;
    max-width: 400px;
}

form label {
    display: block;
    margin-bottom: 15px;
    font-weight: 600;
    font-size: 0.95rem;
}

form input,
form select {
    width: 100%;
    padding: 10px; /* زيادة حجم البادينغ ليتناسق مع حقل الرمز */
    margin-top: 5px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

form input:focus,
form select:focus {
    border-color: var(--primary-color);
    outline: none;
}

.actions {
    margin-top: 20px;
}

/* ** 4. Buttons (تعديل أحجام أزرار التعديل) ** */

.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    transition: background-color 0.2s, opacity 0.2s;
}

.btn:hover {
    opacity: 0.9;
}

.btn {
    background-color: var(--primary-color);
    color: white;
}

.btn.secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn.error {
    background-color: var(--error-color);
    color: white;
}

/* ** تعديل حجم زر التعديل (small) ** */
.btn.small {
    padding: 6px 12px; /* أصغر قليلاً من الأزرار العادية */
    font-size: 0.85rem;
    margin: 2px 0;
}

/* ** 5. Tables and Layout ** */

.datatable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 0.9rem;
}

.datatable th,
.datatable td {
    padding: 10px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.datatable th {
    background-color: #e9ecef;
    font-weight: 700;
    white-space: nowrap;
}

/* === [تعديل Flexbox النهائي لضمان التنظيم والمحاذاة لليمين] === */
.grid {
    display: flex; 
    flex-wrap: wrap;
    justify-content: flex-end; 
    gap: 10px; /* مسافة أقل */
    margin-top: 20px;
    padding: 0;
}

.grid > a,
.grid > div {
    flex-grow: 1;
    flex-basis: calc(25% - 10px); 
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-self: stretch;
}

/* ✅ تم حذف القوس الزائد اللي كان يخرب CSS */
/* كان عندك: } }  */

/* media queries لضبط عدد الكاردات في الصف حسب عرض الشاشة */
@media (max-width: 1200px) {
    .grid > a,
    .grid > div {
        flex-basis: calc(33.33% - 10px);
    }
}

@media (max-width: 768px) {
    .grid > a,
    .grid > div {
        flex-basis: calc(50% - 10px);
    }
}

@media (max-width: 500px) {
    .grid > a,
    .grid > div {
        flex-basis: 100%;
    }
}
/* ======================================= */

.big {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-top: 5px;
}

.error, .success {
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-weight: 600;
}

.error {
    background-color: #f8d7da;
    color: var(--error-color);
    border: 1px solid #f5c6cb;
}

.success {
    background-color: #d4edda;
    color: var(--success-color);
    border: 1px solid #c3e6cb;
}

.muted {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

/* ** 6. Responsive Adjustments (للهواتف والأجهزة الصغيرة) ** */

@media (max-width: 900px) {
    .logo_row {
        flex-direction: column;
        align-items: flex-end; /* ليبقى الشعار على اليمين في RTL */
        min-height: 50px;
    }

    /* ✅ تصغير الشعار بالموبايل */
    .logo img {
        max-width: 160px;
        max-height: 42px;
    }

    .nav {
        margin-top: 10px;
        display: flex;
        flex-wrap: wrap; /* السماح بتعدد الأسطر */
        justify-content: flex-end;
    }
    
    .nav a {
        margin: 5px 3px; /* مسافة أفضل بين الأزرار */
        font-size: 0.85rem;
        padding: 5px 7px;
    }

    .container {
        padding: 10px;
    }
    
    .datatable th {
        position: sticky;
        right: 0; 
        background-color: #e9ecef;
        z-index: 10;
    }
    
    h1 {
        font-size: 1.5rem;
    }
}
/* ===== Brand (Logo + Company Name) ===== */
.brand{
  display:flex;
  align-items:center;
  gap:10px;
}

.brand__logo{
  display:block;
  width:auto;
  height:auto;
  max-height:44px;     /* يتحكم بارتفاع الهيدر */
  max-width:180px;     /* يتحكم بعرض الشعار */
  object-fit:contain;
}

.brand__name{
  color:#fff;
  font-weight:800;
  font-size:1.25rem;
  line-height:1;
  white-space:nowrap;
}

/* موبايل */
@media (max-width: 900px){
  .brand__logo{ max-height:38px; max-width:150px; }
  .brand__name{ font-size:1.05rem; }
}
