/* ===============================================
   ADVANCED RESPONSIVE STYLES - MOHAMED EMAD
   =============================================== */

/* Mobile First Approach - Base styles are for mobile */

/* ===============================================
   MOBILE STYLES (320px - 768px)
   =============================================== */

/* General Mobile Adjustments */
@media (max-width: 768px) {
  :root {
    --font-size-5xl: 2rem;
    --font-size-4xl: 1.75rem;
    --font-size-3xl: 1.5rem;
    --font-size-2xl: 1.25rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    --spacing-3xl: 4rem;
  }

  body {
    font-size: 14px;
  }

  .container {
    padding: 0 1rem;
  }

  /* Navigation */
  .navbar {
    padding: 0.75rem;
  }

  .nav-brand {
    font-size: 1rem;
  }

  .nav-links {
    position: fixed;
    top: 60px;
    left: -100%;
    width: 100%;
    height: calc(100vh - 60px);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding-top: 2rem;
    transition: left 0.3s ease;
    z-index: 999;
  }

  .nav-links.active {
    left: 0;
  }

  .nav-links li {
    margin: 1rem 0;
  }

  .nav-links a {
    font-size: 1.1rem;
    padding: 1rem 2rem;
    border-radius: 10px;
    transition: all 0.3s ease;
  }

  .nav-links a:hover {
    background: var(--gradient-primary);
    color: white;
    transform: translateX(10px);
  }

  .hamburger {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1000;
  }

  .hamburger span {
    width: 25px;
    height: 3px;
    background: var(--primary-color);
    margin: 3px 0;
    transition: 0.3s;
    border-radius: 2px;
  }

  .hamburger.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
  }

  .hamburger.active span:nth-child(2) {
    opacity: 0;
  }

  .hamburger.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
  }

  /* Hero Section */
  .hero {
    min-height: 90vh;
    padding: 4rem 0 2rem;
  }

  .hero-content {
    text-align: center;
    gap: 1.5rem;
  }

  .hero h1 {
    font-size: 2rem;
    line-height: 1.2;
  }

  .hero .subtitle {
    font-size: 1rem;
    margin: 1rem 0;
  }

  .hero-description {
    font-size: 0.9rem;
    line-height: 1.6;
  }

  .hero-stats {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }

  .stat-item {
    min-width: 100px;
    padding: var(--spacing-sm) var(--spacing-md);
  }

  .hero-buttons {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
  }

  .btn {
    width: 200px;
    justify-content: center;
  }

  .hero-image {
    margin: var(--spacing-lg) auto;
    display: flex;
    justify-content: center;
  }

  .profile-img {
    width: 150px;
    height: 150px;
  }

  .floating-shape {
    display: none; /* Hide floating shapes on mobile for performance */
  }

  .status-indicator {
    margin: var(--spacing-sm) auto var(--spacing-md);
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-xs);
  }

  /* About Section */
  .about-content {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }

  .about-text {
    order: 2;
  }

  .about-image {
    order: 1;
    margin: 0 auto;
  }

  .about-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .stat-item {
    padding: 1rem;
  }

  .stat-number {
    font-size: 1.5rem;
  }

  /* Quick Facts */
  .quick-facts {
    grid-template-columns: 1fr;
    gap: var(--spacing-sm);
  }

  .fact-item {
    padding: var(--spacing-sm);
    font-size: var(--font-size-sm);
  }

  /* Timeline */
  .timeline-item {
    padding: var(--spacing-md);
    padding-left: calc(var(--spacing-md) + 40px);
  }

  .timeline-content {
    padding-left: 40px;
  }

  .timeline-icon {
    width: 35px;
    height: 35px;
    left: var(--spacing-sm);
    font-size: var(--font-size-base);
  }

  .timeline-date {
    position: static;
    margin-bottom: var(--spacing-sm);
    display: block;
    width: fit-content;
  }

  .timeline-achievements {
    flex-direction: column;
    gap: var(--spacing-xs);
  }

  /* Certifications */
  .cert-grid {
    grid-template-columns: 1fr;
  }

  .cert-item {
    padding: var(--spacing-md);
  }

  .cert-icon {
    width: 50px;
    height: 50px;
    font-size: var(--font-size-lg);
  }

  /* Skills Section */
  .skills-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .skill-category h3 {
    font-size: 1.1rem;
  }

  .skill-item {
    margin-bottom: 1rem;
  }

  .skill-name {
    font-size: 0.9rem;
  }

  /* Portfolio Section */
  .portfolio-filters {
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
  }

  .filter-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    min-width: auto;
  }

  .portfolio-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .portfolio-item {
    margin-bottom: 1rem;
  }

  .portfolio-content h3 {
    font-size: 1.1rem;
  }

  .portfolio-content p {
    font-size: 0.85rem;
    line-height: 1.5;
  }

  .tech-stack {
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .tech-tag {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
  }

  .portfolio-links {
    gap: 0.5rem;
  }

  .portfolio-links a {
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
  }

  /* Experience Section */
  .timeline {
    padding-left: 1rem;
  }

  .timeline::before {
    left: 0;
  }

  .timeline-item {
    padding-left: 2rem;
    margin-bottom: 2rem;
  }

  .timeline-item::before {
    left: -6px;
    width: 12px;
    height: 12px;
  }

  .timeline-content {
    margin-left: 0;
  }

  .timeline-date {
    position: static;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 15px;
    font-size: 0.7rem;
    display: inline-block;
    margin-bottom: 0.5rem;
  }

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

  .timeline-company {
    font-size: 0.85rem;
  }

  .timeline-description {
    font-size: 0.8rem;
    line-height: 1.5;
  }

  /* Contact Section */
  .contact-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .contact-info {
    order: 2;
  }

  .contact-form {
    order: 1;
  }

  .contact-item {
    padding: 1rem;
    text-align: center;
  }

  .form-group {
    margin-bottom: 1rem;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  input,
  textarea {
    padding: 0.75rem;
    font-size: 0.9rem;
  }

  textarea {
    min-height: 120px;
  }

  /* Footer */
  .footer-content {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }

  .footer-section {
    margin-bottom: 1.5rem;
  }

  .social-links {
    justify-content: center;
  }

  /* Utility Classes for Mobile */
  .mobile-hidden {
    display: none !important;
  }

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

  .mobile-full-width {
    width: 100% !important;
  }
}

/* ===============================================
   TABLET STYLES (768px - 1024px)
   =============================================== */

@media (min-width: 768px) and (max-width: 1024px) {
  .container {
    padding: 0 2rem;
  }

  /* Hero adjustments for tablet */
  .hero-content {
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 3rem;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .hero-image-container {
    width: 280px;
    height: 280px;
  }

  /* About section for tablet */
  .about-content {
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
  }

  .about-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Skills for tablet */
  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }

  /* Portfolio for tablet */
  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }

  /* Contact for tablet */
  .contact-content {
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
  }

  .form-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* ===============================================
   LARGE TABLET / SMALL DESKTOP (1024px - 1200px)
   =============================================== */

@media (min-width: 1024px) and (max-width: 1200px) {
  .hero-content {
    gap: 4rem;
  }

  .hero h1 {
    font-size: 3rem;
  }

  .skills-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .portfolio-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2.5rem;
  }

  .about-stats {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ===============================================
   DESKTOP STYLES (1200px - 1440px)
   =============================================== */

@media (min-width: 1200px) and (max-width: 1440px) {
  .container {
    max-width: 1200px;
  }

  .portfolio-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ===============================================
   LARGE DESKTOP STYLES (1440px+)
   =============================================== */

@media (min-width: 1440px) {
  .container {
    max-width: 1400px;
  }

  .hero h1 {
    font-size: 4rem;
  }

  .hero-image-container {
    width: 400px;
    height: 400px;
  }

  .portfolio-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
  }

  .about-stats {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ===============================================
   ULTRA-WIDE SCREENS (1920px+)
   =============================================== */

@media (min-width: 1920px) {
  .container {
    max-width: 1600px;
  }

  .portfolio-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .skills-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ===============================================
   PRINT STYLES
   =============================================== */

@media print {
  .navbar,
  .hamburger,
  .back-to-top,
  .floating-shape,
  .contact-form,
  .portfolio-filters {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
    font-size: 12pt;
    line-height: 1.4;
  }

  .hero,
  .section {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .portfolio-item,
  .timeline-item {
    page-break-inside: avoid;
    break-inside: avoid;
    margin-bottom: 1rem;
  }

  a {
    color: black !important;
    text-decoration: underline;
  }

  .btn {
    border: 1px solid black;
    background: white !important;
    color: black !important;
  }
}

/* ===============================================
   ACCESSIBILITY ENHANCEMENTS
   =============================================== */

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .floating-shape {
    animation: none !important;
  }

  .parallax-element {
    transform: none !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --text-light: #000000;
    --border-color: #000000;
    --bg-light: #ffffff;
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  }

  .btn-outline {
    border-width: 2px;
  }

  .portfolio-item {
    border: 2px solid var(--border-color);
  }
}

/* Dark mode preferences */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-white: #1a1a1a;
    --bg-light: #2a2a2a;
    --text-dark: #ffffff;
    --text-light: #cccccc;
    --border-color: #404040;
  }

  .navbar {
    background: rgba(26, 26, 26, 0.95);
  }

  .portfolio-item,
  .contact-item,
  .timeline-content {
    background: var(--bg-light);
    border-color: var(--border-color);
  }
}

/* ===============================================
   LANDSCAPE ORIENTATION ADJUSTMENTS
   =============================================== */

@media (max-width: 768px) and (orientation: landscape) {
  .hero {
    min-height: 70vh;
    padding: 2rem 0;
  }

  .hero-content {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .hero-image-container {
    width: 150px;
    height: 150px;
  }

  .section {
    padding: 3rem 0;
  }
}
