/**
 * ========================================
 * القرارات المساحية - التصميم (CSS)
 * ========================================
 * 
 * تصميم مستوحى من هوية وزارة البلديات والإسكان
 * Responsive, RTL, Dark Mode Support
 */

 :root {
    /* الألوان الأساسية - هوية الوزارة */
    --colors-brand-50: #f0faf5;
    --colors-brand-100: #dcfae9;
    --colors-brand-500: #25935f;
    --colors-brand-600: #1b8354;
    --colors-brand-700: #166a45;
    --colors-brand-800: #14573a;
    
    /* الألوان الرمادية */
    --colors-gray-50: #f9fafb;
    --colors-gray-100: #f3f4f6;
    --colors-gray-200: #e5e7eb;
    --colors-gray-300: #d1d5db;
    --colors-gray-400: #9ca3af;
    --colors-gray-500: #6b7280;
    --colors-gray-600: #4b5563;
    --colors-gray-700: #374151;
    --colors-gray-800: #1f2937;
    --colors-gray-900: #111827;

    /* ألوان الحالة (نجاح/خطأ) */
    --colors-error-50: #fff1f3;
    --colors-error-100: #ffe4e6;
    --colors-error-500: #f43f5e;
    --colors-error-600: #e11d48;
    --colors-error-700: #be123c;
    
    --colors-success-50: #ecfdf5;
    --colors-success-100: #d1fae5;
    --colors-success-500: #10b981;
    --colors-success-600: #059669;
    --colors-success-700: #047857;

    /* إعدادات الخطوط والتخطيط */
    --font-family-ar: 'IBM Plex Sans Arabic', system-ui, -apple-system, sans-serif;
    --border-radius-sm: 0.375rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 1rem;
    --border-radius-xl: 1.5rem;
    --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);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* المتغيرات الديناميكية للوضع المظلم/الفاتح */
    --bg-main: var(--colors-gray-50);
    --bg-card: #ffffff;
    --text-primary: var(--colors-gray-900);
    --text-secondary: var(--colors-gray-600);
    --border-color: var(--colors-gray-200);
    --input-bg: #ffffff;
}

/* ========================================
   دعم الوضع الداكن (Dark Mode)
======================================== */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-main: #0f172a;
        --bg-card: #1e293b;
        --text-primary: #f8fafc;
        --text-secondary: #94a3b8;
        --border-color: #334155;
        --input-bg: #0f172a;
        
        --colors-brand-50: #022c22;
        --colors-brand-100: #064e3b;
        
        --colors-error-50: #4c0519;
        --colors-error-100: #881337;
        
        --colors-success-50: #064e3b;
        --colors-success-100: #065f46;
    }
}

/* ========================================
   التصفير الأساسي
======================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    height: 100%;
}

body {
    font-family: var(--font-family-ar);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* تم إزالة الشريط العلوي */

/* ========================================
   المحتوى الرئيسي
======================================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ========================================
   القسم الرئيسي (Hero)
======================================== */
.hero-section {
    position: relative;
    padding: 4rem 1.5rem 3rem;
    text-align: center;
    background: linear-gradient(135deg, var(--colors-brand-800) 0%, var(--colors-brand-600) 100%);
    color: white;
    overflow: hidden;
}

.hero-bg-pattern {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.1;
    background-image: radial-gradient(circle at 2px 2px, white 1px, transparent 0);
    background-size: 24px 24px;
}

.hero-content {
    position: relative;
    z-index: 10;
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.hero-subtitle {
    font-size: 1.5rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95); /* لون أبيض فاتح للقراءة على الخلفية الخضراء الداكنة */
    margin-bottom: 1.5rem;
}

.hero-description {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.9);
    max-width: 600px;
    margin: 0 auto;
}

/* ========================================
   قسم البحث
======================================== */
.search-section {
    padding: 0 1.5rem;
    margin-top: -3rem;
    position: relative;
    z-index: 20;
}

