/* Enhanced Mobile-First Responsive Design with Accessibility */

/* Sidebar overlay for mobile */
.sidebar-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.45);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}
.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Collapsible sidebar on mobile */
@media (max-width: 767px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: #fff;
    z-index: 999;
    overflow-y: auto;
    transition: left .3s ease;
    box-shadow: 2px 0 8px rgba(0,0,0,.15);
  }
  .sidebar.open {
    left: 0;
  }
  .mobile-nav-toggle {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1000;
    background: var(--primary-600, #2563eb);
    color: #fff;
    border: none;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
  }
  .mobile-nav-toggle[aria-expanded="true"] i::before {
    content: "\f00d"; /* fa-times */
  }
  .main-content {
    padding-top: 60px; /* space for toggle button */
  }
}

/* Mobile-First Base Styles */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

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

body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Improved touch targets for mobile */
@media (max-width: 768px) {
    button, 
    a, 
    input, 
    select, 
    textarea {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Better font scaling for different screen sizes */
@media (max-width: 320px) {
    html {
        font-size: 14px;
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    html {
        font-size: 17px;
    }
}

@media (min-width: 1440px) {
    html {
        font-size: 18px;
    }
}

/* Enhanced Mobile First - Base (320px and up) */
.container {
    flex-direction: column;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    max-width: 100%;
    min-height: 100vh;
    background: var(--neutral-50);
}

/* Accessibility Improvements */
/* High contrast mode support */
@media (prefers-contrast: high) {
    .container {
        border: 2px solid var(--neutral-900);
    }
    
    .content-section {
        border: 1px solid var(--neutral-900);
    }
    
    .certificate-item,
    .competencies-grid div {
        border: 2px solid var(--neutral-900);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .sidebar {
        transform: none !important;
        transition: none !important;
    }
}

/* Focus management for keyboard navigation */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-500);
    color: white;
    padding: var(--space-2) var(--space-4);
    text-decoration: none;
    border-radius: var(--radius-md);
    z-index: 1000;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 10px;
}

/* Enhanced focus states */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px var(--primary-200);
}

/* Better color contrast for text */
.experience-item h3,
.education-item h3,
.achievement h3 {
    color: var(--neutral-900);
    font-weight: 700;
}

.experience-item .date,
.education-item .date {
    color: var(--neutral-700);
    font-weight: 600;
}

/* Improved link visibility */
a {
    color: var(--primary-600);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

a:hover {
    color: var(--primary-700);
    text-decoration-thickness: 3px;
}

/* Better form accessibility */
input,
textarea,
select {
    background: var(--bg-primary);
    border: 2px solid var(--neutral-300);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    font-size: var(--font-size-base);
    transition: border-color 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary-500);
    background: var(--bg-primary);
}

/* Error and success states */
.error-message {
    color: var(--error-600);
    background: var(--error-50);
    border: 1px solid var(--error-200);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    margin-top: var(--space-2);
    font-weight: 600;
}

.success-message {
    color: var(--success-600);
    background: var(--success-50);
    border: 1px solid var(--success-200);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    margin-top: var(--space-2);
    font-weight: 600;
}

/* Improved mobile navigation */
.mobile-nav-toggle {
    display: block;
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    background: var(--primary-500);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: var(--space-3);
    font-size: var(--font-size-lg);
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition-normal);
}

.mobile-nav-toggle:hover {
    background: var(--primary-600);
    transform: scale(1.05);
}

.mobile-nav-toggle:focus {
    outline: 2px solid var(--primary-300);
    outline-offset: 2px;
}

/* Improved sidebar for mobile */
.sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--neutral-200);
    padding: var(--space-6);
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--neutral-50) 100%);
    position: relative;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.sidebar.active {
    transform: translateX(0);
}

/* Enhanced profile section for mobile */
.profile-section {
    margin-bottom: var(--space-8);
    padding: var(--space-6);
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.profile-img {
    width: 120px;
    height: 150px;
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
}

/* Improved typography for mobile */
h1 {
    font-size: var(--font-size-3xl);
    line-height: var(--line-height-tight);
    margin-bottom: var(--space-4);
}

h2 {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-4);
}

/* Enhanced content sections */
.content-section {
    margin-bottom: var(--space-8);
    padding: var(--space-6);
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.content-section h2 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-4);
    color: var(--neutral-800);
    border-bottom: 2px solid var(--primary-500);
    padding-bottom: var(--space-2);
}

/* Improved grid layouts for mobile */
.competencies-grid,
.certifications-grid,
.ghl-samples,
.references {
    grid-template-columns: 1fr;
    gap: var(--space-4);
    margin-top: var(--space-4);
}

.competencies-grid div,
.certificate-item,
.ghl-sample,
.reference {
    padding: var(--space-4);
    background: var(--neutral-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--neutral-200);
    transition: var(--transition-normal);
}

/* Enhanced experience and education items */
.experience-item,
.education-item,
.achievement {
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border-left: 4px solid var(--primary-500);
}

.sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.profile-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
}

.profile-img {
    width: 140px;
    height: 175px;
}

