/* Responsive Design - Media Queries */

/* Промежуточные экраны - выравнивание слева, пока не поместятся в строку */
@media (max-width: 768px) {
    .schedule-legend {
        justify-content: flex-start;
    }
}

/* Когда все элементы помещаются в строку - центрируем */
@media (min-width: 769px) {
    .schedule-legend {
        justify-content: center;
    } 
}

@media (max-width: 768px) {
    .schedule-actions {
        margin-top: 2.5rem;
        gap: 1.75rem;
    }
    .schedule-hint {
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .class-option {
        min-width: 28px;
        height: 28px;
        font-size: 0.85rem;
        border-width: 1.5px;
    }
}

/* Tablets and below */
@media (max-width: 768px) {
    /* Navigation - Reduced height */
    .navbar {
        padding: 0.5rem 0;
    }

    .navbar-brand h2 {
        font-size: 1.3rem;
    }

    .brand-logo {
        min-width: 44px;
        height: 44px;
        font-size: 0.95rem;
    }

    .navbar-brand .brand-name {
        font-size: 0.82rem;
    }

    .navbar-toggle {
        transform: scale(1);
        margin-right: 10px;
    }

    .navbar-toggle span {
        width: 28px;
        height: 3px;
    }

    .navbar-menu {
        position: fixed;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(44, 62, 80, 0.98);
        flex-direction: column;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        display: flex;
        border-bottom: none;
    }

    .navbar-menu.active {
        max-height: 400px;
    }

    .navbar-menu li {
        width: 100%;
        text-align: left;
        padding: 0.4rem 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .navbar-menu li:last-child {
        border-bottom: none;
    }

    .navbar-menu a {
        display: block;
        padding: 0.3rem 1rem;
        font-size: 0.95rem;
        color: white;
        transition: color 0.3s ease;
    }
    
    .navbar-menu a:hover {
        color: #e74c3c;
    }
    
    .navbar-menu a::after {
        display: none;
    }

    .navbar-toggle {
        display: flex;
    }

    /* Hero Section */
    .hero {
        min-height: 100vh;
        padding: 70px 0 40px;
    }

    .hero-background {
        background-position: center 20% !important;
    }

    .hero-content {
        padding: 20px 0;
    }

    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 0.6rem;
    }

    .hero-intro {
        font-size: 0.82em;
        margin-bottom: 0.2rem;
    }

    .hero-subtitle {
        font-size: 1.05rem;
        margin-top: 0.1rem;
        margin-bottom: 1.5rem;
        line-height: 1.3;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
        margin-top: 1rem;
        margin-bottom: 1.5rem;
    }

    .hero-buttons .btn {
        width: 100%;
        padding: 12px 18px;
        font-size: 14px;
        text-align: center;
    }

    .hero-stats {
        flex-direction: row;
        justify-content: space-around;
        gap: 1rem;
        margin-top: 2.5rem;
    }

    .stat-item {
        padding: 1rem 0.5rem;
    }

    .stat-number {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .stat-label {
        font-size: 0.9rem;
        line-height: 1.4;
    }

    /* About Section */
    .about {
        padding: 4rem 0;
    }

    .about-content {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .about-image img {
        height: 400px;
    }

    .about-info h3 {
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    .about-position {
        margin-bottom: 1.5rem;
    }

    .about-description {
        font-size: 0.95rem;
        line-height: 1.7;
        padding: 1rem;
        border: 2px solid #f39c12;
        border-radius: 10px;
        background: rgba(243, 156, 18, 0.05);
        margin-bottom: 2rem;
    }

    .achievement-item {
        padding: 1rem;
        /* margin-bottom: 1rem; */
    }

    .achievement-item h4 {
        margin-bottom: 0.5rem;
    }

    .achievement-item p {
        line-height: 1.6;
    }

    .achievement-item i {
        font-size: 1.5rem;
    }

    /* Services Section */
    .services {
        padding: 4rem 0;
    }

    .section-header {
        margin-bottom: 3rem;
    }

    .section-title {
        font-size: 1.8rem;
        margin-bottom: 0.5rem;
    }

    .section-subtitle {
        font-size: 1rem;
        margin-bottom: 2rem;
    }

    .services-grid,
    .services-grid-centered,
    .services-grid-four {
        grid-template-columns: 1fr;
        gap: 2rem;
        margin-top: 0.75rem;
    }

    .service-card {
        padding: 1.5rem;
        margin-bottom: 2rem;
    }

    .service-icon {
        width: 60px;
        height: 60px;
        margin-bottom: 1rem;
    }

    .service-icon i {
        font-size: 1.5rem;
    }

    .service-card h3 {
        font-size: 1.3rem;
        margin-bottom: 1.2rem;
    }

    .service-card p {
        margin-bottom: 1.5rem;
        line-height: 1.8;
    }

    .service-features {
        margin-bottom: 2rem;
    }

    /* Services Note */
    .services-note {
        margin-top: 30px;
        padding: 15px;
        border-radius: 10px;
    }

    .services-note p {
        font-size: 0.95rem;
        flex-direction: row;
        align-items: flex-start;
        text-align: center;
        gap: 8px;
    }

    .services-note i {
        font-size: 1.1rem;
        margin-top: 2px;
    }

    .service-features li {
        margin-bottom: 1rem;
    }

    /* Bot Section */
    .bot-section {
        padding: 4rem 0;
    }

    .bot-features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-bottom: 2rem;
    }

    .bot-feature {
        padding: 1.5rem;
    }

    .bot-feature-icon {
        width: 58px;
        height: 58px;
        font-size: 1.7rem;
        border-radius: 14px;
    }

    .bot-feature h3 {
        font-size: 1.2rem;
    }

    .bot-intro {
        font-size: 1rem;
        margin-bottom: 2rem;
    }

    .bot-stats {
        flex-direction: row;
        gap: 2rem;
        padding: 1.5rem 0;
    }

    .bot-stat {
        flex: 1;
        min-width: 80px;
    }

    .bot-stat-value {
        font-size: 1.5rem;
    }

    .bot-stat-label {
        font-size: 0.75rem;
    }

    .bot-cta {
        margin: 2rem 0 0 0;
    }

    .btn-large {
        font-size: 1rem;
        padding: 0.9rem 1.8rem;
        width: 100%;
    }

    .service-price {
        margin-bottom: 1.5rem;
    }

    .price {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    /* Schedule Section */
    .schedule {
        padding: 4rem 0;
    }

    /* Show short day names on mobile */
    .day-full {
        display: none;
    }

    .day-short {
        display: inline;
    }

    .schedule-header,
    .schedule-row {
        grid-template-columns: 35px repeat(5, minmax(62px, 1fr));
        font-size: 0.7rem;
    }

    .schedule-header > div {
        padding: 0.5rem 0.3rem;
        font-size: 0.75rem;
    }

    .time-cell {
        padding: 1rem 0.15rem;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 80px;
    }

    .time-period {
        font-size: 0.7rem;
        font-weight: 600;
        writing-mode: vertical-rl;
        text-orientation: upright;
        letter-spacing: -1px;
        line-height: 1;
    }

    .class-cell {
        padding: 0.3rem;
    }

    .class-options {
        gap: 3px;
        grid-template-columns: 1fr 1fr;
    }

    .class-option {
        min-width: 28px;
        height: 24px;
        font-size: 0.65rem;
        border-radius: 4px;
    }

    .schedule-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 0.85rem;
    }

    .schedule-table th,
    .schedule-table td {
        padding: 0.5rem 0.3rem;
        min-width: 50px;
    }

    .class-option {
        min-width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }

    .schedule-legend {
        font-size: 0.75rem;
        gap: 0.4rem;
        flex-direction: column;
        align-items: stretch;
        max-width: none;
        margin: 0;
        flex: 1;
    }

    .legend-item {
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        text-align: left;
        gap: 8px;
    }
    
    .legend-color {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
    }
    
    .legend-item span {
        font-size: 0.8rem;
        line-height: 1.2;
    }
    
    /* Combine legend and button in one row on mobile */
    .schedule-actions {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        margin-top: 2.5rem;
    }
    
    .schedule-actions .btn {
        flex-shrink: 0;
        padding: 0.75rem 1rem;
        font-size: 1rem;
        white-space: nowrap;
    }

    /* Testimonials Section */
    .testimonials {
        padding: 4rem 0;
    }

    .testimonial-card {
        padding: 2rem 1.5rem;
        margin-bottom: 2rem;
    }

    .testimonial-text {
        font-size: 1rem;
        line-height: 1.6;
        margin-bottom: 1.5rem;
    }

    .author-name {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .author-position {
        margin-bottom: 1rem;
    }

    .testimonial-rating {
        margin-top: 1rem;
    }

    .testimonial-prev,
    .testimonial-next {
        width: 40px;
        height: 40px;
    }

    .testimonials-controls {
        gap: 1rem;
    }

    /* Contact Section */
    .contact {
        padding: 4rem 0;
    }

    .contact-info h3 {
        display: none;
    }

    .contact-content {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .contact-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-bottom: 1.5rem;
    }

    .contact-item i {
        margin-top: 0;
    }

    .contact-item h4 {
        margin-bottom: 0.75rem;
        margin-top: 0.5rem;
    }

    .contact-item p {
        line-height: 1.7;
    }

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

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

    .contact-form {
        padding: 1.5rem;
    }

    .contact-form h3 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }

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

    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 0.9rem;
        font-size: 16px; /* Prevent zoom on iOS */
        margin-top: 0.5rem;
    }

    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
    }

    .btn-primary[type="submit"] {
        width: 100%;
        padding: 14px;
        font-size: 1rem;
        margin-top: 1rem;
    }

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

    .contact-item i {
        margin-top: 0;
        margin-bottom: 0.5rem;
    }

    /* Footer */
    .footer {
        padding: 3rem 0 1.5rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        text-align: center;
    }

    .footer-links {
        display: none;
    }

    .footer-info h3 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .footer-info p {
        margin-bottom: 1.5rem;
        line-height: 1.7;
    }

    .footer-social {
        justify-content: center;
        margin-top: 1.5rem;
    }

    .social-icon {
        width: 45px;
        height: 45px;
    }

    /* General */
    .section-title {
        font-size: 2rem;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .hero-intro {
        font-size: 0.8em;
        margin-bottom: 0.15rem;
    }

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

    .hero-buttons {
        gap: 0.5rem;
        margin-top: 0.75rem;
    }

    .hero-buttons .btn {
        padding: 10px 16px;
        font-size: 13px;
    }

    .service-card {
        padding: 1.5rem;
    }

    .contact-form {
        padding: 1.5rem;
    }

    .schedule-header,
    .schedule-row {
        font-size: 0.7rem;
        grid-template-columns: 35px repeat(5, minmax(62px, 1fr));
    }

    .class-cell {
        padding: 0.5rem 0.2rem;
    }
    
    .time-cell {
        padding: 1rem 0.15rem;
        min-height: 80px;
    }
    
    .time-period {
        font-size: 0.7rem;
    }
    
    .schedule-actions {
        flex-direction: column;
        gap: 1.75rem;
    }
    
    .schedule-legend {
        width: 100%;
    }
    
    .schedule-actions .btn {
        width: 100%;
    }

    /* Services Note - Mobile */
    .services-note {
        margin-top: 25px;
        padding: 12px;
        border-radius: 8px;
    }

    .services-note p {
        font-size: 0.85rem;
        line-height: 1.45;
        gap: 6px;
    }

    .services-note i {
        font-size: 1rem;
    }

    .back-to-top {
        width: 44px;
        height: 44px;
        right: 16px;
        bottom: calc(16px + env(safe-area-inset-bottom));
    }
}

/* iPhone 11 specific (414px width) */
@media (max-width: 414px) {
    .container {
        padding: 0 16px;
    }

    /* Navigation - Extra compact for iPhone 11 */
    .navbar {
        padding: 0.4rem 0;
    }

    .navbar-brand h2 {
        font-size: 1.2rem;
    }

    .brand-logo {
        min-width: 40px;
        height: 40px;
        font-size: 0.85rem;
    }

    .navbar-brand .brand-name {
        font-size: 0.74rem;
    }

    .navbar-menu {
        top: 100%;
    }

    /* Hero Section */
    .hero {
        padding-top: 65px;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .section-subtitle {
        font-size: 1rem;
    }

    /* Prevent text zoom on input focus */
    input[type="text"],
    input[type="tel"],
    input[type="email"],
    textarea,
    select {
        font-size: 16px !important;
    }

    /* Notification positioning */
    .notification {
        right: 10px;
        left: 10px;
        max-width: calc(100% - 20px);
    }
}

/* Extra small devices */
@media (max-width: 375px) {
    .navbar {
        padding: 0.4rem 0;
    }

    .navbar-brand h2 {
        font-size: 1.1rem;
    }

    .brand-logo {
        min-width: 38px;
        height: 38px;
        font-size: 0.8rem;
    }

    .navbar-brand .brand-name {
        font-size: 0.7rem;
    }

    .navbar-menu {
        top: 100%;
    }

    .hero {
        padding-top: 60px;
    }
    
    .hero-title {
        font-size: 1.8rem;
    }
}

/* Landscape mode for mobile */
@media (max-width: 896px) and (orientation: landscape) {
    .navbar {
        padding: 0.3rem 0;
    }

    .navbar-menu {
        top: 100%;
    }

    .hero {
        min-height: auto;
        padding: 80px 0 60px;
    }

    .hero-stats {
        margin-top: 2rem;
    }
    
    .hero-content {
        max-width: 500px;
    }
}

/* Touch improvements */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .class-option,
    .social-icon,
    .navbar-menu a {
        min-height: 44px; /* Apple's recommended touch target */
    }

    .class-option {
        padding: 8px;
    }

    /* Remove ALL hover effects on touch devices to prevent scroll conflicts */
    .service-card:hover,
    .achievement-item:hover,
    .bot-feature:hover,
    .class-option:hover {
        transform: none;
        box-shadow: inherit;
        border-color: inherit;
        background: inherit;
    }

    /* Non-clickable card bodies: disable touch highlight/active flash */
    .service-card,
    .achievement-item,
    .bot-feature {
        -webkit-tap-highlight-color: transparent;
        touch-action: pan-y;
    }

    .service-card:active,
    .achievement-item:active,
    .bot-feature:active {
        transform: none;
        box-shadow: inherit;
        border-color: inherit;
        background: inherit;
    }
    
    /* Ensure touch scrolling is smooth */
    * {
        -webkit-tap-highlight-color: transparent;
    }
    
    body {
        -webkit-overflow-scrolling: touch;
    }
}

/* Desktop alignment - shift hero content left */
@media (min-width: 1024px) {
    .hero .container {
        max-width: 1200px;
        padding-left: 24px;
    }
    
    .hero-content {
        margin-left: 0;
        max-width: 680px;
    }
    
    .hero-buttons {
        justify-content: flex-start;
    }
    
    .hero-stats {
        justify-content: flex-start;
    }

    /* Bot stats - увеличены для десктопа */
    .bot-stat-value {
        font-size: 2.5rem;
    }

    .bot-stat-label {
        font-size: 1rem;
    }
}