.search-card {
    background-color: var(--bg-card);
    max-width: 600px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.input-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 1.125rem;
}

.label-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--colors-brand-500);
}

.input-wrapper {
    position: relative;
    margin-bottom: 0.5rem;
}

.search-input {
    width: 100%;
    padding: 1.25rem 1rem 1.25rem 4rem;
    font-size: 1.25rem;
    font-family: inherit;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background-color: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.2s ease;
    text-align: right;
    direction: ltr; /* للأرقام */
}

/* إخفاء أسهم الأرقام */
.search-input::-webkit-outer-spin-button,
.search-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.search-input[type=number] {
    -moz-appearance: textfield;
}

.search-input:focus {
    outline: none;
    border-color: var(--colors-brand-500);
    box-shadow: 0 0 0 4px var(--colors-brand-50);
}

.search-input.input-invalid {
    border-color: var(--colors-error-500);
}

.search-input.input-invalid:focus {
    box-shadow: 0 0 0 4px var(--colors-error-50);
}

.input-counter {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    pointer-events: none;
}

.input-counter.complete {
    color: var(--colors-success-600);
}

.input-error {
    color: var(--colors-error-600);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    min-height: 1.25rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.2s ease;
}

.input-error.visible {
    opacity: 1;
    transform: translateY(0);
}

.search-btn {
    width: 100%;
    margin-top: 1.5rem;
    padding: 1.25rem;
    background-color: var(--colors-brand-600);
    color: white;
    border: none;
    border-radius: var(--border-radius-md);
    font-size: 1.25rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.search-btn:hover:not(:disabled) {
    background-color: var(--colors-brand-700);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.search-btn:active:not(:disabled) {
    transform: translateY(1px);
}

.search-btn:disabled {
    background-color: var(--colors-brand-500);
    opacity: 0.8;
    cursor: not-allowed;
}

.btn-icon {
    width: 1.5rem;
    height: 1.5rem;
}

.btn-loader {
    display: none;
    align-items: center;
    gap: 0.5rem;
}

.spinner {
    width: 1.5rem;
    height: 1.5rem;
    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); }
}

.search-btn.loading .btn-text,
.search-btn.loading .btn-icon {
    display: none;
}

.search-btn.loading .btn-loader {
    display: flex;
}

/* ========================================
   قسم النتائج
======================================== */
.results-section {
    max-width: 600px;
    margin: 2rem auto 4rem;
    padding: 0 1.5rem;
    width: 100%;
}

.result-card {
    background-color: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.animate-in {
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.result-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 2rem;
}

.result-icon {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.result-icon svg {
    width: 2rem;
    height: 2rem;
}

.success-icon {
    background-color: var(--colors-success-50);
    color: var(--colors-success-600);
}

.error-icon {
    background-color: var(--colors-error-50);
    color: var(--colors-error-600);
}

.result-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.error-title {
    color: var(--colors-error-600);
}

.result-details {
    background-color: var(--bg-main);
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.detail-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 1rem 0;
}

.detail-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.detail-value {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.125rem;
}

.plot-number {
    font-family: system-ui, -apple-system, sans-serif; /* لضمان ظهور الأرقام والشرطة بشكل صحيح */
    direction: ltr;
}

.download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1.25rem;
    background-color: var(--colors-brand-50);
    color: var(--colors-brand-700);
    border: 2px solid var(--colors-brand-600);
    border-radius: var(--border-radius-md);
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
}

.download-btn:hover {
    background-color: var(--colors-brand-600);
    color: white;
}

.download-icon {
    width: 1.5rem;
    height: 1.5rem;
}

/* ========================================
   التذييل
======================================== */
.footer {
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: auto;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ========================================
   التجاوب (Responsive)
======================================== */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1.25rem;
    }
    
    .search-card {
        padding: 1.5rem;
    }
    
    .detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}
