@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Dark Mode Color Palette - Pure Neutral Grays */
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-tertiary: #1a1a1a;
    --bg-elevated: #1f1f1f;
    
    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-black: #000000;
    
    --accent-primary: #ffffff;
    --accent-hover: #f4f4f5;
    --accent-subtle: rgba(255, 255, 255, 0.1);
    
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    --border-subtle: #2a2a2a;
    --border-medium: #404040;
    --border-strong: #525252;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.7);
    --shadow-glow: 0 0 20px rgba(255, 255, 255, 0.15);
}

body {
    font-family: 'Sora', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 20px;
    position: relative;
    min-height: 100vh;
    line-height: 1.6;
}

.site-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    z-index: -1;
    pointer-events: none;
}

.site-background::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at top, rgba(255, 255, 255, 0.05), transparent 50%),
                radial-gradient(ellipse at bottom, rgba(255, 255, 255, 0.03), transparent 50%);
}

/*top nav bar*/
.nav {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    padding: 16px 24px;
    margin-bottom: 24px;
    max-width: 1200px;
    margin: 0 auto 24px auto;
    display: flex;
    justify-content: space-between;
    border-radius: 12px;
    align-items: center;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(20px);
    position: relative;
    z-index: 200;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-logo {
    height: 36px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.nav-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.profile-menu {
    position: relative;
}

.profile-trigger {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    cursor: pointer;
    overflow: hidden;
    border: 2px solid var(--border-medium);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.profile-trigger:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    transform: scale(1.05);
}

.profile-trigger.logged-in {
    border-color: var(--success);
}

.dropdown-menu {
    position: absolute;
    top: 60px;
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    display: none;
    z-index: 100;
    border-radius: 12px;
    overflow: hidden;
    backdrop-filter: blur(20px);
}

.dropdown-menu.active {
    display: block;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    padding: 14px 20px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.15s;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: var(--accent-subtle);
    color: var(--accent-hover);
}

.dropdown-item.disabled {
    color: var(--text-muted);
    cursor: not-allowed;
}

.dropdown-item.disabled:hover {
    background: transparent;
    color: var(--text-muted);
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Create Page Styles */
.create-container {
    max-width: 800px;
    margin: 0 auto;
}

.creator-panel {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.creator-header {
    padding: 20px 24px;
    background: linear-gradient(135deg, #18181b 0%, #27272a 100%);
    color: white;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.creator-content {
    padding: 24px;
}

.field {
    margin-bottom: 24px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.drop-zone {
    border: 2px dashed var(--border-medium);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    background: var(--bg-secondary);
    font-size: 13px;
    color: var(--text-secondary);
    border-radius: 8px;
    transition: all 0.2s;
}

.drop-zone:hover,
.drop-zone.dragover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-subtle);
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 8px;
    font-family: 'Sora', sans-serif;
    transition: all 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

input[type="text"]::placeholder,
input[type="password"]::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.crop-container {
    margin-top: 16px;
    border: 1px solid var(--border-subtle);
    padding: 20px;
    background: var(--bg-secondary);
    display: none;
    border-radius: 8px;
}

.crop-container.active {
    display: block;
}

.crop-instructions {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-align: center;
    font-weight: 500;
}

.crop-canvas-wrapper {
    position: relative;
    max-width: 100%;
    margin: 0 auto;
    background: #000;
    display: inline-block;
    border-radius: 8px;
    overflow: hidden;
}

#cropCanvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.crop-box {
    position: absolute;
    border: 2px solid var(--accent-primary);
    background: rgba(255, 255, 255, 0.15);
    cursor: move;
    pointer-events: all;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
    touch-action: none;
    min-width: 50px;
    min-height: 50px;
}

@media (max-width: 768px) {
    .crop-box {
        border: 3px solid var(--accent-primary);
        background: rgba(255, 255, 255, 0.2);
    }
}

.crop-handle {
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--accent-primary);
    border: 3px solid #000;
    border-radius: 50%;
    pointer-events: all;
    z-index: 10;
    touch-action: none;
    transition: transform 0.15s;
}

.crop-handle:hover {
    transform: scale(1.2);
}

@media (max-width: 768px) {
    .crop-handle {
        width: 28px;
        height: 28px;
        border: 4px solid #000;
    }
}

.crop-handle.top-left {
    top: -10px;
    left: -10px;
    cursor: nw-resize;
}

.crop-handle.top-right {
    top: -10px;
    right: -10px;
    cursor: ne-resize;
}

.crop-handle.bottom-left {
    bottom: -10px;
    left: -10px;
    cursor: sw-resize;
}

.crop-handle.bottom-right {
    bottom: -10px;
    right: -10px;
    cursor: se-resize;
}

@media (max-width: 768px) {
    .crop-handle.top-left {
        top: -14px;
        left: -14px;
    }
    
    .crop-handle.top-right {
        top: -14px;
        right: -14px;
    }
    
    .crop-handle.bottom-left {
        bottom: -14px;
        left: -14px;
    }
    
    .crop-handle.bottom-right {
        bottom: -14px;
        right: -14px;
    }
}

button {
    width: 100%;
    padding: 14px 24px;
    background: var(--accent-primary);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin-top: 12px;
    border-radius: 8px;
    font-family: 'Sora', sans-serif;
    transition: all 0.2s;
    letter-spacing: 0.02em;
}

button:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Card Style Selection */
.card-style-option {
    transition: all 0.2s;
    position: relative;
}

.card-style-option:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-style-option.active {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* Media Cards */
.media-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    width: 140px;
    height: 210px;
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.media-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.media-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.95), transparent);
    padding: 10px;
    opacity: 0;
    transition: opacity 0.2s;
}

.media-card:hover .media-card-overlay {
    opacity: 1;
}

.media-card-title {
    font-size: 11px;
    font-weight: 600;
    color: white;
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-card-year,
.media-card-rating {
    font-size: 9px;
    color: rgba(255,255,255,0.8);
}

.media-card-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: rgba(0,0,0,0.8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
    cursor: pointer;
    z-index: 10;
}

.media-card:hover .media-card-remove {
    opacity: 1;
}

.media-card-remove:hover {
    background: var(--error);
}

.add-media-card {
    width: 140px;
    height: 210px;
    border: 2px dashed var(--border-medium);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.add-media-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    transform: translateY(-4px);
}

/* Media search results */
.media-search-result {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 2/3;
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.media-search-result:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.media-search-result img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-search-result-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.95), transparent);
    padding: 8px;
    color: white;
}

.media-search-result-title {
    font-size: 11px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-search-result-year {
    font-size: 9px;
    opacity: 0.8;
}

.status {
    padding: 12px 16px;
    margin-top: 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    display: none;
}

.status.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
    display: block;
}

.status.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
    display: block;
}

