/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --text-primary: #fafafa;
    --text-secondary: #888888;
    --accent: #ffffff;
    --border: #222222;
    --hover: #1a1a1a;
}

body {
    font-family: 'DM Mono', 'Courier New', monospace;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.4;
    font-size: 13px;
    font-weight: 300;
    letter-spacing: 0.3px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom Form Controls - Radio & Checkbox */
input[type="radio"] {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #666;
    border-radius: 50%;
    outline: none;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 10px;
    transition: border-color 0.2s;
}

input[type="radio"]:hover {
    border-color: #999;
}

input[type="radio"]:checked {
    border-color: #888;
}

input[type="radio"]:checked::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-primary);
}

input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid #666;
    outline: none;
    cursor: pointer;
    vertical-align: middle;
    margin-right: 10px;
    transition: all 0.2s;
    background: transparent;
    position: relative;
    flex-shrink: 0;
}

.preset-grid { margin-top: 10px;}

.color-palette-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.data-table input[type="checkbox"] {     position: relative; }

input[type="checkbox"]:hover {
    border-color: #999;
}

input[type="checkbox"]:checked {
    background: var(--text-primary);
    border-color: var(--text-primary);
}

input[type="checkbox"]:checked::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 4px;
    height: 8px;
    border: solid var(--bg-primary);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.container {
    margin: 0 auto;
    padding: 0 40px;
}

@media (max-width: 1440px) {
    .container {
        padding: 0 20px;
    }
}

