/**
 * أنماط منصة أحوال الطرق اليوم - التصميم الجديد
 * خط Tajawal - ألوان فيروزية محدثة
 */

/* الخطوط والألوان الأساسية */
:root {
    --primary-color: #0097B2; /* فيروزي معدل */
    --secondary-color: #83C5BE;
    --accent-color: #E29578;
    --light-color: #EDF6F9;
    --dark-color: #2c3e50;
    --safe-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
}

/* إعدادات عامة */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', sans-serif;
}

.rc-app {
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    direction: rtl;
    text-align: right;
}

.container {
    max-width: 100%;
    padding: 20px;
}

/* تحسينات إضافية للجوال */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .checkpoints-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .checkpoint-card {
        padding: 10px;
    }

    .cities-scroll {
        gap: 8px;
        padding: 8px 3px;
    }

    .city-card {
        width: 105px;
        padding: 10px 12px;
    }
}

/* الهيدر */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px 0;
    text-align: center;
    border-radius: 0 0 10px 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

header .subtitle {
    font-size: 1rem;
    opacity: 0.9;
    margin-top: 5px;
}

/* البحث */
.search-section {
    margin-bottom: 20px;
    position: relative;
}

.search-container {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 30px;
    padding: 8px 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border: 1px solid #ddd;
}

.search-container i {
    color: var(--primary-color);
    margin-left: 10px;
}

#search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 8px;
    font-size: 1rem;
    background: transparent;
}

.last-update {
    text-align: left;
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
    padding-right: 10px;
}

/* المدن */
.cities-section {
    margin: 25px 0;
}

.section-title {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.section-title i {
    margin-left: 8px;
    color: var(--primary-color);
}

.cities-scroll {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding: 10px 5px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.cities-scroll::-webkit-scrollbar {
    height: 6px;
}

.cities-scroll::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.city-card {
    flex: 0 0 auto;
    background: white;
    border-radius: 8px;
    padding: 12px 15px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
    width: 120px;
}

.city-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    border-color: var(--primary-color);
}

.city-card i {
    font-size: 1.4rem;
    color: var(--primary-color);
    margin-bottom: 8px;
    transition: all 0.3s;
}

.city-card:hover i {
    transform: scale(1.1);
}

.city-card.active {
    border-color: var(--accent-color);
    background-color: #fff9f9;
}

.city-card.active i {
    color: var(--accent-color);
}

/* الحواجز والطرق */
.checkpoints-section {
    margin-top: 30px;
}

.checkpoints-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.checkpoint-card {
    background: white;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: relative;
    transition: all 0.3s;
}

.checkpoint-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.checkpoint-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.checkpoint-name {
    font-weight: bold;
    font-size: 0.95rem;
    color: var(--dark-color);
}

.checkpoint-status {
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
}

.status-safe {
    background-color: var(--safe-color);
    color: white;
}

.status-warning {
    background-color: var(--warning-color);
    color: white;
}

.status-danger {
    background-color: var(--danger-color);
    color: white;
}

.status-unknown {
    background-color: #666;
    color: white;
}

.checkpoint-details {
    color: #666;
    font-size: 0.8rem;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.checkpoint-time {
    color: #888;
    font-size: 0.75rem;
    text-align: left;
}

.checkpoint-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    border-top: 1px solid #eee;
    padding-top: 8px;
}

.action-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 2px 5px;
    border-radius: 4px;
    transition: all 0.2s;
}

.action-btn:hover {
    background-color: rgba(0, 151, 178, 0.1);
    transform: scale(1.05);
}

.action-btn i {
    margin-left: 3px;
    font-size: 0.8rem;
}

.action-btn.update-btn {
    color: #b20097;
}

.action-btn.update-btn:hover {
    background-color: rgba(178, 0, 151, 0.1);
}

.no-results {
    text-align: center;
    padding: 30px;
    color: #666;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    grid-column: 1 / -1;
}

/* النماذج المنبثقة */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 15px;
}

.modal-box {
    background: white;
    padding: 15px;
    border-radius: 12px;
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.modal-title {
    font-size: 1.1rem;
    color: var(--primary-color);
    font-weight: 600;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: #666;
    padding: 2px;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.form-group {
    margin-bottom: 12px;
}

.form-label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 151, 178, 0.1);
}

