/* =====================================================
   ملف CSS للشؤون القانونية والحكومية
   الديوان اليمني
   ===================================================== */

/* المتغيرات الأساسية */
:root {
    --legal-primary: #2E2857;
    --legal-secondary: #C89F65;
    --legal-success: #10B981;
    --legal-info: #3B82F6;
    --legal-warning: #F59E0B;
    --legal-gradient: linear-gradient(135deg, var(--legal-primary) 0%, #1E1A3A 100%);
}

/* قسم البطل Hero Section */
.legal-hero {
    background: var(--legal-gradient);
    position: relative;
    padding: 120px 0 80px;
    overflow: hidden;
}

.legal-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,%3Csvg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="none" stroke="%23FFFFFF" stroke-width="0.5" opacity="0.1"%3E%3Crect x="20" y="20" width="60" height="60"/%3E%3Crect x="30" y="30" width="40" height="40"/%3E%3C/g%3E%3C/svg%3E');
    background-size: 100px 100px;
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(1deg); }
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: white;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.8s ease-out;
    color: #E0E7FF;
}

.hero-subtitle {
    font-size: 1.3rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 3rem;
    animation: fadeInUp 0.8s ease-out 0.2s;
    animation-fill-mode: both;
}

.hero-search {
    max-width: 600px;
    margin: 0 auto;
    animation: fadeInUp 0.8s ease-out 0.4s;
    animation-fill-mode: both;
}

.search-box {
    display: flex;
    background: white;
    border-radius: 60px;
    padding: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.search-box input {
    flex: 1;
    border: none;
    padding: 15px 25px;
    font-size: 16px;
    outline: none;
    color: #333;
}

.search-box button {
    background: var(--legal-secondary);
    color: white;
    border: none;
    padding: 15px 35px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.search-box button:hover {
    background: #B8935A;
    transform: translateX(-5px);
}

/* قسم أنواع الخدمات */
.service-types-section {
    padding: 80px 0;
    background: #F8F9FA;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 50px;
}

.service-type-card {
    background: white;
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.service-type-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--service-color, var(--legal-primary)) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}

.service-type-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

.service-type-card:hover::before {
    opacity: 0.1;
}

.service-icon-wrapper {
    width: 80px;
    height: 80px;
    margin: 0 auto 25px;
    background: linear-gradient(135deg, var(--service-color, var(--legal-primary)), var(--service-color-dark, var(--legal-primary)));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 35px;
    transition: all 0.4s;
}

.service-type-card:hover .service-icon-wrapper {
    transform: rotate(10deg) scale(1.1);
}

.service-type-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1E293B;
    margin-bottom: 15px;
}

.service-type-description {
    color: #64748B;
    line-height: 1.6;
    margin-bottom: 20px;
}

.service-count {
    display: inline-block;
    background: #F1F5F9;
    color: #475569;
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
}

.select-service-btn {
    margin-top: 25px;
    background: transparent;
    color: var(--service-color, var(--legal-primary));
    border: 2px solid var(--service-color, var(--legal-primary));
    padding: 12px 30px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-block;
}

.service-type-card:hover .select-service-btn {
    background: var(--service-color, var(--legal-primary));
    color: white;
    transform: scale(1.05);
}

/* قسم النموذج الديناميكي */
.form-section {
    padding: 80px 0;
    background: white;
    display: none;
    opacity: 0;
    transform: translateY(50px);
}

.form-section.active {
    display: block;
    animation: slideInUp 0.6s ease-out forwards;
}

@keyframes slideInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-container {
    max-width: 800px;
    margin: 0 auto;
    background: #F8F9FA;
    border-radius: 30px;
    padding: 50px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
}

.form-header {
    text-align: center;
    margin-bottom: 40px;
}

.form-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: var(--service-color, var(--legal-primary));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 35px;
}

.form-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1E293B;
    margin-bottom: 10px;
}

.form-subtitle {
    color: #64748B;
    font-size: 1.1rem;
}

.legal-form {
    margin-top: 40px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}

.form-group {
    position: relative;
}

.form-label {
    display: block;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
    font-size: 15px;
}

.form-label .required {
    color: #EF4444;
}

.form-control {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #E2E8F0;
    border-radius: 15px;
    font-size: 16px;
    transition: all 0.3s;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--service-color, var(--legal-primary));
    box-shadow: 0 0 0 4px rgba(var(--service-color-rgb, 46,40,87), 0.1);
}

.form-control.error {
    border-color: #EF4444;
}

.error-message {
    color: #EF4444;
    font-size: 13px;
    margin-top: 5px;
    display: none;
}

.form-control.error + .error-message {
    display: block;
}

.form-check {
    padding-right: 1.5rem;
    margin-bottom: 0.5rem;
}

.form-check-input {
    margin-left: 0.5rem;
    margin-right: -1.5rem;
}

.form-check-label {
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 20px;
    margin-top: 40px;
    justify-content: center;
}

