/* Normalize and reset basic styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.5;
    background-color: #fff;
    color: #000;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img,
video {
    max-width: 100%;
    height: auto;
    display: block;
}

button,
input,
textarea,
select {
    font: inherit;
    background: none;
    border: none;
    outline: none;
}

a,
button {
    touch-action: manipulation;
}

.container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 1rem;
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.col {
    flex: 1 1 100%;
}

.hidden {
    display: none !important;
}

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

.mt-1 {
    margin-top: 1rem;
}

.mb-1 {
    margin-bottom: 1rem;
}

/* ============================================
   MOBILE HEADER
   ============================================ */
@media screen and (max-width: 768px) {

    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    body {
        font-size: 16px;
        line-height: 1.5;
        overflow-x: hidden;
    }

    .container {
        width: 100% !important;
        padding: 0 15px !important;
        margin: 0 auto !important;
    }

    .header {
        height: auto !important;
        padding: 10px 0 !important;
    }

    .header .logo a .content {
        display: flex;
        align-items: center;
    }

    .header .logo a .content img {
        width: 50px !important;
        height: 50px !important;
    }

    .header .logo a .content p {
        font-size: 16px !important;
    }

    .header .nav {
        display: none;
        flex-direction: column !important;
        align-items: stretch !important;
        background: #fff;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        z-index: 1000;
        padding: 20px 0 10px 0;
        border-radius: 0 0 20px 20px;
        transition: 0.3s;
    }

    .header .nav.open {
        display: flex !important;
    }

    .header .nav .links {
        flex-direction: column !important;
        gap: 15px !important;
        padding: 0 20px !important;
    }

    .header .nav .links li {
        width: 100% !important;
        margin: 0 !important;
    }

    .header .nav .links li a {
        display: block !important;
        width: 100% !important;
        text-align: center !important;
        padding: 15px 0 !important;
        background: #671475 !important;
        color: #fff !important;
        border-radius: 25px !important;
        font-size: 18px !important;
        margin-bottom: 8px !important;
        box-shadow: 0 2px 8px rgba(103, 20, 117, 0.08);
        border: none !important;
        transition: background 0.2s;
    }

    .header .nav .links li a:hover {
        background: #4e0e5e !important;
        color: #fff !important;
    }

    .header .nav .profile {
        margin: 10px 20px 0 20px !important;
        width: calc(100% - 40px) !important;
    }

    .header .nav .profile a,
    .header .nav .profile .profile-toggle {
        display: block !important;
        width: 100% !important;
        text-align: center !important;
        padding: 15px 0 !important;
        background: #671475 !important;
        color: #fff !important;
        border-radius: 25px !important;
        font-size: 18px !important;
        margin-bottom: 8px !important;
        border: none !important;
    }

    .header .nav .profile a:hover,
    .header .nav .profile .profile-toggle:hover {
        background: #4e0e5e !important;
        color: #fff !important;
    }

    .header .toggle-menu {
        display: flex !important;
        flex-direction: column !important;
        gap: 5px !important;
        width: 35px !important;
        padding: 5px !important;
        cursor: pointer !important;
        z-index: 1100;
    }

    .header .toggle-menu span {
        height: 4px !important;
        background-color: #671475 !important;
        border-radius: 2px;
        transition: 0.3s;
    }
}

