/* 
 * Responsive Design الشامل للموقع
 * Complete Responsive Design for the Website
 */

/* ===== GLOBAL RESPONSIVE SETTINGS ===== */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
    line-height: 1.6;
}

img {
    max-width: 100%;
    height: auto;
}

/* ===== CONTAINER RESPONSIVE ===== */
.container-fluid {
    padding-left: 15px;
    padding-right: 15px;
}

@media (max-width: 576px) {
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* ===== HEADER & NAVIGATION RESPONSIVE ===== */
.navbar {
    padding: 0.5rem 1rem;
}

.navbar-brand {
    font-size: 1.5rem;
}

.navbar-nav {
    margin-top: 0.5rem;
}

.navbar-nav .nav-link {
    padding: 0.5rem 1rem;
    font-size: 1rem;
}

/* Mobile Navigation */
@media (max-width: 991px) {
    .navbar-collapse {
        background: rgba(255, 255, 255, 0.98);
        margin-top: 10px;
        border-radius: 10px;
        padding: 20px;
        box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    }
    
    .navbar-nav {
        text-align: center;
    }
    
    .navbar-nav .nav-link {
        margin: 5px 0;
        border-radius: 5px;
        transition: all 0.3s ease;
    }
    
    .navbar-nav .nav-link:hover {
        background: #f8f9fa;
        transform: translateX(5px);
    }
    
    .navbar-toggler {
        border: none;
        padding: 0.25rem 0.5rem;
    }
    
    .navbar-toggler:focus {
        box-shadow: none;
    }
}

@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .navbar-nav .nav-link {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }
}

/* ===== HERO SECTION RESPONSIVE ===== */
.hero-section {
    padding: 100px 0 60px;
    min-height: 80vh;
    display: flex;
    align-items: center;
}