h1 {
    font-size: 1.75rem;
}

.title {
    font-size: 1rem;
}

.main-content {
    padding: 1.5rem;
    max-height: none;
}

.content-section {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
}

.content-section h2 {
    font-size: 1.5rem;
}

.competencies-grid,
.certifications-grid,
.ghl-samples,
.references {
    grid-template-columns: 1fr;
    gap: 1rem;
}

.competencies-grid div,
.certificate-item,
.ghl-sample,
.reference {
    padding: 1rem;
}

.experience-item,
.education-item,
.achievement {
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

/* Touch-friendly interactions */
.contact-info p,
.content-section ul li,
.competencies-grid div,
.certificate-item,
.ghl-sample,
.reference,
.experience-item,
.education-item {
    cursor: pointer;
}

.contact-info p:active,
.content-section ul li:active,
.competencies-grid div:active,
.certificate-item:active,
.ghl-sample:active,
.reference:active,
.experience-item:active,
.education-item:active {
    transform: scale(0.98);
}

/* Enhanced Tablet (768px and up) */
@media (min-width: 768px) {
    .container {
        flex-direction: row;
        margin: var(--space-8);
        border-radius: var(--radius-xl);
        box-shadow: var(--shadow-xl);
        max-width: 1200px;
        min-height: auto;
        background: var(--bg-primary);
    }
    
    .mobile-nav-toggle {
        display: none;
    }
    
    .sidebar {
        width: 350px;
        border-right: 1px solid var(--neutral-200);
        border-bottom: none;
        transform: none !important;
        padding: var(--space-8);
        background: linear-gradient(135deg, var(--bg-primary) 0%, var(--neutral-50) 100%);
    }
    
    .profile-section {
        padding: var(--space-8);
        margin-bottom: var(--space-10);
        background: var(--bg-primary);
        border-radius: var(--radius-2xl);
        box-shadow: var(--shadow-lg);
    }
    
    .profile-img {
        width: 160px;
        height: 200px;
        border-radius: var(--radius-xl);
        margin-bottom: var(--space-6);
    }
    
    .main-content {
        padding: 2rem;
        max-height: calc(100vh - 2rem);
    }
    
    .content-section {
        padding: var(--space-8);
        margin-bottom: var(--space-10);
        background: var(--bg-primary);
        border-radius: var(--radius-xl);
        box-shadow: var(--shadow-md);
    }
    
    .content-section h2 {
        font-size: var(--font-size-2xl);
        margin-bottom: var(--space-6);
        padding-bottom: var(--space-3);
        border-bottom: 3px solid var(--primary-500);
    }
    
    .competencies-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-6);
        margin-top: var(--space-6);
    }
    
    .certifications-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-6);
        margin-top: var(--space-6);
    }
    
    .ghl-samples {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-6);
        margin-top: var(--space-6);
    }
    
    .references {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-6);
        margin-top: var(--space-6);
    }
    
    .experience-item,
    .education-item,
    .achievement {
        padding: var(--space-8);
        margin-bottom: var(--space-8);
        border-radius: var(--radius-xl);
        border-left: 6px solid var(--primary-500);
    }
}

/* GTM Integration Page Responsive Styles */
.screenshot-gallery {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .screenshot-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

.screenshot-item {
    background-color: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--shadow-md);
}

.screenshot-image {
    width: 100%;
    height: auto;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1rem;
}

.screenshot-caption {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.screenshot-caption strong {
    color: var(--text-primary);
}

/* Enhanced Desktop (1024px and up) */
@media (min-width: 1024px) {
    .container {
        margin: var(--space-12);
        max-width: 1400px;
        background: var(--bg-primary);
    }
    
    .sidebar {
        width: 400px;
        padding: var(--space-10);
        background: linear-gradient(135deg, var(--bg-primary) 0%, var(--neutral-50) 100%);
    }
    
    .main-content {
        padding: var(--space-10);
    }
    
    .profile-section {
        padding: var(--space-10);
        margin-bottom: var(--space-12);
        background: var(--bg-primary);
        border-radius: var(--radius-2xl);
        box-shadow: var(--shadow-xl);
    }
    
    .profile-img {
        width: 180px;
        height: 225px;
        border-radius: var(--radius-2xl);
        margin-bottom: var(--space-8);
    }
    
    .content-section {
        padding: var(--space-10);
        margin-bottom: var(--space-12);
        background: var(--bg-primary);
        border-radius: var(--radius-2xl);
        box-shadow: var(--shadow-lg);
    }
    
    .content-section h2 {
        font-size: var(--font-size-3xl);
        margin-bottom: var(--space-8);
        padding-bottom: var(--space-4);
        border-bottom: 4px solid var(--primary-500);
    }
    
    .competencies-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-8);
        margin-top: var(--space-8);
    }
    
    .certifications-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-8);
        margin-top: var(--space-8);
    }
    
    .ghl-samples {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-8);
        margin-top: var(--space-8);
    }
    
    .references {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-8);
        margin-top: var(--space-8);
    }
    
    .experience-item,
    .education-item,
    .achievement {
        padding: var(--space-10);
        margin-bottom: var(--space-10);
        border-radius: var(--radius-2xl);
        border-left: 8px solid var(--primary-500);
    }
    
    /* Enhanced hover effects for desktop */
    .competencies-grid div:hover,
    .certificate-item:hover,
    .ghl-sample:hover,
    .reference:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-xl);
        transition: all 0.3s ease;
    }
    
    .experience-item:hover,
    .education-item:hover,
    .achievement:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-xl);
        transition: all 0.3s ease;
    }
}

