/* Base Styles and Variables */
:root {
    /* Light Mode Colors */
    --primary-color: #0066cc;
    --secondary-color: #2c3e50;
    --background-color: #ffffff;
    --surface-color: #f8f9fa;
    --text-color: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --hover-color: #f0f7ff;
    
    /* Transitions */
    --transition-speed: 0.3s;
}

/* Dark Mode Colors */
.dark-mode {
    --primary-color: #4d9fff;
    --secondary-color: #8ab4f8;
    --background-color: #121212;
    --surface-color: #1e1e1e;
    --text-color: #f0f0f0;
    --text-secondary: #b0b0b0;
    --border-color: #333333;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    --hover-color: #1a2733;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    overflow-x: hidden;
    direction: rtl;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color var(--transition-speed);
    padding: 10px;
}

a:hover {
    color: var(--secondary-color);
}

ul {
    list-style: none;
}

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

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 0;
    width: 50px;
    height: 4px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

.section-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    max-width: 700px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-speed);
    border: none;
    outline: none;
}

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

.btn-primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Preloader */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

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

.welcome-text {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--primary-color);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 1s ease forwards;
}

.loading-bar {
    width: 200px;
    height: 4px;
    background-color: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto;
}

.loading-progress {
    height: 100%;
    width: 0;
    background-color: var(--primary-color);
    animation: loading 2s ease-in-out forwards;
}

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

@keyframes loading {
    0% {
        width: 0;
    }
    100% {
        width: 100%;
    }
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
}

#theme-toggle-btn {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed);
    box-shadow: var(--card-shadow);
}

#theme-toggle-btn:hover {
    transform: scale(1.1);
}

#theme-toggle-btn svg {
    width: 20px;
    height: 20px;
    color: var(--text-color);
}

.light-mode .moon-icon {
    display: block;
}

.light-mode .sun-icon {
    display: none;
}

.dark-mode .moon-icon {
    display: none;
}

.dark-mode .sun-icon {
    display: block;
}

/* Header */
.header {
    padding: 20px 0;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background-color: var(--background-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all var(--transition-speed);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    font-size: 1.8rem;
    margin-bottom: 0;
    color: var(--primary-color);
}

.main-nav ul {
    display: flex;
}

.main-nav li {
    margin-right: 30px;
}

.main-nav li:last-child {
    margin-right: 0;
}

.main-nav a {
    font-weight: 600;
    color: var(--text-color);
    position: relative;
    padding-bottom: 5px;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width var(--transition-speed);
}

.main-nav a:hover {
    color: var(--primary-color);
}

.main-nav a:hover::after {
    width: 100%;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
}

.mobile-menu-toggle span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: var(--text-color);
    border-radius: 3px;
    transition: all var(--transition-speed);
}

/* Hero Section */
.hero {
    padding: 160px 0 100px;
    background-color: var(--background-color);
    position: relative;
    overflow: hidden;
}

.hero .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hero-content {
    flex: 1;
    max-width: 600px;
}

.hero-title {
    font-size: 3.5rem;
    margin-bottom: 20px;
    line-height: 1.2;
}

.hero-title .highlight {
    color: var(--primary-color);
    position: relative;
    display: inline-block;
}

.hero-title .highlight::after {
    content: '';
    position: absolute;
    bottom: 5px;
    right: 0;
    width: 100%;
    height: 8px;
    background-color: rgba(0, 102, 204, 0.2);
    z-index: -1;
}

.hero-description {
    font-size: 1.2rem;
    margin-bottom: 30px;
    color: var(--text-secondary);
}

.hero-cta {
    display: flex;
    gap: 15px;
}

.hero-image {
    flex: 1;
    position: relative;
    height: 400px;
}

.hero-shape {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #00a0ff 100%);
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: morphShape 15s ease-in-out infinite;
}

@keyframes morphShape {
    0% {
        border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    }
    25% {
        border-radius: 58% 42% 75% 25% / 76% 46% 54% 24%;
    }
    50% {
        border-radius: 50% 50% 33% 67% / 55% 27% 73% 45%;
    }
    75% {
        border-radius: 33% 67% 58% 42% / 63% 68% 32% 37%;
    }
    100% {
        border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    }
}

/* Services Section */
.services {
    padding: 100px 0;
    background-color: var(--surface-color);
}

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

.section-header .section-title::after {
    right: 50%;
    transform: translateX(50%);
}

.section-header .section-description {
    margin-left: auto;
    margin-right: auto;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

.service-card {
    background-color: var(--background-color);
    border-radius: 10px;
    padding: 30px;
    box-shadow: var(--card-shadow);
    transition: all var(--transition-speed);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background-color: var(--primary-color);
    opacity: 0;
    z-index: -1;
    transition: opacity var(--transition-speed);
}

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

.service-card:hover::before {
    opacity: 0.05;
}

.service-icon {
    margin-bottom: 20px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 102, 204, 0.1);
    border-radius: 50%;
}

.service-icon svg {
    width: 30px;
    height: 30px;
    color: var(--primary-color);
}

.service-title {
    font-size: 1.3rem;
    margin-bottom: 15px;
}

.service-description {
    color: var(--text-secondary);
}

/* Technologies Section */
.technologies {
    padding: 100px 0;
    background-color: var(--background-color);
}

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

.tech-item {
    background-color: var(--surface-color);
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    box-shadow: var(--card-shadow);
    transition: all var(--transition-speed);
}