.status.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
    display: block;
}

/* View Page Styles */
.view-container {
    max-width: 800px;
    margin: 0 auto;
}

.profile-container {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.profile-header {
    background: linear-gradient(180deg, #4a5568 0%, #2d3748 100%);
    height: 180px;
    background-size: cover;
    background-position: center;
}

.profile-content {
    padding: 24px;
    padding-top: 0;
    position: relative;
    background-size: cover;
    background-position: center;
}

.profile-id-card {
    position: relative;
    display: flex;
    flex-direction: column;
    
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    margin-bottom: 25px;
    margin-top: -60px;
    overflow: hidden;
    
    width: 100%;
    min-width: 280px;
    max-width: 360px;
    height: 195px;
}

.profile-id-card-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.2;
    z-index: -1;
}

.profile-id-card .profile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 1;
    position: relative;
    flex-shrink: 0;
}

.profile-id-card .profile-card-body {
    display: flex;
    gap: 12px;
    padding: 12px;
    z-index: 1;
    position: relative;
    flex: 1;
    overflow: hidden;
}

.profile-id-card .profile-img {
    position: relative;
    top: 0;
    left: 0;
    width: 90px;
    height: 90px;
    border: 2px solid var(--border-medium);
    background: var(--bg-tertiary);
    overflow: hidden;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 1;
    flex-shrink: 0;
}

.profile-id-card .profile-card-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px 8px;
    flex: 1;
    min-width: 0;
    align-content: start;
}

.profile-id-card .profile-card-name {
    font-size: 13px;
}

.profile-img {
    width: 140px;
    height: 140px;
    border: 4px solid var(--bg-elevated);
    background: var(--bg-tertiary);
    position: absolute;
    top: -70px;
    left: 24px;
    overflow: hidden;
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
}

.profile-name {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

/* Card Flip Styles */
.profile-id-card-container {
    perspective: 1000px;
    margin-bottom: 25px;
    margin-top: -60px;
    width: 100%;
    min-width: 280px;
    max-width: 360px;
    height: 195px;
}

.profile-id-card-flipper {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    cursor: pointer;
}

.profile-id-card-flipper.flipped {
    transform: rotateY(180deg);
}

.profile-id-card {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow: hidden;
}

.card-front {
    transform: rotateY(0deg);
    z-index: 1;
}

.card-back {
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    padding: 10px;
}

.card-back-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
}

.signature-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 10;
}