/* Large Desktop Styles (1200px and up) */
@media (min-width: 1200px) {
    .certifications-grid,
    .ghl-samples {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Small Mobile Optimizations (max-width: 480px) */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    .sidebar,
    .main-content {
        padding: 1rem;
    }
    
    .profile-section {
        padding: 1rem;
    }
    
    .profile-img {
        width: 120px;
        height: 150px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .title {
        font-size: 0.9rem;
    }
    
    .competencies-grid,
    .certifications-grid,
    .ghl-samples,
    .references {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .contact-info p {
        font-size: 0.9rem;
        word-break: break-word;
    }
    
    .content-section h2 {
        font-size: 1.25rem;
    }
    
    .experience-item h3 {
        font-size: 1.1rem;
    }
}

/* Ultra-small mobile (max-width: 360px) */
@media (max-width: 360px) {
    .sidebar,
    .main-content {
        padding: 0.75rem;
    }
    
    .profile-section {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }
    
    .profile-img {
        width: 100px;
        height: 125px;
    }
    
    .content-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }
}

/* Ensure single column layout for all mobile devices */
@media (max-width: 767px) {
    .container {
        flex-direction: column !important;
        margin: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        max-width: 100% !important;
        min-height: 100vh !important;
    }
    
    .sidebar {
        width: 100% !important;
        order: 2;
    }
    
    .main-content {
        order: 1;
    }
    
    /* Ensure all grid layouts become single column */
    .competencies-grid,
    .certifications-grid,
    .ghl-samples,
    .references {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: none !important;
    }
    
    /* Ensure text doesn't overflow */
    .contact-info p,
    .content-section p,
    .experience-item p,
    .experience-item ul li {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    /* Better button/touch targets */
    .competency-item,
    .certificate-item,
    .ghl-sample,
    .reference {
        min-height: 44px;
        padding: 0.75rem;
    }
    
    /* Reduce font sizes slightly for better mobile fit */
    .content-section h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .experience-item h3 {
        font-size: 1.1rem;
        line-height: 1.3;
    }
    
    /* Ensure images are responsive */
    .certificate-image,
    .ghl-sample img {
        max-width: 100%;
        height: auto;
    }
}
/* Remove orphaned closing brace as it's not associated with any rule */
    
    .profile-img {
        width: 120px;
        height: 150px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .content-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .content-section h2 {
        font-size: 1.3rem;
    }
    
    .experience-item h3,
    .education-item h3 {
        font-size: 1.2rem;
    }
/* Remove orphaned closing brace as it's not needed */

/* Landscape Mobile Optimizations */
@media (max-width: 768px) and (orientation: landscape) {
    .container {
        max-height: none;
    }
    
    .sidebar {
        padding: 1rem;
    }
    
    .profile-section {
        display: flex;
        align-items: center;
        gap: 1rem;
        text-align: left;
        padding: 1rem;
    }
    
    .profile-img {
        width: 100px;
        height: 125px;
        margin-bottom: 0;
    }
    
    .contact-info {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .contact-info p {
        font-size: 0.8rem;
    }
}

/* Smooth scrolling for iOS */
@supports (-webkit-overflow-scrolling: touch) {
    .main-content {
        -webkit-overflow-scrolling: touch;
    }
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
    .content-section {
        border: 2px solid var(--text-primary);
    }
    
    .competencies-grid div,
    .certificate-item,
    .ghl-sample,
    .reference {
        border: 2px solid var(--text-primary);
    }
}

/* Services Package Responsive */
.service-categories {
    grid-template-columns: 1fr;
    gap: 15px;
}

.service-item {
    padding: 25px 20px;
}

.service-item i {
    font-size: 36px;
}

.service-item h3 {
    font-size: 18px;
}

.service-item p {
    font-size: 14px;
}

.btn-primary {
    padding: 10px 20px;
    font-size: 14px;
}

/* Services Package Tablet */
@media (min-width: 768px) {
    .service-categories {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .service-item {
        padding: 30px 25px;
    }
    
    .service-item i {
        font-size: 42px;
    }
}

/* Services Package Desktop */
@media (min-width: 1024px) {
    .service-categories {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
    
    .service-item {
        padding: 35px 30px;
    }
    
    .service-item i {
        font-size: 48px;
    }
}

/* Large desktop */
@media (min-width: 1200px) {
    .service-categories {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Print styles */
@media print {
    .container {
        flex-direction: column;
        margin: 0;
        box-shadow: none;
        border-radius: 0;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #000;
    }
    
    .content-section {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .service-item,
    .certificate-item {
        break-inside: avoid;
    }
}