textarea.form-control {
    min-height: 70px;
    resize: vertical;
}

/* خيارات الحالة */
.status-section {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 8px;
    background-color: #f9f9f9;
}

.status-section-title {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    font-size: 0.95rem;
}

.status-section-title i {
    margin-left: 6px;
    font-size: 0.9rem;
}

.status-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.status-option {
    position: relative;
}

.status-option input {
    position: absolute;
    opacity: 0;
}

.status-option label {
    display: block;
    padding: 8px 6px;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    border: 2px solid transparent;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.2;
}

.status-option label i {
    display: block;
    margin-bottom: 2px;
    font-size: 1rem;
}

.status-option input:checked + label {
    border-color: var(--primary-color);
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(0, 151, 178, 0.2);
}

.status-option .status-safe {
    background-color: #e8f5e9;
    color: var(--safe-color);
}

.status-option .status-warning {
    background-color: #fff3e0;
    color: var(--warning-color);
}

.status-option .status-danger {
    background-color: #ffebee;
    color: var(--danger-color);
}

.status-option .status-unknown {
    background-color: #f5f5f5;
    color: #666;
}

/* الأزرار */
.modal-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.btn {
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    font-size: 0.9rem;
    border: none;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

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

.btn-primary:hover {
    background-color: #00849b;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background-color: #e9e9e9;
    transform: translateY(-1px);
}

/* المشاركة */
.share-options {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.share-option {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.3s;
}

.share-option:hover {
    transform: scale(1.1);
}

.facebook { background: #3b5998; }
.twitter { background: #1da1f2; }
.whatsapp { background: #25d366; }
.link { background: var(--primary-color); }

.platform-link {
    margin-top: 15px;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 5px;
    text-align: center;
    word-break: break-all;
}

/* الاستجابة للشاشات الصغيرة */
@media (max-width: 480px) {
    .checkpoints-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .checkpoint-card {
        padding: 8px;
    }

    .checkpoint-name {
        font-size: 0.85rem;
        line-height: 1.2;
    }

    .checkpoint-status {
        padding: 2px 6px;
        font-size: 0.7rem;
    }

    .checkpoint-details {
        font-size: 0.75rem;
        line-height: 1.3;
        margin-bottom: 6px;
    }

    .checkpoint-time {
        font-size: 0.7rem;
    }

    .checkpoint-actions {
        margin-top: 6px;
        padding-top: 6px;
    }

    .action-btn {
        font-size: 0.7rem;
        padding: 1px 3px;
    }

    .action-btn i {
        font-size: 0.7rem;
        margin-left: 2px;
    }

    .city-card {
        width: 100px;
        padding: 8px 10px;
    }

    .city-card i {
        font-size: 1.2rem;
        margin-bottom: 6px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .modal-overlay {
        padding: 10px;
    }

    .modal-box {
        max-width: 95%;
        padding: 12px;
        max-height: 90vh;
    }

    .modal-title {
        font-size: 1rem;
    }

    .status-section {
        padding: 10px;
        margin-bottom: 12px;
    }

    .status-options {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .status-option label {
        padding: 10px 8px;
        font-size: 0.9rem;
    }

    .status-option label i {
        font-size: 1.1rem;
        margin-bottom: 3px;
    }

    .modal-footer {
        flex-direction: column;
        gap: 8px;
        margin-top: 12px;
        padding-top: 10px;
    }

    .btn {
        width: 100%;
        padding: 12px 16px;
        font-size: 0.95rem;
    }
}

/* للشاشات الصغيرة جداً */
@media (max-width: 360px) {
    .checkpoints-grid {
        gap: 6px;
    }

    .checkpoint-card {
        padding: 6px;
    }

    .checkpoint-name {
        font-size: 0.8rem;
    }

    .checkpoint-details {
        font-size: 0.7rem;
        -webkit-line-clamp: 1;
    }

    .action-btn {
        font-size: 0.65rem;
    }

    .city-card {
        width: 90px;
        padding: 6px 8px;
    }

    /* تحسينات إضافية للنماذج في الشاشات الصغيرة جداً */
    .modal-overlay {
        padding: 5px;
    }

    .modal-box {
        max-width: 98%;
        padding: 10px;
        border-radius: 8px;
    }

    .modal-title {
        font-size: 0.95rem;
    }

    .status-section-title {
        font-size: 0.9rem;
    }

    .status-option label {
        padding: 8px 6px;
        font-size: 0.8rem;
    }

    .status-option label i {
        font-size: 1rem;
    }

    .form-control {
        font-size: 0.85rem;
        padding: 6px 8px;
    }

    textarea.form-control {
        min-height: 60px;
    }
}

/* حالة التحميل */
.rc-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.rc-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* عدم وجود نتائج */
.rc-no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
    grid-column: 1 / -1;
}

.rc-no-results p {
    font-size: 1.2rem;
    margin: 0;
}

/* الأيقونات */
.rc-icon {
    display: inline-block;
    margin-left: 5px;
}

.rc-icon-search,
.rc-icon-refresh {
    font-size: inherit;
}

/* الاستجابة للشاشات الصغيرة */
@media (max-width: 768px) {
    .rc-main-title {
        font-size: 2rem;
    }
    
    .rc-subtitle {
        font-size: 1rem;
    }
    
    .rc-cities-scroll {
        gap: 8px;
    }
    
    .rc-city-btn {
        padding: 10px 16px;
        font-size: 13px;
        min-width: 100px;
    }
    
    .rc-updates-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .rc-section-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .rc-card-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .rc-card-footer {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .rc-container {
        padding: 0 15px;
    }

    .rc-main-title {
        font-size: 1.8rem;
    }

    .rc-region-card {
        padding: 15px;
    }

    .rc-search-box {
        margin: 0 15px;
    }
}

/* النموذج المنبثق */
.rc-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.rc-modal-content {
    background: var(--white);
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.rc-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    background: var(--light-bg);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.rc-modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
}

.rc-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
    padding: 5px;
    border-radius: 50%;
    transition: var(--transition);
}

.rc-modal-close:hover {
    background: var(--danger-color);
    color: var(--white);
}

.rc-update-form {
    padding: 25px;
}

.rc-status-section {
    margin-bottom: 25px;
}

.rc-status-group {
    margin-bottom: 20px;
}

.rc-status-group h4 {
    margin: 0 0 12px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    text-align: center;
}

.rc-status-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.rc-status-btn {
    background: var(--light-bg);
    border: 2px solid var(--border-color);
    color: var(--text-dark);
    padding: 12px 20px;
    border-radius: 25px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 90px;
    justify-content: center;
}

.rc-status-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.rc-status-btn.selected {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.rc-status-btn.rc-status-open.selected {
    background: var(--success-color);
    color: var(--white);
    border-color: var(--success-color);
}

.rc-status-btn.rc-status-warning.selected {
    background: var(--warning-color);
    color: var(--text-dark);
    border-color: var(--warning-color);
}

.rc-status-btn.rc-status-closed.selected {
    background: var(--danger-color);
    color: var(--white);
    border-color: var(--danger-color);
}

.rc-form-group {
    margin-bottom: 20px;
}

.rc-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
}

.rc-form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    transition: var(--transition);
}

.rc-form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 139, 139, 0.1);
}

.rc-form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.rc-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    justify-content: center;
}

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

.rc-btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.rc-btn-secondary {
    background: var(--light-bg);
    color: var(--text-dark);
    border: 2px solid var(--border-color);
}

.rc-btn-secondary:hover {
    background: var(--border-color);
    transform: translateY(-2px);
}

.rc-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* الاستجابة للنموذج المنبثق */
@media (max-width: 768px) {
    .rc-modal {
        padding: 10px;
    }

    .rc-modal-content {
        max-height: 95vh;
    }

    .rc-status-buttons {
        flex-direction: column;
        align-items: center;
    }

    .rc-status-btn {
        width: 100%;
        max-width: 200px;
    }

    .rc-form-actions {
        flex-direction: column;
    }

    .rc-btn {
        width: 100%;
    }
}