.signature-display {
    flex: 1;
    background: #ffffff;
    border: 2px solid var(--border-medium);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 60px;
    position: relative;
    z-index: 10;
    padding: 6px;
}

.signature-display img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 10;
}

.no-signature {
    color: #999;
    font-size: 12px;
    font-style: italic;
}

.card-flip-hint {
    position: absolute;
    bottom: 6px;
    right: 10px;
    font-size: 9px;
    color: var(--text-muted);
    opacity: 0.6;
    pointer-events: none;
    z-index: 10;
}

/* Signature Canvas Container */
.signature-canvas-container {
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    overflow: hidden;
    max-width: 500px;
    width: 100%;
}

#signatureCanvas {
    display: block;
    width: 100%;
    height: auto;
    cursor: crosshair;
    touch-action: none;
}

/* Improved Back Card Design */
.card-back-header {
    text-align: center;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    margin-bottom: 8px;
    position: relative;
    z-index: 10;
}

.card-back-title {
    font-size: 9px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 2px;
    margin-bottom: 3px;
}

.card-back-id {
    font-size: 10px;
    font-weight: 500;
    color: #ffffff;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    word-break: break-all;
    line-height: 1.4;
}

/* Responsive scaling for cards - scale proportionally */
@media (max-width: 768px) {
    .profile-card {
        max-width: 100%;
        height: 220px;
    }
    
    .profiles-grid {
        grid-template-columns: 1fr;
    }
    
    .profile-id-card-container {
        min-width: 0;
        max-width: 100%;
        height: 195px; /* Keep same height as desktop */
    }
}

.profile-bio {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.profile-stats {
    display: flex;
    gap: 30px;
    padding: 0;
    border-top: none;
    border-bottom: none;
    margin: 0;
    align-items: center;
    justify-content: center;
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 20px;
    font-weight: 700;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: flex-start !important;
    padding: 0;
    position: relative;
    margin-top: -40px;
    margin-bottom: 0;
    margin-left: 20px;
    z-index: 10;
    width: auto !important;
}

.social-links a,
.social-links > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 0;
    cursor: pointer;
    padding: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    border: none !important;
}

.social-links a:hover,
.social-links > div:hover {
    transform: translateY(-4px);
    background: transparent !important;
}

.social-links a svg {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), filter 0.3s ease;
    width: 44px;
    height: 44px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

.social-links a:hover svg {
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6)) brightness(1.1);
    transform: scale(1.15);
}

.custom-social-link {
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent !important;
    border-radius: 0 !important;
    padding: 0 !important;
    border: none !important;
}

.custom-social-link:hover {
    transform: translateY(-4px);
    background: transparent !important;
}

.custom-social-link img {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), filter 0.3s ease;
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 8px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

.custom-social-link:hover img {
    transform: scale(1.15);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6)) brightness(1.1);
}

.stream {
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    position: relative;
    margin-top: 20px;
    border-radius: 8px;
    overflow: hidden;
}

.stream iframe {
    position: absolute;
    width: 100%;
    height: 100%;
}

/* Browse Page Styles */
.browse-wrapper {
    display: flex;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.browse-container {
    flex: 1;
    min-width: 0; /* Allow flex shrinking */
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.browse-header {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-subtle);
    letter-spacing: -0.02em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.refresh-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.refresh-btn:hover {
    background: var(--bg-secondary);
    color: var(--text);
    border-color: var(--border);
    transform: rotate(90deg);
}

.refresh-btn:active {
    transform: rotate(90deg) scale(0.95);
}

.refresh-btn.refreshing {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.search-container {
    margin-bottom: 24px;
}

.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 14px 48px 14px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    font-size: 15px;
    color: var(--text-primary);
    font-family: 'Sora', sans-serif;
    transition: all 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-subtle);
    background: var(--bg-tertiary);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.profiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    max-width: 1200px;
    margin: 0 auto;
}

.profile-card {
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: all 0.2s ease;
    
    display: flex;
    flex-direction: column;
    
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    
    width: 100%;
    max-width: 320px;
    height: 195px;
    position: relative;
    justify-self: center;
}

.profile-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.2;
    z-index: 0;
}

.profile-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.profile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 1;
    position: relative;
    flex-shrink: 0;
}

.profile-card-header-title {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

.profile-card-header-id {
    font-size: 8px;
    font-weight: 600;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
}

.profile-card-body {
    display: flex;
    gap: 12px;
    padding: 12px;
    z-index: 1;
    position: relative;
    flex: 1;
    overflow: hidden;
}

.profile-card-img {
    width: 90px;
    height: 90px;
    flex-shrink: 0;
    
    border-radius: 8px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-medium);
    background-size: cover;
    background-position: center;
}

