/* Mobile styles */
@media screen and (max-width: 768px) {
    /* General layout adjustments */
    body {
        font-size: 14px;
    }

    .top-nav {
        padding: 0.5rem;
    }

    /* Navigation */
    .nav-content {
        padding: 0.5rem;
    }

    .logo {
        font-size: 1rem;
    }

    /* Hero section */
    .hero-section {
        padding: 2rem 1rem;
    }

    h1 {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }

    .auth-buttons {
        width: 100%;
        max-width: 100%;
    }

    /* Projects grid */
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0.5rem;
    }

    #projects-container {
        padding: 0 1rem;
    }

    .project-card {
        padding: 1rem;
    }

    .project-meta {
        font-size: 0.8rem;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .project-meta .authors-count {
        font-size: 0.8rem;
        margin-left: 0;
    }

    /* Editor layout */
    .editor-header {
        display: grid;
        grid-template-areas: 
            'back spacer actions toggle collaborators compile'
            'title title title title title title';
        grid-template-columns: auto 1fr auto auto auto auto;
        padding: 0.5rem;
        gap: 0.5rem;
    }

    .title-container {
        grid-area: title;
        width: 100%;
    }

    .back-to-projects {
        grid-area: back;
    }

    /* Empty spacer to push remaining items to the right */
    .editor-actions {
        grid-area: actions;
    }

    .toggle-edit {
        grid-area: toggle;
    }

    .manage-collaborators {
        grid-area: collaborators;
    }

    .compile-button {
        grid-area: compile;
    }

    .mobile {
        display: none;
    }

    .loading {
        text-align: center;
        width: 100%;
    }

    .editor-details {
        margin-top: 2rem;
        text-align: left;
        background-color: var(--card-background, #ffffff);
        padding: 0.5rem 1.5rem;
        border-radius: 8px;
        box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
        margin-left: auto;
        margin-right: auto;
    }

    /* Editor wrapper */
    .editor-wrapper {
        grid-template-columns: 1fr;
        height: calc(100vh - 180px);
    }

    .editor-pane,
    .preview {
        height: 50vh;
    }

    /* File tabs */
    .file-tabs {
        padding: 0.3rem;
    }

    .file-tab {
        padding: 0.2rem 0.5rem;
        font-size: 0.75rem;
    }

    /* Collaborators modal */
    .modal-content {
        width: 95%;
        margin: 1rem;
    }

    .collaborator-input {
        flex-direction: column;
        gap: 0.5rem;
    }

    .collaborator-item {
        flex-direction: column;
        gap: 0.5rem;
    }

    .collaborator-actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* Preview in fullscreen */
    .preview.fullscreen {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1000;
    }

    .preview-header {
        position: fixed;
        top: 0;
        right: 0;
        padding: 0.5rem;
        z-index: 1001;
    }

    .btn-fullscreen {
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(30, 34, 39, 0.8);
        backdrop-filter: blur(4px);
    }

    /* Active editor status */
    .active-editor {
        padding: 0.3rem;
        font-size: 0.8rem;
    }

    #active-editor-name {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Buttons */
    .btn-secondary,
    .btn-collaborators,
    .btn-compile {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }

    /* Line numbers */
    .line-numbers {
        font-size: 12px;
        padding: 0.5rem 0.3rem;
        min-width: 24px;
    }

    /* Editor textarea */
    .latex-editor {
        font-size: 12px;
        padding: 0.5rem 0.5rem 0.5rem 35px;
    }

    /* Suggestion box */
    .suggestion-box {
        max-width: 80vw;
        font-size: 12px;
    }

    .suggestion-item {
        padding: 0.3rem 0.5rem;
    }
}

/* Tablet styles */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .editor-wrapper {
        grid-template-columns: 1fr;
    }

    .editor-pane,
    .preview {
        height: 50vh;
    }

    .projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }

    .editor-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .title-container {
        flex: 2;
    }
}

/* Landscape mode for mobile */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .editor-wrapper {
        grid-template-columns: 1fr 1fr;
    }

    .editor-pane,
    .preview {
        height: calc(100vh - 180px);
    }

    .hero-section {
        min-height: 100vh;
    }
}