.btn-submit {
    background: var(--service-color, var(--legal-primary));
    color: white;
    border: none;
    padding: 18px 50px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.btn-cancel {
    background: transparent;
    color: #64748B;
    border: 2px solid #E2E8F0;
    padding: 18px 40px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-cancel:hover {
    border-color: #CBD5E1;
    color: #475569;
}

/* قسم المزايا */
.features-section {
    padding: 80px 0;
    background: var(--legal-gradient);
    color: white;
    position: relative;
    overflow: hidden;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-top: 50px;
}

.feature-card {
    text-align: center;
    position: relative;
    padding: 30px;
    border-radius: 20px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.3s;
}

.feature-card:hover {
    transform: translateY(-10px);
    background: rgba(255,255,255,0.15);
}

.feature-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 20px;
    background: var(--legal-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
}

.feature-title {
    font-size: 1.3rem;
    margin-bottom: 15px;
    font-weight: 600;
    color: #d5c156;
}

.feature-description {
    opacity: 0.9;
    line-height: 1.6;
    color: #F8F9FA;
}

/* قسم الإحصائيات */
.stats-section {
    padding: 80px 0;
    background: #F8F9FA;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-top: 50px;
}

.stat-card {
    text-align: center;
    padding: 40px 20px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.12);
}

.stat-number {
    font-size: 3rem;
    font-weight: 700;
    color: var(--legal-primary);
    margin-bottom: 10px;
    display: block;
}

.stat-label {
    color: #64748B;
    font-size: 1.1rem;
}

/* أقسام عامة */
.section {
    padding: 80px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-subtitle {
    color: var(--legal-secondary);
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
    display: inline-block;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1E293B;
    margin-bottom: 20px;
}

.section-description {
    font-size: 1.1rem;
    color: #64748B;
    max-width: 600px;
    margin: 0 auto;
}

/* بطاقات الخدمات */
.service-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    transition: all 0.3s;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.service-card-header {
    padding: 20px;
    color: white;
    position: relative;
}

.service-type-badge {
    background: rgba(255,255,255,0.2);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.875rem;
    display: inline-block;
    margin-top: 10px;
}

.service-card-body {
    padding: 25px;
}

.service-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1E293B;
    margin-bottom: 15px;
}

.service-description {
    color: #64748B;
    line-height: 1.6;
    margin-bottom: 20px;
}

.service-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.service-price {
    color: var(--legal-primary);
    font-weight: 600;
}

.service-duration {
    color: #64748B;
    font-size: 0.875rem;
}

.service-card-footer {
    padding: 20px;
    background: #F8F9FA;
    border-top: 1px solid #E2E8F0;
}

.btn-service-select {
    width: 100%;
    padding: 12px;
    background: var(--legal-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-service-select:hover {
    background: #1E1A3A;
    transform: translateY(-2px);
}

/* الرسوم المتحركة */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* تأثيرات التحميل */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* تنبيهات النجاح والخطأ */
.alert {
    padding: 20px 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    display: none;
    animation: slideDown 0.5s ease-out;
}

.alert.show {
    display: block;
}

.alert-success {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #6EE7B7;
}

.alert-error {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FCA5A5;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* بطاقات الحالة */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    display: inline-block;
}

.status-badge.status-active {
    background: #D1FAE5;
    color: #065F46;
}

.status-badge.status-inactive {
    background: #FEE2E2;
    color: #991B1B;
}

.status-badge.status-draft {
    background: #E0E7FF;
    color: #3730A3;
}

/* التوافق مع الأجهزة المحمولة */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .form-container {
        padding: 30px 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn-submit, .btn-cancel {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
}

/* طباعة */
@media print {
    .legal-hero,
    .features-section,
    .stats-section,
    .btn-submit,
    .btn-cancel,
    .select-service-btn {
        display: none !important;
    }
    
    .form-container {
        box-shadow: none;
        padding: 20px;
    }
}

/* دعم RTL */
[dir="rtl"] .search-box button {
    transform: translateX(5px);
}

[dir="rtl"] .search-box button:hover {
    transform: translateX(5px);
}

[dir="rtl"] .form-check {
    padding-left: 1.5rem;
    padding-right: 0;
}

[dir="rtl"] .form-check-input {
    margin-right: 0.5rem;
    margin-left: -1.5rem;
}
/* حالة التحميل */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* رسائل التنبيه */
.alert {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    display: none;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease-out;
}

.alert.show {
    display: flex;
}

.alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert i {
    font-size: 20px;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* تحقق النموذج */
.form-control:invalid {
    border-color: #dc3545;
}

.was-validated .form-control:invalid ~ .error-message {
    display: block;
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 5px;
}

.error-message {
    display: none;
}

/* نموذج الخدمة */
.form-section {
    display: none;
    padding: 60px 0;
    background-color: #f8f9fa;
}

.form-section.active {
    display: block;
}

/* تحسينات إضافية للأزرار */
.btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-submit:disabled:hover {
    transform: none;
}

/* تحسينات للحقول الديناميكية */
.form-check {
    margin-bottom: 8px;
}

.form-check-input {
    margin-top: 2px;
}

.form-check-label {
    margin-left: 5px;
    cursor: pointer;
}

/* تحسينات لرفع الملفات */
input[type="file"] {
    padding: 8px;
}

.form-text {
    font-size: 0.875rem;
    color: #6c757d;
}

/* تحسينات الاستجابة */
@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }
    
    .form-group {
        width: 100%;
        margin-bottom: 20px;
    }
}