/* Header */
.header {
    border-bottom: 1px solid var(--border);
    padding: 25px 0;
    position: sticky;
    top: 0;
    background-color: var(--bg-primary);
    z-index: 1000; /* Float over endless gallery */
    backdrop-filter: blur(10px);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-link {
    text-decoration: none;
    color: var(--text-primary);
    transition: opacity 0.15s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-link:hover {
    opacity: 0.7;
}

.logo-link:hover .logo-icon {
    animation: wallnode-sequence 0.8s steps(8) 1;
}

@keyframes wallnode-sequence {
    0% { content: url('../images/wallnode1.svg'); }
    12.5% { content: url('../images/wallnode2.svg'); }
    25% { content: url('../images/wallnode3.svg'); }
    37.5% { content: url('../images/wallnode4.svg'); }
    50% { content: url('../images/wallnode5.svg'); }
    62.5% { content: url('../images/wallnode6.svg'); }
    75% { content: url('../images/wallnode7.svg'); }
    87.5% { content: url('../images/wallnode8.svg'); }
    100% { content: url('../images/wallnode9.svg'); }
}

.logo-icon {
    height: 24px;
    width: 24px;
    min-width: 24px;
    display: block;
    filter: invert(1);
}

/* Preload animation images to prevent jitter */
.logo-link::after {
    content: url('../images/wallnode1.svg') url('../images/wallnode2.svg') url('../images/wallnode3.svg') url('../images/wallnode4.svg') url('../images/wallnode5.svg') url('../images/wallnode6.svg') url('../images/wallnode7.svg') url('../images/wallnode8.svg') url('../images/wallnode9.svg');
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    z-index: -1;
}

.logo {
    font-size:13px;
    font-weight: 400;
    letter-spacing: 1.5px;
}

.logo-short {
    display: none;
}

.nav {
    display: flex;
    gap: 30px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size:13px;
    font-weight: 400;
    letter-spacing: 0.8px;
    transition: color 0.15s ease;
    text-transform: uppercase;
}

.nav-link.view-toggle {
    display: inline-block;
    width: 16px;
    height: 16px;
    padding: 0;
    cursor: pointer;
}

/* Mobile text view toggles - hidden on desktop */
.nav-link.view-toggle-text {
    display: none;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
}

/* User Section */
.user-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-email {
    color: var(--text-secondary);
    font-size:13px;
    font-weight: 400;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-logout {
    color: var(--text-secondary);
    text-decoration: none;
    font-size:13px;
    font-weight: 400;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    cursor: pointer;
    transition: color 0.15s ease;
}

.user-logout:hover {
    color: var(--text-primary);
}

/* User Icon Button */
.user-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s ease;
    padding: 0;
}

.user-icon-btn:hover {
    color: var(--text-primary);
}

.user-icon-btn svg {
    width: 16px;
    height: 16px;
}

/* User Profile Modal */
.user-profile-inner {
    padding: 0;
    width: 800px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    height: 80vh;
    max-height: 700px;
    overflow: hidden;
}

/* Profile Tab Navigation */
.user-profile-tabs {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    padding-right: 50px; /* Space for modal close button */
    gap: 10px;
    flex-shrink: 0;
}

.user-profile-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 0;
    color: var(--text-secondary);
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.5px;
    min-width: 0;
    flex: 1;
}

.user-profile-user svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.user-profile-user .user-profile-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-profile-tabs-right {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.user-profile-tab {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 18px 16px;
    cursor: pointer;
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-profile-tab svg {
    width: 16px;
    height: 16px;
}

.user-profile-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.user-profile-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}

.user-profile-logout {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 18px 16px;
    cursor: pointer;
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-profile-logout svg {
    width: 16px;
    height: 16px;
}

.user-profile-logout:hover {
    color: #ff4444;
}

/* Tab Content Container */
.user-profile-content {
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 40px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) rgba(255, 255, 255, 0.05);
}

.user-profile-content::-webkit-scrollbar {
    width: 6px;
}

.user-profile-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.user-profile-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.user-profile-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.user-profile-tab-panel {
    display: none;
}

.user-profile-tab-panel.active {
    display: block;
}

/* User Profile Header - now in tab bar */
.user-profile-header {
    display: none;
}

.user-profile-avatar {
    display: none;
}

.user-profile-info {
    display: none;
}

.user-profile-email {
    font-size: 12px;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.user-profile-since {
    display: none;
}

/* User Stats Grid */
.user-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.user-stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 20px;
    text-align: left;
}

.user-stat-value {
    font-size: 28px;
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.user-stat-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* Profile Sections */
.user-profile-section {
    margin-bottom: 25px;
}

.user-profile-section-title {
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 2px;
    color: var(--text-secondary);
    margin-bottom: 15px;
    text-transform: uppercase;
}

/* Recent Downloads List */
.recent-downloads-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.recent-download-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 11px;
    gap: 12px;
}

.recent-download-item:last-child {
    border-bottom: none;
}

.recent-download-icon {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.recent-download-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

.recent-download-name {
    color: var(--text-primary);
    letter-spacing: 0.5px;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-transform: uppercase;
}

.recent-download-size {
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    flex-shrink: 0;
    font-size: 10px;
    min-width: 55px;
    text-align: right;
}

.recent-download-date {
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    flex-shrink: 0;
    font-size: 10px;
    min-width: 60px;
    text-align: right;
}

.no-downloads {
    color: var(--text-secondary);
    font-size: 12px;
    text-align: center;
    padding: 20px;
    border: 1px dashed var(--border);
}

/* Profile Actions - Hidden in tabbed layout */
.user-profile-actions {
    display: none;
}

.user-profile-actions .btn-auth {
    flex: 1;
    margin-top: 0;
}

/* User Profile Loader */
.user-profile-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    gap: 20px;
}

/* Change Password Form in Profile */
.change-password-form {
    max-width: 450px;
    margin: 0 auto;
    padding-top: 20px;
}

.change-password-form .auth-form {
    margin-top: 0;
}

/* Change Password Tab Panel - centered content */
.user-profile-tab-panel[data-panel="password"] {
    display: none;
    text-align: center;
}

.user-profile-tab-panel[data-panel="password"].active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
}

.user-profile-tab-panel[data-panel="password"] .change-password-form {
    width: 100%;
    text-align: left;
}

/* Mobile Profile Modal */
@media (max-width: 768px) {
    .user-profile-inner {
        padding: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .user-profile-tabs {
        padding: 0 10px;
        padding-right: 40px; /* Space for modal close button */
        gap: 5px;
    }
    
    .user-profile-user {
        padding: 12px 5px;
    }
    
    .user-profile-user .user-profile-email {
        display: none;
    }
    
    .user-profile-tabs-right {
        gap: 0;
    }
    
    .user-profile-tab {
        padding: 15px 10px;
        font-size: 10px;
    }
    
    .user-profile-tab span {
        display: none;
    }
    
    .user-profile-tab svg {
        width: 18px;
        height: 18px;
    }
    
    .user-profile-logout {
        padding: 15px 10px;
        font-size: 10px;
    }
    
    .user-profile-logout span {
        display: none;
    }
    
    .user-profile-logout svg {
        width: 18px;
        height: 18px;
    }
    
    .user-profile-content {
        padding: 20px 15px;
    }
    
    .user-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .user-stat-card {
        padding: 15px 10px;
    }
    
    .user-stat-value {
        font-size: 22px;
    }
    
    .user-stat-label {
        font-size: 9px;
    }
    
    .change-password-form {
        max-width: 100%;
        padding-top: 0;
    }
    
    .user-profile-tab-panel[data-panel="password"].active {
        justify-content: flex-start;
        padding-top: 20px;
    }
    
    /* Modal wrapper for full-screen profile */
    .modal-body:has(.user-profile-inner) {
        overflow: hidden;
    }
    
    .modal-content:has(.user-profile-inner) {
        margin: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border: none;
        overflow: hidden;
    }
    
    .user-icon-btn {
        display: flex;
        width: 100%;
        height: auto;
        padding: 15px 0;
        justify-content: flex-start;
        border-bottom: 1px solid var(--border);
        gap: 12px;
    }
    
    .user-icon-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .user-icon-btn::after {
        content: 'USER';
        font-size: 13px;
        font-weight: 400;
        letter-spacing: 0.8px;
        text-transform: uppercase;
        font-family: 'DM Mono', monospace;
    }
    
    .user-icon-btn:hover {
        color: var(--text-primary);
    }
}

/* Main Content */
.main {
    min-height: calc(100vh - 80px);
    padding: 40px 0;
    position: relative;
    z-index: 10; /* Float over endless gallery */
}

/* Search Bar */
.search-bar {
    position: fixed;
    top: 105px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 80px);
    margin: 0;
    display: flex;
    gap: 20px;
    align-items: center;
    border: 1px solid var(--border);
    padding: 12px 16px;
    background-color: var(--bg-secondary);
    transition: all 0.2s ease;
    z-index: 1001; /* Float above header and gallery */
    opacity: 0.4;
}

@media (max-width: 1440px) {
    .search-bar {
        width: calc(100% - 40px);
    }
}

.search-bar:hover {
    opacity: 0.7;
}

.search-bar:focus-within {
    border-color: var(--text-secondary);
    opacity: 1;
}

.search-icon {
    color: var(--text-secondary);
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.search-bar:focus-within .search-icon {
    opacity: 1;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size:13px;
    font-weight: 300;
    outline: none;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.search-input::placeholder {
    color: var(--text-secondary);
    text-transform: uppercase;
}

.filter-select {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 12px 8px 16px;
    padding-right: 30px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.15s ease;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    outline: none;
    min-width: 120px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M1 1L5 5L9 1' stroke='%23888888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.filter-select:hover,
.filter-select:focus {
    border-color: var(--text-secondary);
    outline: none;
}

.filter-select option {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 0;
    outline: none;
    padding: 8px;
}

.filter-btn.active {
    background-color: var(--text-primary);
    color: var(--bg-primary);
    border-color: var(--text-primary);
}

.result-count {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 300;
    letter-spacing: 0.5px;
    white-space: nowrap;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.result-count:not(:empty) {
    opacity: 1;
}

/* Wallpaper Grid */
.wallpaper-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    grid-auto-rows: 200px;
    grid-auto-flow: dense; /* Fill gaps when items span multiple columns */
    gap: 20px;
    margin-bottom: 60px;
    padding-top: 80px;
}

.wallpaper-item {
    background-color: transparent;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Ensure 1nd item is short */
.wallpaper-item:nth-child(1) {
    grid-column: span 1;
    grid-row: span 2 !important; /* Override nth-child rules to ensure good aspect ratio */
}

/* Ensure 2nd item is wide */
.wallpaper-item:nth-child(2) {
    grid-column: span 2;
    grid-row: span 2 !important; /* Override nth-child rules to ensure good aspect ratio */
}

/* Ensure 4th item is tall to break flat top line */
.wallpaper-item:nth-child(3) {
    grid-row: span 3 !important;
}

/* Original tall spanning pattern */
.wallpaper-item:nth-child(3n+1) {
    grid-row: span 2;
}

.wallpaper-item:nth-child(5n+2) {
    grid-row: span 3;
}

.wallpaper-item:nth-child(7n+3) {
    grid-row: span 2;
}

/* Wide items span 2 columns and 2 rows for ~16:9 ratio */
.wallpaper-item-wide {
    grid-column: span 2;
    grid-row: span 2 !important; /* Override nth-child rules to ensure good aspect ratio */
}

.wallpaper-image-wrapper {
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--border);
}

.wallpaper-item:hover .wallpaper-thumbnail {
    opacity: 0.85;
    transform: scale(1.1);
}

.wallpaper-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

/* Hide broken image icon and alt text */
.wallpaper-thumbnail::before,
.wallpaper-thumbnail::after {
    display: none !important;
}

.wallpaper-thumbnail.loading {
    background: var(--bg-primary);
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    filter: blur(0px);
    animation: pulse 2s ease-in-out infinite;
    opacity: 0.5;
    /* Hide any text/alt content */
    color: transparent;
    font-size: 0;
    text-indent: -9999px;
    overflow: hidden;
    will-change: opacity; /* GPU acceleration hint */
}

.wallpaper-thumbnail.error {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3) 0%, rgba(118, 75, 162, 0.3) 100%);
    /* Hide error icon and text */
    color: transparent;
    font-size: 0;
    text-indent: -9999px;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 0.7;
    }
}

.wallpaper-thumbnail.loaded {
    image-rendering: auto;
    animation: fadeIn 0.6s ease-out forwards;
    will-change: opacity; /* GPU acceleration hint */
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.wallpaper-overlay {
    position: static;
    background: transparent;
    padding: 0;
    opacity: 1;
    transition: none;
    /* white-space: nowrap; */
    overflow: hidden;
    /* text-overflow: ellipsis; */
    min-height: 14px;
    line-height:1.1;
    color: var(--text-secondary);
}

.wallpaper-item:hover .wallpaper-overlay {
    opacity: 1;
}

.wallpaper-title {
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.5px;
    margin: 0;
    line-height: 1.1;
    display: inline;
    text-transform: uppercase;
    color: var(--text-primary);
}

.wallpaper-meta {
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    line-height: 1.1;
    display: inline;
    margin: 0;
    text-transform: uppercase;
}

.wallpaper-meta::before {
    content: '/';
    color: var(--text-secondary);
    margin: 0 6px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 13px;
    letter-spacing: 2px;
}

/* Image Load Status */
.image-load-status {
    position: fixed;
    bottom: 30px;
    right: 100px;
    padding: 15px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 11px;
    letter-spacing: 1.5px;
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: none; /* Disabled */
}

.image-load-status.visible {
    opacity: 1;
}

/* View Toggle Icons */
.view-icon-grid,
.view-icon-endless {
    display: block;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.view-icon-grid:hover,
.view-icon-endless:hover {
    opacity: 0.6;
}

.view-icon-grid.active,
.view-icon-endless.active {
    opacity: 1;
}

/* Endless Gallery Mode (Infinite Draggable Canvas) */
.endless-gallery {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    cursor: grab;
    z-index: 1; /* Below nav and search */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

.endless-gallery.active {
    display: block;
}

.endless-gallery.dragging {
    cursor: grabbing;
}

.endless-gallery.active {
    display: block;
}

.endless-canvas {
    position: absolute;
    top: 0;
    left: 0;
    will-change: transform;
}

.endless-gallery .wallpaper-item {
    position: absolute;
    width: 280px;
    cursor: pointer;
    pointer-events: auto;
    opacity: 0;
    animation: fadeInEndless 0.4s ease-out forwards;
}

@media (max-width: 768px) {
    .endless-gallery .wallpaper-item {
        width: 200px;
    }
}

@media (max-width: 480px) {
    .endless-gallery .wallpaper-item {
        width: 150px;
    }
}

/* Endless gallery mobile limits */
@media (max-width: 768px) {
    .endless-gallery {
        /* Ensure no overflow on mobile */
        overflow: hidden;
        -webkit-overflow-scrolling: touch;
    }
}

@keyframes fadeInEndless {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Hide grid when endless is active */
.endless-mode .wallpaper-grid {
    display: none;
}

/* Infinite Gallery Mode (3D Canvas) */
.infinite-gallery {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    z-index: 1;
    background: #000;
}

.infinite-gallery.active {
    display: block;
}

.infinite-gallery canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

.infinite-gallery canvas:active {
    cursor: grabbing;
}

.infinite-gallery .infinite-controls {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid var(--border);
    padding: 12px 20px;
    border-radius: 4px;
    font-size: 10px;
    letter-spacing: 1px;
    z-index: 10;
    pointer-events: none;
    color: var(--text-secondary);
}

/* Infinite gallery mobile limits */
@media (max-width: 768px) {
    .infinite-gallery {
        overflow: hidden;
        touch-action: none;
    }
    
    .infinite-gallery .infinite-controls {
        bottom: 20px;
        padding: 10px 15px;
        font-size: 9px;
    }
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, border-color 0.2s ease, transform 0.2s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.back-to-top:active {
    transform: translateY(0);
}

.back-to-top svg {
    stroke: currentColor;
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    background-color: var(--bg-primary);
    padding: 25px 0;
    margin-top: 60px;
}

/* Footer in endless mode - sticky and transparent */
body.endless-active .footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    margin-top: 0;
    z-index: 100;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.footer-text {
    flex: 1;
}



.footer p {
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 1px;
    line-height: 1.3;
    margin: 0;
}

.footer-text a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s ease;
}

.footer-text a:hover {
    color: var(--text-primary);
}

.footer-logos {
    display: flex;
    gap: 20px;
    align-items: center;
}

.footer-logo {
    opacity: 0.6;
    transition: opacity 0.2s ease;
    display: block;
    line-height: 0;
}

.footer-logo:hover {
    opacity: 1;
}

.footer-logo img {
    height: 24px;
    width: auto;
    display: block;
    filter: invert(1);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(19, 19, 19, 0.80);
    overflow-y: auto;
    backdrop-filter: blur(7px); /* Frosted glass blur */
    -webkit-backdrop-filter: blur(7px); /* Safari support */
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative;
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    max-width: 1200px;
    max-height: 90vh;
    width: auto;
    margin: 40px;
    display: flex;
    flex-direction: column;
}

.modal-close {
    position: absolute;
    top: 4px;
    right: 8px;
    font-size: 24px;
    font-weight: 300;
    color: var(--text-secondary);
    cursor: pointer;
    z-index: 10;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
    min-height: 0;
}

.modal-left {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--border);
    flex: 1;
    min-height: 0;
}

.modal-image-container {
    background-color: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0px;
    flex: 1;
    min-height: 400px;
    min-width: 500px;
    overflow: hidden;
    position: relative;
}

.modal-image-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-secondary);
    z-index: 5;
    opacity: 1;
    transition: opacity 0.3s ease;
    gap: 20px;
}

.modal-image-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-loading-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    opacity: 0.3;
    filter: brightness(0) invert(1);
}

.modal-image-loading-text {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
}

.modal-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
}