.profile-card-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px 8px;
    flex: 1;
    min-width: 0;
    align-content: start;
}

.profile-card-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.profile-card-field.full-width {
    grid-column: 1 / -1;
}

.profile-card-field-label {
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

/* NAME */
.profile-card-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-card-field-value {
    font-size: 10px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    max-width: 500px;
    width: 90%;
    padding: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, #18181b 0%, #27272a 100%);
    color: white;
    padding: 24px;
    text-align: center;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.02em;
}

.modal-body {
    padding: 24px;
}

select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-subtle);
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    margin-bottom: 12px;
    border-radius: 8px;
    font-family: 'Sora', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
}

select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

.close-btn {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.close-btn:hover {
    background: var(--border-strong);
    color: var(--text-primary);
}

.login-btn {
    background: var(--accent-primary);
    color: var(--text-black);
}

input[type="color"] {
    cursor: pointer;
    border-radius: 6px;
}

/* Profile description styling */
.profile-description {
    margin: 60px 0 16px 0;
    padding: 40px 24px 24px 24px;
    background: var(--bg-secondary);
    font-size: 14px;
    line-height: 1.7;
    border-radius: 5px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
    position: relative;
    min-height: 80px;
}

/* Custom social link items */
.custom-social-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    font-size: 13px;
    position: relative;
    max-width: 300px;
}

.custom-social-item img {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    object-fit: contain;
    flex-shrink: 0;
}

.custom-social-item-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.custom-social-item-remove {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--error);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0;
    transition: all 0.2s;
}

.custom-social-item-remove:hover {
    background: #c73030;
    transform: scale(1.1);
}

.add-custom-social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px 15px;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-medium);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s;
    min-height: 44px;
}

.add-custom-social-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }
    
    .nav {
        padding: 12px 16px;
        margin-bottom: 16px;
    }
    
    .nav-title {
        font-size: 18px;
    }
    
    .browse-header {
        font-size: 24px;
    }
    
    .profile-name {
        font-size: 24px;
    }
    
    /* Hide What's New sidebar on mobile */
    .whats-new-sidebar {
        display: none !important;
    }
    
    .browse-wrapper {
        flex-direction: column;
    }
    
    /* Mobile adjustments for overlapping design */
    .profile-description {
        margin-top: 50px;
        padding: 36px 20px 20px 20px;
    }
    
    .social-links {
        margin-top: -36px;
        margin-left: 16px;
        gap: 10px;
        justify-content: flex-start !important;
    }
    
    .social-links a svg,
    .custom-social-link img {
        width: 40px;
        height: 40px;
    }
}

/* ==================== WHAT'S NEW SIDEBAR ==================== */
.whats-new-sidebar {
    width: 320px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    max-height: calc(50vh - 120px);
    position: sticky;
    top: 20px;
}

.whats-new-header {
    padding: 20px 20px 16px 20px;
    background: linear-gradient(135deg, #18181b 0%, #27272a 100%);
    color: white;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
    border-radius: 12px 12px 0 0;
    border-bottom: 1px solid var(--border-subtle);
}

.whats-new-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    font-size: 14px;
    line-height: 1.7;
}

.whats-new-content::-webkit-scrollbar {
    width: 6px;
}

.whats-new-content::-webkit-scrollbar-track {
    background: transparent;
}

.whats-new-content::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}

.whats-new-content::-webkit-scrollbar-thumb:hover {
    background: var(--border-strong);
}

.whats-new-content h2 {
    font-size: 15px;
    font-weight: 700;
    margin: 20px 0 10px 0;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.whats-new-content h2:first-child {
    margin-top: 0;
}

.whats-new-content h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 16px 0 8px 0;
    color: var(--text-secondary);
}

.whats-new-content p {
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

.whats-new-content ul {
    margin: 10px 0 16px 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

.whats-new-content li {
    margin-bottom: 6px;
    line-height: 1.6;
}

.whats-new-content code {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--accent-primary);
    font-family: 'Courier New', monospace;
}

.whats-new-content a {
    color: var(--accent-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.whats-new-content a:hover {
    border-bottom-color: var(--accent-primary);
}

.whats-new-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.whats-new-content hr {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 20px 0;
}

/* Hide on tablets and smaller */
@media (max-width: 1200px) {
    .whats-new-sidebar {
        display: none;
    }
    
    .browse-wrapper {
        max-width: 1200px;
    }
}

/* Custom social links display */
#customSocialLinksDisplay {
    display: contents;
}

/* Ensure icons stay above description box */
.social-links > * {
    position: relative;
    z-index: 10;
}
