/*
==================================================================
TSS WEBSITE - COMPREHENSIVE MOBILE RESPONSIVE CSS
Fixes all mobile issues without breaking desktop version
==================================================================
*/

/* ===== MOBILE NAVIGATION ===== */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
}

.mobile-menu-toggle span {
    display: block;
    width: 28px;
    height: 3px;
    background: var(--primary-color, #00f5a0);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translateY(10px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translateY(-10px);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 999;
    backdrop-filter: blur(10px);
}

.mobile-menu-overlay.active {
    display: block;
}

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Tablets and below (1024px and down) */
@media (max-width: 1024px) {
    .container {
        padding: 0 30px;
    }
    
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .about-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}

/* Tablets Portrait (768px and down) */
@media (max-width: 768px) {
    /* Hide desktop nav, show mobile toggle */
    .mobile-menu-toggle {
        display: flex;
    }
    
    .nav-menu-modern {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 400px;
        height: 100vh;
        background: rgba(10, 21, 32, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        align-items: flex-start;
        padding: 80px 30px 30px;
        gap: 0;
        z-index: 1000;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        border-left: 2px solid var(--primary-color, #00f5a0);
    }
    
    .nav-menu-modern.active {
        right: 0;
    }
    
    .nav-link-modern {
        width: 100%;
        padding: 18px 20px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        font-size: 18px;
    }
    
    .nav-link-modern:hover,
    .nav-link-modern.active {
        background: rgba(0, 245, 160, 0.1);
        padding-left: 30px;
    }
    
    .btn-contact-nav {
        margin-top: 20px;
        border-radius: 12px;
    }
    
    /* Old nav fallback */
    .nav-menu {
        display: none;
    }
    
    /* Topbar responsive */
    .topbar {
        font-size: 0.75rem;
        padding: 0.4rem 0;
    }
    
    .topbar-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .topbar-left,
    .topbar-right {
        justify-content: center;
    }
    
    .topbar-link {
        font-size: 0.7rem;
    }
    
    /* Typography scaling */
    .hero-content h1,
    .hero-title {
        font-size: 36px !important;
    }
    
    .hero-subtitle {
        font-size: 18px !important;
    }
    
    .page-header h1 {
        font-size: 36px !important;
    }
    
    .section-title {
        font-size: 2rem !important;
    }
    
    h2 {
        font-size: 28px !important;
    }
    
    h3 {
        font-size: 22px !important;
    }
    
    /* Hero Slider Mobile */
    .hero-slider {
        height: 70vh;
        min-height: 500px;
    }
    
    .slide-title {
        font-size: 32px !important;
    }
    
    .slide-subtitle {
        font-size: 18px !important;
    }
    
    .slide-description {
        font-size: 15px !important;
    }
    
    .slider-control {
        width: 45px;
        height: 45px;
    }
    
    .slider-control .material-icons {
        font-size: 24px;
    }
    
    .slider-prev {
        left: 10px;
    }
    
    .slider-next {
        right: 10px;
    }
    
    .slider-dots {
        bottom: 15px;
    }
    
    .slider-dot {
        width: 8px;
        height: 8px;
    }
    
    .slider-dot.active {
        width: 24px;
    }
    
    /* Grid Layouts */
    .features-grid,
    .services-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }
    
    .portfolio-card,
    .testimonial-card {
        max-width: 100%;
    }
    
    /* Reduce padding on mobile */
    section {
        padding: 4rem 0 !important;
    }
    
    .hero,
    .page-header {
        padding: 60px 20px !important;
    }
    
    .feature-card,
    .service-card,
    .testimonial-card {
        padding: 30px 20px !important;
    }
    
    /* Buttons */
    .btn,
    .btn-primary,
    .btn-secondary {
        padding: 14px 28px !important;
        font-size: 16px !important;
    }
    
    .btn-cta {
        padding: 16px 32px !important;
        font-size: 17px !important;
    }
    
    .btn-large {
        padding: 14px 28px !important;
        font-size: 16px !important;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 15px;
    }
    
    .hero-buttons .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Forms */
    .form-row {
        grid-template-columns: 1fr !important;
    }
    
    .contact-grid {
        grid-template-columns: 1fr !important;
    }
    
    .contact-form {
        padding: 30px 20px !important;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr !important;
        gap: 30px;
    }
    
    .footer-newsletter {
        padding: 30px 20px !important;
        margin: 30px 0 !important;
    }
    
    .newsletter-form {
        flex-direction: column !important;
    }
    
    .newsletter-form input,
    .newsletter-form button {
        width: 100% !important;
    }
    
    .footer-powered {
        text-align: center;
    }
    
    .powered-content {
        flex-direction: column;
        gap: 10px;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 10px;
    }
    
    /* Stats */
    .about-stats {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }
    
    .stat-item {
        padding: 20px !important;
    }
    
    /* CTA Section */
    .cta-section {
        padding: 4rem 0 !important;
    }
    
    .cta-content h2 {
        font-size: 2rem !important;
    }
    
    .cta-content p {
        font-size: 1rem !important;
    }
}

/* Mobile Phones (576px and down) */
@media (max-width: 576px) {
    .container {
        padding: 0 20px;
    }
    
    /* Navigation */
    .nav-menu-modern {
        width: 90%;
    }
    
    .navbar-wrapper {
        padding: 15px 0;
    }
    
    .brand-text {
        font-size: 18px;
    }
    
    /* Typography */
    .hero-content h1,
    .hero-title,
    .slide-title {
        font-size: 28px !important;
    }
    
    .hero-subtitle,
    .slide-subtitle {
        font-size: 16px !important;
    }
    
    .page-header h1 {
        font-size: 28px !important;
    }
    
    .section-title {
        font-size: 1.75rem !important;
    }
    
    h2 {
        font-size: 24px !important;
    }
    
    h3 {
        font-size: 20px !important;
    }
    
    p {
        font-size: 15px !important;
    }
    
    /* Hero Slider */
    .hero-slider {
        height: 60vh;
        min-height: 450px;
    }
    
    .slide-description {
        font-size: 14px !important;
    }
    
    .slider-control {
        width: 40px;
        height: 40px;
    }
    
    .slider-control .material-icons {
        font-size: 20px;
    }
    
    .slider-prev {
        left: 5px;
    }
    
    .slider-next {
        right: 5px;
    }
    
    /* Reduce spacing */
    section {
        padding: 3rem 0 !important;
    }
    
    .hero,
    .page-header {
        padding: 50px 15px !important;
    }
    
    .feature-card,
    .service-card,
    .testimonial-card {
        padding: 25px 15px !important;
    }
    
    /* Buttons */
    .btn,
    .btn-primary,
    .btn-secondary {
        padding: 12px 24px !important;
        font-size: 15px !important;
    }
    
    .btn-cta {
        padding: 14px 28px !important;
        font-size: 16px !important;
    }
    
    /* Icon sizes */
    .material-icons {
        font-size: 40px !important;
    }
    
    .service-icon,
    .feature-icon {
        width: 60px !important;
        height: 60px !important;
    }
    
    /* Portfolio */
    .portfolio-card {
        margin-bottom: 20px;
    }
    
    .portfolio-card h3 {
        font-size: 20px !important;
    }
    
    /* Modals */
    .project-modal {
        padding: 20px 15px !important;
    }
    
    .modal-content {
        padding: 30px 20px !important;
    }
    
    .modal-content h2 {
        font-size: 28px !important;
    }
    
    .modal-content h3 {
        font-size: 22px !important;
    }
    
    /* Footer */
    .footer {
        padding: 40px 0 20px !important;
    }
    
    .footer-newsletter {
        padding: 25px 15px !important;
    }
    
    .newsletter-info h3 {
        font-size: 1.5rem !important;
    }
    
    .newsletter-info p {
        font-size: 0.95rem !important;
    }
    
    .social-link {
        width: 40px !important;
        height: 40px !important;
        font-size: 16px !important;
    }
    
    /* CTA Trust Indicators */
    .cta-section [style*="display: flex"] {
        flex-direction: column !important;
        gap: 20px !important;
    }
    
    /* Stats */
    .stat-number,
    .stat-card h4 {
        font-size: 2rem !important;
    }
}

/* Small Phones (375px and down) */
@media (max-width: 375px) {
    .container {
        padding: 0 15px;
    }
    
    .hero-content h1,
    .hero-title,
    .slide-title {
        font-size: 24px !important;
    }
    
    .section-title {
        font-size: 1.5rem !important;
    }
    
    h2 {
        font-size: 22px !important;
    }
    
    .btn,
    .btn-primary,
    .btn-secondary,
    .btn-cta {
        padding: 12px 20px !important;
        font-size: 14px !important;
    }
    
    section {
        padding: 2.5rem 0 !important;
    }
    
    .feature-card,
    .service-card,
    .testimonial-card {
        padding: 20px 15px !important;
    }
}

/* ===== LANDSCAPE ORIENTATION FIXES ===== */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-slider {
        height: auto;
        min-height: 400px;
    }
    
    .slide-content {
        padding: 20px;
    }
    
    .slider-control {
        width: 35px;
        height: 35px;
    }
    
    .slider-dots {
        bottom: 10px;
    }
}

/* ===== TOUCH TARGET IMPROVEMENTS ===== */
@media (hover: none) and (pointer: coarse) {
    /* Ensure minimum 44x44 touch targets */
    .btn,
    .nav-link,
    .slider-control,
    .slider-dot,
    button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Increase tap areas */
    .nav-link-modern {
        padding: 20px;
    }
    
    .social-link {
        min-width: 48px;
        min-height: 48px;
    }
    
    /* Better spacing for fat fingers */
    .hero-buttons {
        gap: 20px;
    }
    
    /* Remove hover effects on touch */
    .feature-card:hover,
    .service-card:hover,
    .testimonial-card:hover {
        transform: none;
    }
    
    /* Active states for feedback */
    .btn:active {
        transform: scale(0.95);
    }
    
    .nav-link-modern:active {
        background: rgba(0, 245, 160, 0.15);
    }
}

/* ===== PORTFOLIO GRID MOBILE FIX ===== */
@media (max-width: 768px) {
    /* Override inline styles in portfolio */
    [style*="grid-template-columns: repeat(auto-fill, minmax(450px, 1fr))"] {
        grid-template-columns: 1fr !important;
    }
    
    [style*="grid-template-columns: repeat(auto-fill, minmax(400px, 1fr))"] {
        grid-template-columns: 1fr !important;
    }
    
    [style*="grid-template-columns: repeat(auto-fit, minmax(320px, 1fr))"] {
        grid-template-columns: 1fr !important;
    }
    
    [style*="grid-template-columns: repeat(auto-fit, minmax(300px, 1fr))"] {
        grid-template-columns: 1fr !important;
    }
    
    [style*="grid-template-columns: repeat(auto-fit, minmax(280px, 1fr))"] {
        grid-template-columns: 1fr !important;
    }
    
    [style*="grid-template-columns: repeat(auto-fit, minmax(250px, 1fr))"] {
        grid-template-columns: 1fr !important;
    }
    
    [style*="grid-template-columns: repeat(auto-fit, minmax(200px, 1fr))"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ===== INLINE STYLE OVERRIDES ===== */
@media (max-width: 768px) {
    /* Override large inline font sizes */
    [style*="font-size: 56px"],
    [style*="font-size: 48px"],
    [style*="font-size: 4.5rem"],
    [style*="font-size: 3rem"] {
        font-size: 28px !important;
    }
    
    [style*="font-size: 42px"],
    [style*="font-size: 36px"],
    [style*="font-size: 2.5rem"] {
        font-size: 24px !important;
    }
    
    [style*="font-size: 24px"],
    [style*="font-size: 1.5rem"] {
        font-size: 18px !important;
    }
    
    /* Override large padding */
    [style*="padding: 50px"],
    [style*="padding: 40px"] {
        padding: 25px 15px !important;
    }
    
    [style*="padding: 80px 20px"],
    [style*="padding: 100px 20px"] {
        padding: 50px 15px !important;
    }
    
    /* Override large margins */
    [style*="margin-bottom: 60px"],
    [style*="margin-bottom: 4rem"] {
        margin-bottom: 30px !important;
    }
    
    /* Fix icon sizes */
    [style*="width: 100px; height: 100px"],
    [style*="width: 80px; height: 80px"] {
        width: 60px !important;
        height: 60px !important;
    }
    
    [style*="font-size: 80px"] {
        font-size: 50px !important;
    }
    
    [style*="font-size: 4rem"] {
        font-size: 2.5rem !important;
    }
}

@media (max-width: 576px) {
    [style*="font-size: 56px"],
    [style*="font-size: 48px"],
    [style*="font-size: 4.5rem"],
    [style*="font-size: 3rem"] {
        font-size: 24px !important;
    }
    
    [style*="padding: 3rem"],
    [style*="padding: 2.5rem"] {
        padding: 1.5rem 1rem !important;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
/* Focus states */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 3px solid var(--primary-color, #00f5a0);
    outline-offset: 2px;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -50px;
    left: 0;
    background: var(--primary-color, #00f5a0);
    color: var(--dark, #0a0a0a);
    padding: 10px 20px;
    z-index: 10000;
    transition: top 0.3s;
}

.skip-to-content:focus {
    top: 0;
}

/* ===== PRINT STYLES ===== */
@media print {
    .navbar,
    .topbar,
    .footer,
    .slider-control,
    .slider-dots,
    .mobile-menu-toggle,
    .cta-section {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    a {
        text-decoration: underline;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== END OF MOBILE RESPONSIVE CSS ===== */
