/* * AI Auto Writer - Modern Dashboard Styles v2.0
 * تصميم احترافي يدعم الوضع الليلي الخفيف والواجهات الحديثة
 */

:root {
    --primary-color: #2563eb;       /* أزرق حديث */
    --primary-hover: #1d4ed8;
    --danger-color: #dc2626;        /* أحمر */
    --danger-hover: #b91c1c;
    --success-color: #16a34a;       /* أخضر */
    --text-main: #1f2937;
    --text-secondary: #6b7280;
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius: 0.5rem;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    direction: rtl;
    line-height: 1.5;
}

/* --- تنسيق صفحة تسجيل الدخول المخصص --- */
body.login-page {
    background: linear-gradient(135deg, #ece9e6 0%, #ffffff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border-radius: 1rem; /* زوايا أكثر انحناءً */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    padding: 2.5rem;
    text-align: center;
}

.login-header h1 {
    color: var(--primary-color);
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* --- الهيكل العام للوحة التحكم --- */
header {
    background: var(--bg-card);
    padding: 1rem 2rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

header h1 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-main);
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 40px 20px;
}

.card {
    background-color: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
    padding: 2rem;
}

.card h2 {
    margin-top: 0;
    color: var(--text-main);
    font-size: 1.25rem;
    border-bottom: 2px solid var(--bg-body);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* --- النماذج وحقول الإدخال --- */
.form-group {
    margin-bottom: 1.25rem;
    text-align: right;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* حقل الدومين الإنجليزي */
.ltr-input {
    direction: ltr;
    text-align: left;
    font-family: monospace; /* لتمييز الدومين والأكواد */
}

/* --- الأزرار --- */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    width: 100%; /* افتراضي في الموبايل */
}
@media (min-width: 640px) {
    .btn-primary { width: auto; }
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-danger {
    background-color: #fff;
    color: var(--danger-color);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
}

.btn-danger:hover {
    background-color: #fee2e2;
    border-color: #fca5a5;
}

.btn-edit {
    background-color: #fff;
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
    margin-left: 5px;
}

.btn-edit:hover {
    background-color: #eff6ff;
    border-color: #93c5fd;
}

.logout-btn {
    background: #fee2e2;
    color: #991b1b;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
}

/* --- الجدول --- */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    min-width: 800px; /* لضمان عدم انكماش الجدول */
}

th {
    background-color: #f9fafb;
    color: var(--text-secondary);
    font-weight: 600;
    text-align: right;
    padding: 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    color: var(--text-main);
}

td input[readonly] {
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    color: #4b5563;
    width: 100%;
    font-size: 0.85rem;
    padding: 0.5rem;
}

/* --- حالات الترخيص --- */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.status-active {
    background-color: #dcfce7;
    color: #166534;
}

.status-expired {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-inactive {
    background-color: #f3f4f6;
    color: #374151;
}

/* --- النافذة المنبثقة (Modal) للتعديل --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none; /* مخفي افتراضياً */
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-md);
    position: relative;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 1.5rem;
}

/* رسائل التنبيه */
.message {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-weight: 600;
}
.message.success {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}
.message.error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}