/**
 * تطبيق فحص وتحليل عناوين IP - أنماط CSS
 * 
 * ملف الأنماط الرئيسي للتطبيق مع دعم الاتجاه من اليمين إلى اليسار
 * وتصميم متجاوب يعمل على مختلف أحجام الشاشات
 */

/* ===== الأنماط العامة ===== */
:root {
    --primary-color: #3b82f6;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    --light-color: #f8fafc;
    --dark-color: #1e293b;
    --border-radius: 0.5rem;
    --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: #f1f5f9;
    color: #334155;
    line-height: 1.6;
    direction: rtl;
    text-align: right;
}

/* ===== الحاويات والبطاقات ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.card {
    background-color: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 1.5rem;
    border: none;
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.card-body {
    padding: 1.5rem;
}

/* ===== شريط التنقل ===== */
.navbar {
    background-color: var(--primary-color);
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.navbar-brand i {
    margin-left: 0.5rem;
}

.navbar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    margin-right: 1rem;
}

.nav-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-link:hover {
    color: #fff;
}

/* ===== الأزرار ===== */
.btn {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: var(--border-radius);
    transition: all 0.3s;
    border: none;
}

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

.btn-primary:hover {
    background-color: #2563eb;
}

.btn-danger {
    background-color: var(--danger-color);
    color: #fff;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover, .btn-outline.active {
    background-color: var(--primary-color);
    color: #fff;
}

/* ===== النماذج ===== */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #334155;
    background-color: #fff;
    border: 1px solid #cbd5e1;
    border-radius: var(--border-radius);
    transition: border-color 0.3s;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
}

/* ===== التنبيهات ===== */
.alert {
    position: relative;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
}

.alert-success {
    color: #0f766e;
    background-color: #d1fae5;
    border-color: #a7f3d0;
}

.alert-info {
    color: #0e7490;
    background-color: #cffafe;
    border-color: #a5f3fc;
}

.alert-warning {
    color: #b45309;
    background-color: #fef3c7;
    border-color: #fde68a;
}

.alert-danger {
    color: #b91c1c;
    background-color: #fee2e2;
    border-color: #fecaca;
}

.alert-dismissible {
    padding-left: 4rem;
}

.alert-dismissible .btn-close {
    position: absolute;
    top: 0;
    left: 0;
    padding: 1.25rem 1rem;
    background: transparent;
    border: 0;
    cursor: pointer;
}

/* ===== شريط التقدم ===== */
.progress {
    display: flex;
    height: 1.5rem;
    overflow: hidden;
    background-color: #e2e8f0;
    border-radius: var(--border-radius);
}

.progress-bar {
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: #fff;
    text-align: center;
    background-color: var(--primary-color);
    transition: width 0.3s;
}

.progress-bar-striped {
    background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
    background-size: 1rem 1rem;
}

.progress-bar-animated {
    animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
    from { background-position: 1rem 0; }
    to { background-position: 0 0; }
}

/* ===== علامات التبويب ===== */
.tab-content {
    display: block;
}

.tab-content.d-none {
    display: none;
}

/* ===== الجداول ===== */
.table {
    width: 100%;
    margin-bottom: 1rem;
    color: #334155;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem;
    vertical-align: middle;
    border-top: 1px solid #e2e8f0;
}

.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid #e2e8f0;
    background-color: #f8fafc;
}

.table-hover tbody tr:hover {
    background-color: #f1f5f9;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

/* ===== الشارات ===== */
.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.bg-secondary {
    background-color: var(--secondary-color) !important;
}

.bg-success {
    background-color: var(--success-color) !important;
}

.bg-danger {
    background-color: var(--danger-color) !important;
}

.bg-warning {
    background-color: var(--warning-color) !important;
}

.bg-info {
    background-color: var(--info-color) !important;
}

.text-white {
    color: #fff !important;
}

.text-dark {
    color: var(--dark-color) !important;
}

.text-light {
    color: var(--light-color) !important;
}

/* ===== شارات الحالة ===== */
.status-badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.85em;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
    color: #fff;
}

.status-vpn {
    background-color: #f59e0b;
}

.status-proxy {
    background-color: #f59e0b;
}

.status-tor {
    background-color: #ef4444;
}

.status-hosting {
    background-color: #3b82f6;
}

.status-trusted {
    background-color: #10b981;
}

.status-malicious {
    background-color: #ef4444;
}

.status-unknown {
    background-color: #64748b;
}

/* ===== شارات المنافذ ===== */
.port-badge {
    display: inline-block;
    padding: 0.25em 0.5em;
    font-size: 0.75em;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
    background-color: #e2e8f0;
    color: #334155;
    margin-left: 0.25rem;
}

/* ===== تفاصيل المنافذ ===== */
.ports-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.ports-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.port-detail {
    display: flex;
    align-items: center;
    background-color: #f8fafc;
    padding: 0.5rem;
    border-radius: 0.25rem;
}

.port-name {
    font-weight: 600;
    margin-left: 0.5rem;
    color: var(--primary-color);
}

.port-desc {
    font-size: 0.85em;
    color: #64748b;
}

/* ===== تفاصيل IP ===== */
.ip-details {
    cursor: pointer;
}

.ip-details-row {
    background-color: #f8fafc;
}

.ip-details-content {
    padding: 1rem;
}

/* ===== مؤشر التحميل ===== */
.loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 0.25rem solid rgba(59, 130, 246, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
    margin-bottom: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== حاوية الرسم البياني ===== */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* ===== التذييل ===== */
.footer {
    background-color: #fff;
    padding: 2rem 0;
    margin-top: 2rem;
    border-top: 1px solid #e2e8f0;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: #64748b;
}

/* ===== المساعدات ===== */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

.me-1 { margin-right: 0.25rem; }
.me-2 { margin-right: 0.5rem; }
.me-3 { margin-right: 1rem; }
.me-4 { margin-right: 1.5rem; }

.ms-1 { margin-left: 0.25rem; }
.ms-2 { margin-left: 0.5rem; }
.ms-3 { margin-left: 1rem; }
.ms-4 { margin-left: 1.5rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }

.d-flex { display: flex; }
.d-none { display: none; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.justify-content-between { justify-content: space-between; }
.justify-content-center { justify-content: center; }
.align-items-center { align-items: center; }

.m-0 { margin: 0; }

/* ===== تصميم متجاوب ===== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

.col-6 { width: 50%; padding: 0 15px; }
.col-md-3 { width: 25%; padding: 0 15px; }
.col-md-6 { width: 50%; padding: 0 15px; }
.col-sm-4 { width: 33.333333%; padding: 0 15px; }

@media (max-width: 768px) {
    .col-md-3, .col-md-6 {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .col-sm-4 {
        width: 50%;
    }
}

/* ===== تحسينات للأجهزة المحمولة ===== */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
    
    .btn {
        padding: 0.4rem 0.8rem;
    }
}

/* ===== تحسينات للشاشات الصغيرة جداً ===== */
@media (max-width: 480px) {
    .col-6 {
        width: 100%;
    }
    
    .btn {
        display: block;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .d-flex {
        flex-direction: column;
    }
}