.modal-image.loaded {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

/* Carousel Arrows */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.carousel-arrow:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
}

.carousel-arrow-left {
    left: 20px;
}

.carousel-arrow-right {
    right: 20px;
}

.carousel-arrow svg {
    width: 24px;
    height: 24px;
}

.modal-info {
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 0px;
    text-transform: uppercase;
}

.modal-info-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 30px;
    margin-bottom: 15px;
}

.modal-info-left {
    flex: 1;
    min-width: 0;
}

.modal-info-right {
    text-align: right;
    flex-shrink: 0;
}

.modal-info-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.info-modal-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 60px 40px;
}

#infoModal .modal-info {
    padding: 0;
}

#infoModal .modal-body {
    display: flex;
    align-items: center;
    justify-content: center;
    grid-template-columns: none;
}

#infoModal .modal-content {
    max-width: 1200px;
}

.info-modal-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 60px;
    align-items: center;
    max-width: 1000px;
    padding: 60px 40px;
}

.info-modal-paragraph {
    color: var(--text-secondary);
    line-height: 1.8;
    margin: 20px 0;
}

.info-modal-logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-modal-logo-img {
    height: 90%;
    max-width: 260px;
    opacity: 0.5;
    filter: invert(1);
}

.info-modal-logo-img.animate {
    animation: wallnode-sequence 0.8s steps(8) 1;
}