.hero-content h1 {
    font-size: 3.5rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.hero-buttons .btn {
    margin: 0.5rem;
    padding: 12px 30px;
    font-size: 1.1rem;
}

/* Hero Responsive */
@media (max-width: 1200px) {
    .hero-content h1 {
        font-size: 3rem;
    }
}

@media (max-width: 992px) {
    .hero-section {
        padding: 80px 0 40px;
        text-align: center;
    }
    
    .hero-content h1 {
        font-size: 2.5rem;
    }
    
    .hero-content p {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    .hero-section {
        padding: 60px 0 30px;
        min-height: 70vh;
    }
    
    .hero-content h1 {
        font-size: 2rem;
        margin-bottom: 1rem;
    }
    
    .hero-content p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-buttons .btn {
        display: block;
        width: 100%;
        margin: 0.5rem 0;
        padding: 15px;
    }
}

@media (max-width: 576px) {
    .hero-section {
        padding: 40px 0 20px;
        min-height: 60vh;
    }
    
    .hero-content h1 {
        font-size: 1.8rem;
    }
    
    .hero-content p {
        font-size: 0.9rem;
    }
}

/* ===== CARDS & PRODUCTS RESPONSIVE ===== */
.medical-product-card,
.medicine-card,
.service-card {
    margin-bottom: 2rem;
    height: 100%;
    transition: all 0.3s ease;
}

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

.medical-product-image,
.medicine-image {
    height: 200px;
    overflow: hidden;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.medical-product-image img,
.medicine-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.medical-product-card:hover .medical-product-image img,
.medicine-card:hover .medicine-image img {
    transform: scale(1.05);
}

/* Cards Responsive */
@media (max-width: 768px) {
    .medical-product-image,
    .medicine-image {
        height: 180px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-title {
        font-size: 1.1rem;
    }
    
    .card-text {
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .medical-product-image,
    .medicine-image {
        height: 160px;
    }
    
    .card-body {
        padding: 0.8rem;
    }
    
    .card-title {
        font-size: 1rem;
    }
    
    .card-text {
        font-size: 0.85rem;
    }
}

/* ===== GRID SYSTEM RESPONSIVE ===== */
@media (max-width: 1200px) {
    .col-xl-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }
}

@media (max-width: 992px) {
    .col-lg-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .col-lg-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

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

/* ===== BUTTONS RESPONSIVE ===== */
.btn {
    padding: 10px 20px;
    font-size: 0.95rem;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.btn-lg {
    padding: 15px 30px;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    .btn-lg {
        padding: 15px 25px;
        font-size: 1rem;
    }
    
    .btn-block {
        display: block;
        width: 100%;
    }
}

@media (max-width: 576px) {
    .btn {
        padding: 10px 15px;
        font-size: 0.85rem;
    }
}

/* ===== MODALS RESPONSIVE ===== */
.modal-dialog {
    margin: 1.75rem auto;
    max-width: 500px;
}

.modal-lg {
    max-width: 800px;
}

.modal-xl {
    max-width: 1140px;
}

@media (max-width: 992px) {
    .modal-lg {
        max-width: 90%;
    }
    
    .modal-xl {
        max-width: 95%;
    }
}

@media (max-width: 768px) {
    .modal-dialog {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 1rem;
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin: 0.25rem 0;
    }
}

@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-title {
        font-size: 1.1rem;
    }
}

/* ===== FORMS RESPONSIVE ===== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-control {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border-radius: 5px;
}

.form-control-lg {
    padding: 1rem 1.25rem;
    font-size: 1.1rem;
}

.form-control-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-control {
        padding: 0.6rem 0.8rem;
        font-size: 0.95rem;
    }
    
    .form-row .col {
        margin-bottom: 1rem;
    }
}

@media (max-width: 576px) {
    .form-control {
        padding: 0.5rem 0.7rem;
        font-size: 0.9rem;
    }
    
    .form-control-lg {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
}

/* ===== TABLES RESPONSIVE ===== */
.table-responsive {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
        white-space: nowrap;
    }
    
    .table-responsive table {
        min-width: 600px;
    }
}

@media (max-width: 576px) {
    .table-responsive {
        font-size: 0.8rem;
    }
    
    .table th,
    .table td {
        padding: 0.4rem;
    }
}

/* ===== PAGINATION RESPONSIVE ===== */
.pagination {
    justify-content: center;
    flex-wrap: wrap;
}

.page-link {
    padding: 0.5rem 0.75rem;
    margin: 0 0.125rem;
}

@media (max-width: 576px) {
    .pagination {
        font-size: 0.85rem;
    }
    
    .page-link {
        padding: 0.4rem 0.6rem;
        margin: 0.1rem;
    }
    
    .pagination .page-item:not(.active):not(.disabled) .page-link {
        display: none;
    }
    
    .pagination .page-item.active .page-link,
    .pagination .page-item:first-child .page-link,
    .pagination .page-item:last-child .page-link,
    .pagination .page-item:nth-child(2) .page-link,
    .pagination .page-item:nth-last-child(2) .page-link {
        display: block;
    }
}

/* ===== ALERTS & NOTIFICATIONS RESPONSIVE ===== */
.alert {
    border-radius: 10px;
    padding: 1rem 1.25rem;
}

@media (max-width: 768px) {
    .alert {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .alert-dismissible .btn-close {
        padding: 0.5rem;
    }
}

/* ===== BREADCRUMB RESPONSIVE ===== */
.breadcrumb {
    background: transparent;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
}

@media (max-width: 576px) {
    .breadcrumb {
        font-size: 0.85rem;
        flex-wrap: wrap;
    }
    
    .breadcrumb-item {
        margin-bottom: 0.25rem;
    }
}

/* ===== FOOTER RESPONSIVE ===== */
.footer {
    padding: 3rem 0 1rem;
    margin-top: 4rem;
}

.footer h5 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.footer ul {
    list-style: none;
    padding: 0;
}

.footer ul li {
    margin-bottom: 0.5rem;
}

.footer ul li a {
    color: #6c757d;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer ul li a:hover {
    color: #0B8A42;
}

@media (max-width: 768px) {
    .footer {
        padding: 2rem 0 1rem;
        text-align: center;
    }
    
    .footer .col-md-3 {
        margin-bottom: 2rem;
    }
    
    .footer h5 {
        font-size: 1.1rem;
    }
}

@media (max-width: 576px) {
    .footer {
        padding: 1.5rem 0 0.5rem;
    }
    
    .footer .col-md-3 {
        margin-bottom: 1.5rem;
    }
    
    .footer h5 {
        font-size: 1rem;
    }
    
    .footer ul li {
        margin-bottom: 0.3rem;
    }
}

/* ===== SEARCH & FILTERS RESPONSIVE ===== */
.search-container {
    margin-bottom: 2rem;
}

.search-form {
    display: flex;
    gap: 1rem;
    align-items: end;
}

.filter-container {
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .search-form {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .search-form .form-group {
        margin-bottom: 0.5rem;
    }
    
    .search-form .btn {
        width: 100%;
    }
    
    .filter-container .btn-group {
        width: 100%;
    }
    
    .filter-container .btn-group .btn {
        flex: 1;
        font-size: 0.85rem;
        padding: 0.5rem;
    }
}

@media (max-width: 576px) {
    .filter-container .btn-group {
        flex-direction: column;
    }
    
    .filter-container .btn-group .btn {
        width: 100%;
        margin-bottom: 0.25rem;
        border-radius: 5px !important;
    }
}

/* ===== LOADING STATES RESPONSIVE ===== */
.spinner-border {
    width: 2rem;
    height: 2rem;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

@media (max-width: 576px) {
    .spinner-border {
        width: 1.5rem;
        height: 1.5rem;
    }
}

/* ===== UTILITIES RESPONSIVE ===== */
@media (max-width: 768px) {
    .d-md-none {
        display: none !important;
    }
    
    .d-md-block {
        display: block !important;
    }
    
    .text-md-center {
        text-align: center !important;
    }
    
    .mb-md-3 {
        margin-bottom: 1rem !important;
    }
    
    .mt-md-3 {
        margin-top: 1rem !important;
    }
}

@media (max-width: 576px) {
    .d-sm-none {
        display: none !important;
    }
    
    .d-sm-block {
        display: block !important;
    }
    
    .text-sm-center {
        text-align: center !important;
    }
    
    .mb-sm-2 {
        margin-bottom: 0.5rem !important;
    }
    
    .mt-sm-2 {
        margin-top: 0.5rem !important;
    }
    
    .px-sm-2 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    .py-sm-2 {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }
}

/* ===== TYPOGRAPHY RESPONSIVE ===== */
h1, .h1 {
    font-size: 2.5rem;
}

h2, .h2 {
    font-size: 2rem;
}

h3, .h3 {
    font-size: 1.75rem;
}

h4, .h4 {
    font-size: 1.5rem;
}

h5, .h5 {
    font-size: 1.25rem;
}

h6, .h6 {
    font-size: 1rem;
}

@media (max-width: 768px) {
    h1, .h1 {
        font-size: 2rem;
    }
    
    h2, .h2 {
        font-size: 1.75rem;
    }
    
    h3, .h3 {
        font-size: 1.5rem;
    }
    
    h4, .h4 {
        font-size: 1.25rem;
    }
    
    h5, .h5 {
        font-size: 1.1rem;
    }
}

@media (max-width: 576px) {
    h1, .h1 {
        font-size: 1.75rem;
    }
    
    h2, .h2 {
        font-size: 1.5rem;
    }
    
    h3, .h3 {
        font-size: 1.25rem;
    }
    
    h4, .h4 {
        font-size: 1.1rem;
    }
    
    h5, .h5 {
        font-size: 1rem;
    }
    
    h6, .h6 {
        font-size: 0.9rem;
    }
}

/* ===== SPECIAL RESPONSIVE FIXES ===== */

/* Fix for Arabic text on mobile */
@media (max-width: 768px) {
    body[dir="rtl"] {
        text-align: right;
    }
    
    body[dir="rtl"] .text-center {
        text-align: center !important;
    }
    
    body[dir="rtl"] .navbar-nav {
        text-align: center;
    }
}

/* Fix for images with aspect ratio */
.aspect-ratio-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    border-radius: 10px;
}

.aspect-ratio-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Fix for long text overflow */
.text-truncate-mobile {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 576px) {
    .text-truncate-mobile {
        max-width: 200px;
    }
}

/* Fix for sticky elements on mobile */
@media (max-width: 768px) {
    .sticky-top {
        position: relative !important;
    }
}

/* Performance optimizations for mobile */
@media (max-width: 768px) {
    * {
        -webkit-tap-highlight-color: transparent;
    }
    
    .card,
    .btn,
    .modal-content {
        transform: translateZ(0);
        backface-visibility: hidden;
    }
}

/* Print styles */
@media print {
    .navbar,
    .footer,
    .btn,
    .modal,
    .alert-dismissible .btn-close {
        display: none !important;
    }
    
    .container-fluid {
        max-width: none !important;
        padding: 0 !important;
    }
    
    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }
}