.tech-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.tech-icon {
    margin: 0 auto 20px;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tech-icon svg {
    width: 50px;
    height: 50px;
    color: var(--primary-color);
    transition: all var(--transition-speed);
}

.tech-item:hover .tech-icon svg {
    transform: scale(1.1);
}

.tech-name {
    font-size: 1.2rem;
    margin-bottom: 0;
}

/* Contact Section */
.contact {
    padding: 100px 0;
    background-color: var(--surface-color);
}

.contact-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 50px;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.info-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.info-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 102, 204, 0.1);
    border-radius: 50%;
    flex-shrink: 0;
}

.info-icon svg {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
}

.info-content h3 {
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.info-content p {
    color: var(--text-secondary);
}

.contact-form-container {
    background-color: var(--background-color);
    border-radius: 10px;
    padding: 40px;
    box-shadow: var(--card-shadow);
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.form-field {
    position: relative;
    margin-bottom: 20px;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: transparent;
    color: var(--text-color);
    font-family: 'Tajawal', sans-serif;
    font-size: 1rem;
    transition: all var(--transition-speed);
}

.form-field textarea {
    min-height: 150px;
    resize: vertical;
}

.form-field label {
    position: absolute;
    top: 15px;
    right: 15px;
    color: var(--text-secondary);
    transition: all var(--transition-speed);
    pointer-events: none;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: var(--primary-color);
    outline: none;
}

.form-field input:focus ~ label,
.form-field select:focus ~ label,
.form-field textarea:focus ~ label,
.form-field input:not(:placeholder-shown) ~ label,
.form-field select:not([value=""]):not([value="undefined"]) ~ label,
.form-field textarea:not(:placeholder-shown) ~ label {
    top: -10px;
    right: 10px;
    font-size: 0.8rem;
    background-color: var(--background-color);
    padding: 0 5px;
    color: var(--primary-color);
}

.form-field .field-animation {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width var(--transition-speed);
}

.form-field input:focus ~ .field-animation,
.form-field select:focus ~ .field-animation,
.form-field textarea:focus ~ .field-animation {
    width: 100%;
}

.form-submit {
    margin-top: 20px;
}

.form-submit button {
    width: 100%;
}

/* Footer */
.footer {
    padding: 80px 0 20px;
    background-color: var(--background-color);
    border-top: 1px solid var(--border-color);
}

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

.footer-logo h2 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.footer-logo p {
    color: var(--text-secondary);
}

.footer-links h3,
.footer-social h3 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
}

.footer-links h3::after,
.footer-social h3::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 0;
    width: 30px;
    height: 2px;
    background-color: var(--primary-color);
}

.footer-links ul {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-links a {
    color: var(--text-secondary);
    transition: color var(--transition-speed);
}

.footer-links a:hover {
    color: var(--primary-color);
}

.social-icons {
    display: flex;
    gap: 15px;
}

.social-icons a {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--surface-color);
    border-radius: 50%;
    transition: all var(--transition-speed);
}

.social-icons a:hover {
    background-color: var(--primary-color);
}

.social-icons svg {
    width: 20px;
    height: 20px;
    color: var(--text-color);
    transition: color var(--transition-speed);
}

.social-icons a:hover svg {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.footer-bottom p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Responsive Styles */
@media (max-width: 992px) {
    .hero-title {
        font-size: 2.8rem;
    }
    
    .hero-image {
        display: none;
    }
    
    .hero-content {
        max-width: 100%;
    }
    
    .contact-container {
        grid-template-columns: 1fr;
    }
    
    .contact-info {
        order: 2;
    }
    
    .contact-form-container {
        order: 1;
    }
}

@media (max-width: 768px) {
    .main-nav {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .hero {
        padding: 120px 0 80px;
    }
    
    .hero-title {
        font-size: 2.2rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
    }
    
    .tech-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .hero-cta {
        flex-direction: column;
        gap: 10px;
    }
    
    .hero-cta .btn {
        width: 100%;
        text-align: center;
    }
    
    .tech-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    height: 100%;
    background-color: var(--background-color);
    z-index: 999;
    padding: 80px 20px 20px;
    transition: right var(--transition-speed);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu ul {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.mobile-menu a {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
}

.mobile-menu-close {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 30px;
    height: 30px;
    cursor: pointer;
}

.mobile-menu-close::before,
.mobile-menu-close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--text-color);
}

.mobile-menu-close::before {
    transform: rotate(45deg);
}

.mobile-menu-close::after {
    transform: rotate(-45deg);
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-speed);
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(50px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-50px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

.animate-fade-in {
    animation: fadeIn 1s ease forwards;
}

.animate-slide-right {
    animation: slideInRight 1s ease forwards;
}

.animate-slide-left {
    animation: slideInLeft 1s ease forwards;
}

.animate-slide-up {
    animation: slideInUp 1s ease forwards;
}

/* Animation Delays */
.delay-100 {
    animation-delay: 0.1s;
}

.delay-200 {
    animation-delay: 0.2s;
}

.delay-300 {
    animation-delay: 0.3s;
}

.delay-400 {
    animation-delay: 0.4s;
}

.delay-500 {
    animation-delay: 0.5s;
}

/* Form Placeholder Fix */
.form-field input::placeholder,
.form-field textarea::placeholder {
    color: transparent;
}

/* Scroll to Top Button */
.scroll-top {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-speed);
    z-index: 99;
}

.scroll-top.active {
    opacity: 1;
    visibility: visible;
}

.scroll-top svg {
    width: 20px;
    height: 20px;
}

.scroll-top:hover {
    transform: translateY(-5px);
}