@media (max-width: 768px) {
    .header {
        height: auto !important;
        padding: 10px 0 !important;
        background: #fff !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    }

    .header .container {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    .header .logo a .content img {
        width: 50px !important;
        height: 50px !important;
    }

    .header .logo a .content p {
        font-size: 18px !important;
        margin-right: 10px !important;
    }
}

/* ============================================
   MOBILE LANDING
   ============================================ */
@media (max-width: 768px) {
    .landing .text {
        width: 95% !important;
        padding: 20px 5px !important;
    }

    .landing .text h1 {
        font-size: 22px !important;
        margin-bottom: 10px !important;
    }

    .landing .text p {
        font-size: 15px !important;
        line-height: 1.5 !important;
    }

    .landing .text .search {
        width: 100% !important;
        font-size: 18px !important;
        padding: 12px !important;
        margin-top: 15px !important;
        border-radius: 8px !important;
        box-sizing: border-box;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .landing .text .search i {
        font-size: 18px !important;
        margin-right: 7px !important;
    }
}

/* ============================================
   MOBILE OPERATIONS - الإصلاح الرئيسي
   ============================================ */
@media (max-width: 768px) {
    .operations {
        padding: 40px 0 !important;
    }

    .operations h2 {
        font-size: 22px !important;
        margin-bottom: 25px !important;
        padding: 0 16px !important;
    }

    .operations .container {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 14px !important;
        padding: 0 16px !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        align-items: stretch !important;
    }

    .operations .option {
        padding: 18px 12px !important;
        border-radius: 16px !important;
        background: #fff !important;
        box-shadow: 0 2px 10px rgba(103, 20, 117, 0.08) !important;
        width: 100% !important;
        min-height: 220px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        aspect-ratio: unset !important;
    }

    .operations .option img {
        width: 70px !important;
        height: 70px !important;
        margin-bottom: 10px !important;
        display: block !important;
    }

    .operations .option p {
        font-size: 14px !important;
        font-weight: 700 !important;
        text-align: center !important;
        margin-bottom: 6px !important;
        line-height: 1.4 !important;
    }

    .operations .option h3 {
        font-size: 12px !important;
        line-height: 1.5 !important;
        text-align: center !important;
        margin-bottom: 10px !important;
        flex-grow: 1 !important;
    }

    .operations .option a {
        padding: 8px 18px !important;
        font-size: 13px !important;
        border-radius: 50px !important;
        margin-top: auto !important;
    }
}

/* موبايل صغير جداً - عمود واحد */
@media (max-width: 400px) {
    .operations .container {
        grid-template-columns: 1fr !important;
        padding: 0 14px !important;
    }

    .operations .option {
        min-height: auto !important;
        padding: 20px 16px !important;
    }

    .operations .option img {
        width: 80px !important;
        height: 80px !important;
    }

    .operations .option p {
        font-size: 16px !important;
    }

    .operations .option h3 {
        font-size: 14px !important;
    }
}

/* ============================================
   RESPONSIVE VIDEO - الإصلاح الرئيسي
   ============================================ */
@media (max-width: 768px) {
    .responsive-video {
        margin: 30px auto !important;
        padding: 0 16px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        position: static !important;
        padding-bottom: 0 !important;
        background: transparent !important;
        overflow: visible !important;
    }

    .responsive-video iframe {
        position: static !important;
        width: 100% !important;
        height: auto !important;
        aspect-ratio: 16 / 9 !important;
        border-radius: 12px !important;
        border: 0 !important;
        display: block !important;
        min-height: unset !important;
    }
}

/* ============================================
   MOBILE CONTACT
   ============================================ */
@media (max-width: 768px) {
    .contact {
        padding: 30px 0;
    }

    .contact .container form {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .contact form input,
    .contact form textarea {
        font-size: 16px;
        padding: 8px;
    }

    .contact form [type="submit"] {
        font-size: 18px;
    }
}

/* ============================================
   MOBILE FOOTER
   ============================================ */
@media (max-width: 768px) {
    .footer .container {
        flex-direction: column !important;
        gap: 20px !important;
        text-align: center !important;
        padding: 15px !important;
    }

    .footer .links {
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 10px !important;
    }

    .footer .links li {
        width: auto !important;
        margin: 5px !important;
    }

    .footer .links li a {
        font-size: 14px !important;
        padding: 5px 10px !important;
    }
}

/* ============================================
   MOBILE FORMS
   ============================================ */
@media (max-width: 768px) {

    .login,
    .signup {
        width: 95%;
        padding: 25px 20px;
    }

    .login h1,
    .signup h1 {
        font-size: 22px;
    }

    .login form input,
    .signup form input {
        height: 45px;
        font-size: 14px;
    }

    .login .other {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* ============================================
   MOBILE SEARCH IMAGE
   ============================================ */
@media (max-width: 768px) {
    .search-image {
        padding: 20px 0;
    }

    .search-image .container {
        flex-direction: column;
    }

    .search-image .upload-section,
    .search-image .results-section {
        width: 100%;
    }
}

/* ============================================
   MOBILE ALL PEOPLE
   ============================================ */
@media (max-width: 768px) {
    .all-people .filters {
        flex-direction: column;
        gap: 10px;
    }

    .all-people .filters select,
    .all-people .filters input {
        width: 100%;
    }

    .all-people .content {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   UTILITY CLASSES FOR MOBILE
   ============================================ */
@media (max-width: 768px) {
    /* إخفاء شريط التمرير */
    ::-webkit-scrollbar {
        display: none !important;
    }

    * {
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
    }

    .hidden-mobile {
        display: none !important;
    }

    .text-center-mobile {
        text-align: center !important;
    }

    .mt-1-mobile {
        margin-top: 1rem !important;
    }

    .mb-1-mobile {
        margin-bottom: 1rem !important;
    }
}

/* Fix for mobile navigation menu */
@media (max-width: 768px) {
    .header .nav {
        background-color: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
    }

    .header .toggle-menu {
        display: flex;
        z-index: 1000;
    }
}