@media screen and (max-width: 1400px) {
    .file-explorer {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}
@media screen and (max-width: 1024px) {
    .file-explorer {
        grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    }
}
@media screen and (max-width: 768px) {
    .file-explorer {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 12px;
    }
    .vault-main {
        margin-left: 0;
    }
    .vault-sidebar {
        transform: translateX(-100%);
        width: 260px;
    }
    .vault-layout[data-sidebar-collapsed="true"] .vault-main {
        margin-left: 0;
    }
    .vault-layout[data-sidebar-open="true"] .vault-sidebar {
        transform: translateX(0);
    }
    .topnav-center {
        display: none;
    }
    .topnav-search-toggle {
        display: inline-flex;
    }
    .search-close {
        display: inline-flex;
    }
    .vault-layout[data-search-open="true"] .topnav-search {
        position: fixed;
        inset: calc(10px + env(safe-area-inset-top, 0px)) 16px auto 16px;
        width: calc(100% - 32px);
        z-index: 1100;
        background: rgba(20, 18, 32, 0.96);
        box-shadow: 0 18px 40px rgba(8, 6, 18, 0.45);
    }
    .vault-content {
        padding: 24px 18px;
    }
    #vault-filters {
        padding: 16px;
    }
    #vault-filters form {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .table-header.right {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .view-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .toggle-group {
        width: 100%;
    }
    .toggle-group .toggle-btn {
        flex: 1 1 auto;
        justify-content: center;
        padding: 0 12px;
    }
    .bulk-select {
        justify-content: space-between;
        width: 100%;
    }
    .file-explorer.is-list {
        display: flex;
        flex-direction: column;
        border-width: 1px;
        border-radius: 12px;
        overflow: hidden;
    }
    .file-explorer.is-list .file-container {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 14px 16px;
        border-bottom: 1px solid rgba(187, 134, 252, 0.25);
    }
    .file-explorer.is-list .file-container:last-child {
        border-bottom: none;
    }
    .file-explorer.is-list .file-container .checkbox {
        display: flex;
        align-items: center;
        order: -2;
    }
    .file-explorer.is-list .file-container .checkbox input {
        margin: 0;
    }
    .file-explorer.is-list .file-container .filename {
        white-space: normal;
        font-weight: 600;
    }
    .file-explorer.is-list .file-container .filetype,
    .file-explorer.is-list .file-container .modified,
    .file-explorer.is-list .file-container .size {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 0;
        font-size: 0.9rem;
        opacity: 0.9;
    }
    .file-explorer.is-list .file-container .file-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 6px 16px;
        align-items: center;
    }
    .file-explorer.is-list .file-container .dropdown {
        align-self: flex-end;
        position: static;
        order: -1;
    }
    .photo-editor-shell {
        width: 94vw;
        height: 92vh;
        padding: 20px 18px 28px;
    }
    .photo-editor-header,
    .photo-editor-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }
    .photo-editor-header-actions {
        width: 100%;
        justify-content: space-between;
    }
    .photo-editor-footer {
        position: sticky;
        bottom: 0;
        padding: 16px;
        border-radius: 18px 18px 10px 10px;
        box-shadow: 0 -12px 32px rgba(8, 6, 18, 0.35);
    }
    .photo-editor-footer .toolbar-group,
    .photo-editor-header-actions .toolbar-group {
        width: 100%;
        justify-content: space-between;
    }
    .photo-editor-tabs {
        overflow-x: auto;
        padding-bottom: 6px;
        scrollbar-width: none;
    }
    .photo-editor-tabs::-webkit-scrollbar {
        display: none;
    }
    .toolbar-group {
        flex-wrap: nowrap;
        gap: 8px;
    }
    .toolbar-button {
        padding: 10px 12px;
    }
}

@media screen and (max-width: 480px) {
    .file-explorer {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 10px;
    }
    .photo-editor-shell {
        width: 96vw;
        height: 94vh;
        padding: 18px 14px 24px;
    }
    .photo-editor-header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .photo-editor-footer .toolbar-group {
        flex-direction: column;
        align-items: stretch;
    }
    .photo-editor-tabs {
        gap: 8px;
    }
    .photo-editor-tab {
        padding: 8px 12px;
    }
    .photo-editor-stage-wrapper {
        padding: 14px;
    }
    .topnav-right {
        gap: 10px;
    }
    .topnav-brand-name,
    .topnav-title {
        display: none;
    }
}
/* Responsive adjustments */
@media screen and (max-width: 1024px) {
    .public-layout .index-top-nav {
        flex-wrap: wrap;
        justify-content: center;
        row-gap: 12px;
    }
    .public-layout .right_nav {
        width: 100%;
        justify-content: center;
    }
}

@media screen and (max-width: 768px) {
    .public-layout .nav-links {
        display: none;
    }
    .public-layout .nav-links.active {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: calc(100% + 8px);
        right: clamp(20px, 6vw, 48px);
        background: rgba(5, 3, 12, 0.9);
        padding: 16px;
        border-radius: 18px;
        box-shadow: 0 12px 28px rgba(0, 0, 0, 0.55);
        gap: 12px;
    }
    .public-layout .nav-links a {
        font-size: 1rem;
        padding: 8px 12px;
    }
    .public-layout .hamburger {
        display: flex;
    }
    .form-container {
        margin: clamp(48px, 10vh, 80px) auto 32px;
        padding: clamp(24px, 7vw, 40px);
    }
    .form-footnote {
        font-size: 0.9rem;
    }
    .public-layout .flashes {
        max-height: 160px;
    }
}

@media (max-width: 600px) {
    .form-container {
        padding: clamp(20px, 8vw, 32px);
    }
    .table-container {
        padding: 22px 20px;
    }
    .form-group label {
        font-size: 1em;
    }
    .form-group input {
        padding: 0.5em;
        font-size: 0.95em;
    }
    .button {
        padding: 10px 18px;
        font-size: 1em;
    }
    .table-container {
        width: 100%;
    }
    .table-header {
        margin: 0px 10px 0px 10px;
    }
    h2 {
        font-size: 1.3em !important;
    }
    span, p {
        font-size: 0.9em !important;
    }
    h1 {
        font-size: 1.6em !important;
    }
}

@media screen and (max-width: 480px) {
    .form-container {
        padding: clamp(18px, 9vw, 28px);
    }
    .form-container h1 {
        font-size: 1.5em;
    }
}
