@media (max-width: 1024px) {
    .hero .container {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .hero-content h1 {
        font-size: 2.5rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .editor-container {
        grid-template-columns: 200px 1fr;
    }
    
    /* Dashboard improvements */
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }
    
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow);
        gap: 1rem;
        z-index: 999;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .hamburger {
        display: block;
    }
    
    .hero {
        padding: 6rem 0 2rem;
        min-height: auto;
    }
    
    .hero-content h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero-content p {
        font-size: 1.1rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }
    
    .btn-large {
        width: 100%;
        max-width: 300px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .steps {
        gap: 1rem;
    }
    
    .step {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .footer-links {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .dashboard-header h1 {
        font-size: 1.75rem;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1.5rem;
    }
    
    .dashboard-actions {
        grid-template-columns: 1fr;
    }
    
    .projects-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .search-box {
        width: 100%;
    }
    
    .sort-dropdown {
        width: 100%;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .project-card-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    
    .project-actions {
        width: 100%;
        justify-content: flex-start;
        gap: 0.5rem;
    }
    
    /* Editor mobile optimizations */
    .editor-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    
    .file-explorer {
        height: auto;
        max-height: 300px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        overflow-y: auto;
    }
    
    .file-explorer-header {
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
        padding: 1rem;
        border-bottom: 1px solid var(--border-color);
    }
    
    .file-explorer-header h3 {
        font-size: 1rem;
    }
    
    .btn-icon {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
    
    .file-tree {
        padding: 0.5rem;
    }
    
    .file-item {
        padding: 0.75rem;
        font-size: 0.95rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .file-name {
        flex: 1;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    
    .file-delete {
        min-width: 36px;
        min-height: 36px;
        padding: 0.5rem;
    }
    
    .editor-content {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
        gap: 0;
    }
    
    .code-editor {
        min-height: 300px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .preview-container {
        min-height: 300px;
    }
    
    /* FAQ mobile */
    .faq-container {
        padding: 0;
    }
    
    .faq-item {
        margin-bottom: 0.75rem;
    }
    
    .faq-question {
        font-size: 1rem;
        padding: 1rem;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }
    
    .faq-answer {
        padding: 1rem;
        font-size: 0.95rem;
    }
    
    .faq-toggle {
        min-width: 30px;
        min-height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .cta h2 {
        font-size: 2rem;
    }
    
    /* Modal improvements */
    .modal-content {
        width: 90%;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }
    
    .navbar {
        padding: 0.75rem;
    }
    
    .nav-brand {
        font-size: 1.25rem;
    }
    
    .nav-brand i {
        font-size: 1.5rem;
    }
    
    .hero {
        padding: 5rem 0 2rem;
    }
    
    .hero-content h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }
    
    .hero-content p {
        font-size: 1rem;
    }
    
    .hero-buttons {
        gap: 0.75rem;
    }
    
    .btn-large {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .feature-card {
        padding: 1.5rem;
    }
    
    .feature-card i {
        font-size: 2rem;
    }
    
    .feature-card h3 {
        font-size: 1.25rem;
    }
    
    .step {
        padding: 1.5rem;
    }
    
    .step-number {
        font-size: 1.5rem;
        width: 40px;
        height: 40px;
    }
    
    .step h3 {
        font-size: 1.25rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem auto;
        padding: 0;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-header h2 {
        font-size: 1.5rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .project-card {
        padding: 1.25rem;
    }
    
    .project-card-header h3 {
        font-size: 1.25rem;
    }
    
    .project-actions {
        flex-wrap: wrap;
    }
    
    .project-actions .btn {
        flex: 1;
        min-width: 80px;
    }
    
    .stat-card h3 {
        font-size: 2rem;
    }
    
    .dashboard-actions .quick-action {
        padding: 1rem;
    }
    
    /* Editor ultra-mobile */
    .editor-header {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem;
    }
    
    .editor-actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .editor-actions .btn {
        flex: 1;
        min-width: 120px;
    }
    
    .file-explorer {
        max-height: 300px;
        min-height: 200px;
    }
    
    .file-explorer-header {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .file-explorer-header h3 {
        font-size: 0.95rem;
    }
    
    .btn-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .file-tree {
        padding: 0.5rem;
    }
    
    .file-item {
        padding: 0.875rem 0.75rem;
        font-size: 0.9rem;
        min-height: 48px;
    }
    
    .file-name {
        font-size: 0.9rem;
    }
    
    .file-name i {
        font-size: 1rem;
    }
    
    .file-delete {
        min-width: 40px;
        min-height: 40px;
        padding: 0.5rem;
        font-size: 1.1rem;
        margin-left: auto;
    }
    
    .editor-toolbar {
        padding: 0.75rem;
        font-size: 0.9rem;
    }
    
    .code-editor textarea {
        font-size: 0.85rem;
        padding: 0.75rem;
    }
    
    /* Modal mobile improvements */
    .modal-content {
        width: 95%;
        max-width: 95vw;
        margin: 1rem auto;
    }
    
    .modal-small {
        max-width: 95vw;
    }
    
    .file-add-options {
        gap: 1rem;
    }
    
    .file-add-options .btn {
        padding: 1rem;
        font-size: 1rem;
        min-height: 56px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.75rem;
    }
    
    .file-add-options .btn i {
        font-size: 1.25rem;
    }
    
    .modal-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .modal-actions .btn {
        max-width: 100%;
        width: 100%;
    }
    
    /* Auth pages mobile */
    .auth-container {
        grid-template-columns: 1fr;
        min-height: 100vh;
    }
    
    .auth-left {
        display: none;
    }
    
    .auth-right {
        padding: 2rem 1.5rem;
    }
    
    .auth-form-container {
        padding: 2rem 1.5rem;
    }
    
    .auth-form h1 {
        font-size: 1.75rem;
    }
    
    .floating-card {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }
    
    /* Footer mobile */
    .footer-content {
        text-align: center;
    }
    
    .footer-brand {
        margin-bottom: 2rem;
    }
    
    .footer-column {
        text-align: center;
    }
    
    .footer-bottom {
        padding: 1rem;
    }
    
    /* FAQ mobile specific */
    .section-title {
        font-size: 1.75rem;
        margin-bottom: 1.5rem;
    }
    
    .cta {
        padding: 3rem 0;
    }
    
    .cta h2 {
        font-size: 1.5rem;
    }
    
    .cta p {
        font-size: 1rem;
        margin: 1rem 0;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn, .nav-link, .file-item, .project-card {
        -webkit-tap-highlight-color: rgba(102, 126, 234, 0.1);
    }
    
    .btn {
        min-height: 44px;
    }
    
    .file-item {
        min-height: 40px;
    }
    
    .nav-link {
        padding: 0.75rem;
    }
}

/* Landscape mobile optimization */
@media (max-width: 896px) and (orientation: landscape) {
    .hero {
        padding: 4rem 0 2rem;
        min-height: auto;
    }
    
    .editor-content {
        grid-template-rows: auto;
        grid-template-columns: 1fr 1fr;
    }
    
    .code-editor, .preview-container {
        min-height: 400px;
    }
    
    .file-explorer {
        max-height: 100%;
    }
}