/* About modal links row */
.info-modal-links {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
    letter-spacing: 1.5px;
}

.info-modal-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.info-modal-link:hover {
    color: var(--text-primary);
}

.info-modal-link-separator {
    color: var(--border);
    user-select: none;
}

/* Legal Modals - Terms, Privacy, License */
#termsModal .modal-body,
#privacyModal .modal-body,
#licenseModal .modal-body {
    display: block;
    align-items: flex-start;
    justify-content: flex-start;
    overflow-y: auto;
    max-height: 80vh;
}

/* Custom scrollbar for legal modals */
#termsModal .modal-body::-webkit-scrollbar,
#privacyModal .modal-body::-webkit-scrollbar,
#licenseModal .modal-body::-webkit-scrollbar {
    width: 8px;
}

#termsModal .modal-body::-webkit-scrollbar-track,
#privacyModal .modal-body::-webkit-scrollbar-track,
#licenseModal .modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

#termsModal .modal-body::-webkit-scrollbar-thumb,
#privacyModal .modal-body::-webkit-scrollbar-thumb,
#licenseModal .modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    transition: background 0.2s ease;
}

#termsModal .modal-body::-webkit-scrollbar-thumb:hover,
#privacyModal .modal-body::-webkit-scrollbar-thumb:hover,
#licenseModal .modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Firefox scrollbar */
#termsModal .modal-body,
#privacyModal .modal-body,
#licenseModal .modal-body {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) rgba(255, 255, 255, 0.05);
}

#termsModal .info-modal-content,
#privacyModal .info-modal-content,
#licenseModal .info-modal-content {
    display: block;
    text-align: left;
    max-width: 800px;
    padding: 40px 60px;
    margin: 0;
}

#termsModal .modal-title,
#privacyModal .modal-title,
#licenseModal .modal-title {
    text-align: left;
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 30px;
}

#termsModal .info-modal-paragraph,
#privacyModal .info-modal-paragraph,
#licenseModal .info-modal-paragraph {
    text-align: left;
    margin: 15px 0;
    line-height: 1.6;
}

#termsModal .info-modal-paragraph a,
#privacyModal .info-modal-paragraph a,
#licenseModal .info-modal-paragraph a {
    color: var(--text-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

#termsModal .info-modal-paragraph a:hover,
#privacyModal .info-modal-paragraph a:hover,
#licenseModal .info-modal-paragraph a:hover {
    opacity: 0.7;
}

#termsModal .info-modal-paragraph strong,
#privacyModal .info-modal-paragraph strong,
#licenseModal .info-modal-paragraph strong {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 1.5px;
    color: var(--text-primary);
    display: block;
    margin-bottom: 8px;
    margin-top: 20px;
}

#termsModal .info-modal-paragraph:first-of-type strong,
#privacyModal .info-modal-paragraph:first-of-type strong,
#licenseModal .info-modal-paragraph:first-of-type strong {
    margin-top: 0;
}

.modal-title {
    font-size: 16px;
    font-weight: 400;
    letter-spacing: 2px;
    line-height: 1.3;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.modal-artist {
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 1px;
    margin-bottom: 0px;
}

.modal-description {
    font-size: 12px;
    line-height: 1.5;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.modal-meta {
    display: flex;
    flex-direction: column;
    gap: 0px;
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
    align-content: flex-start;
    justify-content: flex-end;
}

.tag {
    background-color: transparent;
    border: 1px solid var(--border);
    padding: 4px 8px;
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.tag:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.series-thumbnails {
    padding: 20px 20px;
    border-top: 1px solid var(--border);
    background-color: var(--bg-primary);
}

.series-thumbnails-title {
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.series-thumbnails-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

.series-thumbnail-item {
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.series-thumbnail-item:hover {
    border-color: var(--accent);
}

.series-thumbnail-item.active {
    border-color: var(--text-primary);
}

.series-thumbnail-img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
}

.modal-actions {
    display: flex;
    flex-direction: row;
    gap: 15px;
    flex-shrink: 0;
}

.download-group {
    display: flex;
    gap: 0;
}

.download-group .btn-download {
    border-right: 1px solid var(--bg-primary);
}

.resolution-select {
    background-color: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    padding: 14px 12px;
    font-family: inherit;
    font-size: 11px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: normal;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
}

.resolution-select:hover {
    background-color: var(--accent);
}

.resolution-select option {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    padding: 10px;
}

.btn-download,
.btn-download-series {
    background-color: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    padding: 14px;
    font-family: inherit;
    font-size: 12px;
    letter-spacing: 3px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: normal;
}

.btn-download:hover,
.btn-download-series:hover {
    background-color: var(--accent);
}

.btn-download-series {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-download-series:hover {
    border-color: var(--accent);
    color: var(--accent);
    background-color: transparent;
}

.btn-share {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 14px 20px;
    font-family: inherit;
    font-size: 12px;
    letter-spacing: 3px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: normal;
}

.btn-share:hover {
    border-color: var(--accent);
    color: var(--accent);
    background-color: transparent;
}

.btn-share svg {
    width: 14px;
    height: 14px;
}

/* Auth Modal */
.auth-modal-content {
    max-width: 500px;
}

.auth-modal-inner {
    padding: 40px;
}

.auth-modal-subtitle {
    color: var(--text-secondary);
    font-size:13px;
    margin-bottom: 30px;
    text-transform: none;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-form label {
    font-size: 11px;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.auth-form input[type="email"],
.auth-form input[type="text"] {
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 12px 14px;
    font-family: inherit;
    font-size:13px;
    transition: border-color 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--text-secondary);
}

.auth-terms {
    margin: 10px 0;
}

.auth-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: none;
}

.auth-checkbox input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
}

.auth-checkbox span {
    line-height: 1.4;
}

.auth-error {
    color: #ff6b6b;
    font-size: 12px;
    padding: 12px 14px;
    background-color: rgba(255, 107, 107, 0.08);
    border: 1px solid rgba(255, 107, 107, 0.25);
    border-left: 3px solid #ff6b6b;
    display: none;
    text-transform: none;
    letter-spacing: 0.3px;
    line-height: 1.5;
    border-radius: 2px;
}

.auth-error.show {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.auth-error::before {
    content: '';
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff6b6b' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E");
    background-size: contain;
    flex-shrink: 0;
    margin-top: 1px;
}

.auth-success {
    color: #4ade80;
    font-size: 12px;
    padding: 12px 14px;
    background-color: rgba(74, 222, 128, 0.08);
    border: 1px solid rgba(74, 222, 128, 0.25);
    border-left: 3px solid #4ade80;
    display: none;
    text-transform: none;
    letter-spacing: 0.3px;
    line-height: 1.5;
    border-radius: 2px;
}

.auth-success.show {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.auth-success::before {
    content: '';
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234ade80' stroke-width='2'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/%3E%3Cpolyline points='22 4 12 14.01 9 11.01'/%3E%3C/svg%3E");
    background-size: contain;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Warning notification style */
.auth-warning {
    color: #fbbf24;
    font-size: 12px;
    padding: 12px 14px;
    background-color: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.25);
    border-left: 3px solid #fbbf24;
    display: none;
    text-transform: none;
    letter-spacing: 0.3px;
    line-height: 1.5;
    border-radius: 2px;
}

.auth-warning.show {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.auth-warning::before {
    content: '';
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fbbf24' stroke-width='2'%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/%3E%3Cline x1='12' y1='9' x2='12' y2='13'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'/%3E%3C/svg%3E");
    background-size: contain;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Info notification style */
.auth-info {
    color: #60a5fa;
    font-size: 12px;
    padding: 12px 14px;
    background-color: rgba(96, 165, 250, 0.08);
    border: 1px solid rgba(96, 165, 250, 0.25);
    border-left: 3px solid #60a5fa;
    display: none;
    text-transform: none;
    letter-spacing: 0.3px;
    line-height: 1.5;
    border-radius: 2px;
}

.auth-info.show {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.auth-info::before {
    content: '';
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2360a5fa' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='16' x2='12' y2='12'/%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'/%3E%3C/svg%3E");
    background-size: contain;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Form Input Validation States */
.auth-form input.input-error,
.auth-form input:user-invalid {
    border-color: rgba(255, 107, 107, 0.5) !important;
    background-color: rgba(255, 107, 107, 0.03);
}

.auth-form input.input-error:focus,
.auth-form input:user-invalid:focus {
    border-color: #ff6b6b !important;
}

.auth-form input.input-success {
    border-color: rgba(74, 222, 128, 0.5) !important;
}

.auth-form input.input-success:focus {
    border-color: #4ade80 !important;
}

/* Inline field error message */
.field-error {
    color: #ff6b6b;
    font-size: 11px;
    margin-top: 6px;
    display: none;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.3px;
}

.field-error.show {
    display: flex;
}

.field-error::before {
    content: '';
    width: 12px;
    height: 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff6b6b' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E");
    background-size: contain;
    flex-shrink: 0;
}

.btn-auth {
    width: 100%;
    padding: 14px;
    background-color: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    font-family: inherit;
    font-size: 12px;
    letter-spacing: 3px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: normal;
    margin-top: 10px;
}

.btn-auth:hover:not(:disabled) {
    background-color: #e0e0e0;
}

.btn-auth:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-auth.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-auth.btn-secondary:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background-color: transparent;
}

.auth-links {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: center;
}

.auth-link {
    color: var(--text-secondary);
    font-size: 12px;
    text-decoration: none;
    transition: color 0.2s;
    text-transform: none;
}

.auth-link:hover {
    color: var(--text-primary);
}

.auth-form input[type="password"] {
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 12px 14px;
    font-family: inherit;
    font-size:13px;
    transition: border-color 0.2s;
}

.auth-form input[type="password"]:focus {
    outline: none;
    border-color: var(--text-secondary);
}

.auth-verification-icon {
    font-size: 64px;
    margin: 24px 0;
}

.auth-verification-text {
    color: var(--text-secondary);
    font-size:13px;
    line-height: 1.6;
    margin-bottom: 24px;
    text-transform: none;
}

.auth-privacy {
    margin-top: 20px;
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.5;
    text-transform: none;
}

.auth-privacy a.auth-terms-link {
    color: var(--text-secondary);
    text-decoration: underline;
    transition: color 0.2s ease;
}

.auth-privacy a.auth-terms-link:hover {
    color: var(--text-primary);
}

/* ================================
   MOBILE HAMBURGER MENU
   ================================ */

/* Hamburger button - hidden on desktop */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--border);
    cursor: pointer;
    padding: 8px;
    gap: 5px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    z-index: 1100;
    flex-shrink: 0;
}

.hamburger-menu.active {
    background: var(--bg-secondary);
}

.hamburger-menu:hover {
    border-color: var(--text-secondary);
}

.hamburger-line {
    display: block;
    width: 20px;
    height: 2px;
    background-color: var(--text-primary);
    transition: all 0.3s ease;
}

/* Hamburger animation when open */
.hamburger-menu.active .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger-menu.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger-menu.active .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Mobile menu overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

/* Prevent horizontal scroll when mobile menu is open */
body.mobile-menu-open {
    overflow-x: hidden;
}

body.mobile-menu-open,
html:has(body.mobile-menu-open) {
    overflow-x: hidden;
}

/* Responsive */
@media (max-width: 968px) {
    .wallpaper-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        grid-auto-rows: 140px;
        gap: 15px;
    }
    
    .header .container {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .logo-full {
        display: none;
    }
    
    .logo-short {
        display: inline;
    }
    
    .nav {
        gap: 15px;
    }
    
    .nav-link {
        font-size:13px;
    }
    
    .footer-content {
        gap: 25px;
        align-items: flex-start;
    }
    
    .modal-image-container {
        min-height: 300px;
        min-width: 100%;
    }
}

/* Mobile Navigation - Hamburger Menu */
@media (max-width: 768px) {
    /* Remove backdrop-filter on mobile header to allow fixed positioning in children */
    .header {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
    
    /* When mobile menu is open, make header fixed so it stays visible */
    body.mobile-menu-open .header {
        position: fixed;
        left: 0;
        right: 0;
        top: 0;
    }
    
    /* Show hamburger button */
    .hamburger-menu {
        display: flex;
    }
    
    /* Mobile navigation panel */
    .nav {
        position: fixed;
        top: 0;
        right: -280px;
        width: 280px;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile browsers */
        background-color: var(--bg-secondary);
        border-left: 1px solid var(--border);
        flex-direction: column;
        align-items: flex-start;
        padding: 80px 30px 30px;
        gap: 0;
        z-index: 1050;
        transition: right 0.3s ease;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .nav.active {
        right: 0;
    }
    
    .nav-link {
        display: block;
        width: 100%;
        padding: 15px 0;
        border-bottom: 1px solid var(--border);
        font-size:13px;
        letter-spacing: 1.5px;
    }
    
    .nav-link:first-child {
        border-top: 1px solid var(--border);
    }
    
    /* Hide SVG icon view toggles on mobile */
    .nav-link.view-toggle {
        display: none !important;
    }
    
    /* Show text view toggles on mobile */
    .nav-link.view-toggle-text {
        display: block;
    }
    
    /* User section in mobile menu */
    .user-section {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        margin-top: auto;
        padding-top: 20px;
    }
    
    .user-section .nav-link,
    .user-section .user-logout {
        display: block;
        width: 100%;
        padding: 15px 0;
        border-bottom: 1px solid var(--border);
    }
    
    .user-section .user-email {
        display: block;
        width: 100%;
        max-width: none;
        padding: 15px 0;
        border-bottom: 1px solid var(--border);
        color: var(--text-primary);
    }
    
    /* Header adjustments */
    .header .container {
        flex-wrap: nowrap;
        justify-content: space-between;
    }
    
    .header {
        padding: 20px 0;
        position: sticky;
        top: 0;
    }
    
    /* Mobile overflow control - only on html to preserve sticky */
    html {
        overflow-x: hidden;
    }
    
    .container {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .wallpaper-grid {
        padding-top: 70px;
    }
    
    /* Wallpaper Modal mobile styles */
    .modal-info {
        padding: 20px;
    }
    
    .modal-info-header {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
        font-size: 11px;
        line-height: 1.4;
    }
    
    .modal-info-left,
    .modal-info-right {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        align-items: center;
    }
    
    .modal-info-left > *,
    .modal-info-right > * {
        display: inline;
    }
    
    .modal-info-left > *:not(:last-child)::after,
    .modal-info-right .modal-meta > *:not(:last-child)::after {
        content: " / ";
        margin-left: 8px;
        color: var(--text-secondary);
    }
    
    .modal-title,
    .modal-artist,
    .modal-description {
        display: inline;
        margin: 0;
        font-size: 11px;
    }
    
    .modal-info-right {
        text-align: left;
    }
    
    .modal-meta {
        display: inline-flex;
        flex-direction: row;
        gap: 8px;
        font-size: 11px;
    }
    
    .modal-info-footer {
        flex-direction: column;
        gap: 15px;
    }
    
    .modal-actions {
        flex-wrap: wrap;
        width: 100%;
    }
    
    .download-group {
        flex: 1;
        min-width: 200px;
    }
    
    .download-group .btn-download {
        flex: 1;
    }
    
    .modal-tags {
        width: 100%;
        justify-content: flex-start;
    }
    
    /* Info Modal mobile styles */
    .info-modal-grid {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 30px 20px;
        text-align: center;
    }
    
    .info-modal-content {
        padding: 30px 15px;
    }
    
    .info-modal-logo {
        order: -1;
    }
    
    .info-modal-logo-img {
        max-width: 150px;
    }
    
    .info-modal-paragraph {
        font-size: 12px;
        line-height: 1.7;
        margin: 15px 0;
    }

    .info-modal-links {
        justify-content: center;
    }
    
    #infoModal .modal-content {
        max-width: 95%;
        margin: 20px auto;
    }
}

/* Extra small devices */
@media (max-width: 640px) {
    .wallpaper-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
        gap: 25px;
    }
    
    /* Disable tall and wide items on mobile - single column layout */
    .wallpaper-item:nth-child(1),
    .wallpaper-item:nth-child(2),
    .wallpaper-item:nth-child(3n+1),
    .wallpaper-item:nth-child(5n+2),
    .wallpaper-item:nth-child(7n+3) {
        grid-row: span 1;
        grid-column: span 1;
    }
    
    .wallpaper-item-wide {
        grid-column: span 1;
    }
    
    .wallpaper-grid .wallpaper-thumbnail {
        aspect-ratio: 16 / 9;
        height: auto;
    }
    
    .search-bar {
        gap: 12px;
        padding: 12px 16px;
    }
    
    .filter-select {
        min-width: 100px;
        padding: 6px 12px;
    }
    
    .modal-image-container {
        min-height: 300px;
        min-width: 100%;
    }
    
    .modal-image {
        object-fit: cover;
        min-height: 300px;
    }
    
    .modal-info-header {
        font-size: 10px;
        line-height: 1.6;
        gap: 6px;
    }
    
    .modal-title,
    .modal-artist,
    .modal-description {
        font-size: 10px;
        word-break: break-word;
    }
    
    .modal-meta {
        font-size: 10px;
    }
}

@media (min-width: 1400px) {
    .wallpaper-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 30px 15px;
    }
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 14px 24px;
    font-size: 12px;
    letter-spacing: 0.5px;
    z-index: 10000;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: calc(100vw - 40px);
    border-radius: 2px;
}

.toast-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-notification.toast-success {
    border-color: rgba(74, 222, 128, 0.3);
    border-left: 3px solid #4ade80;
}

.toast-notification.toast-error {
    border-color: rgba(255, 107, 107, 0.3);
    border-left: 3px solid #ff6b6b;
}

.toast-notification.toast-warning {
    border-color: rgba(251, 191, 36, 0.3);
    border-left: 3px solid #fbbf24;
}

.toast-notification.toast-info {
    border-color: rgba(96, 165, 250, 0.3);
    border-left: 3px solid #60a5fa;
}
