/* ===========================================
   Camagru - Design System
   Dark-first modern UI inspired by reference designs
   =========================================== */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&display=swap');

/* Material Symbols */
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap');

/* ===========================================
   CSS Variables - Design Tokens
   =========================================== */
:root {
    /* Primary Colors */
    --primary: #2b8cee;
    --primary-hover: #1a7ad9;
    --primary-light: rgba(43, 140, 238, 0.1);
    --primary-glow: rgba(43, 140, 238, 0.25);

    /* Dark Mode (Default) */
    --bg: #101922;
    --bg-card: #1c2127;
    --bg-input: #111418;
    --bg-hover: #252b33;
    --bg-footer: #181c22;

    /* Borders */
    --border: #283039;
    --border-light: #3b4754;

    /* Text */
    --text: #ffffff;
    --text-secondary: #9dabb9;
    --text-muted: #637588;

    /* Semantic Colors */
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.05);
    --danger-border: rgba(239, 68, 68, 0.2);
    --warning: #f59e0b;
    --info: #3b82f6;

    /* Accent Colors */
    --orange: #f97316;
    --purple: #a855f7;

    /* Spacing */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.5);
    --shadow-primary: 0 4px 14px rgba(43, 140, 238, 0.25);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;

    /* Layout */
    --header-height: 64px;
    --container-max: 1280px;
    --container-sm: 480px;
    --container-md: 640px;
}

/* Light Mode Override */
.light {
    --bg: #f6f7f8;
    --bg-card: #ffffff;
    --bg-input: #f3f4f6;
    --bg-hover: #e5e7eb;
    --bg-footer: #f8fafc;
    --border: #e5e7eb;
    --border-light: #d1d5db;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
}

/* ===========================================
   Reset & Base
   =========================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Plus Jakarta Sans', 'Noto Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===========================================
   Typography
   =========================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 {
    font-size: 2.25rem;
    font-weight: 900;
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

p {
    color: var(--text-secondary);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===========================================
   Material Symbols (Icons)
   =========================================== */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 20px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    user-select: none;
}

.icon-sm { font-size: 16px; }
.icon-md { font-size: 20px; }
.icon-lg { font-size: 24px; }
.icon-xl { font-size: 32px; }

/* ===========================================
   Layout
   =========================================== */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 768px) {
    .container {
        padding: 0 2.5rem;
    }
}

main {
    flex: 1;
    padding: 2rem 0;
}

/* ===========================================
   Header
   =========================================== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--header-height);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
    transition: opacity var(--transition);
}

.logo:hover {
    opacity: 0.8;
    color: var(--text);
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.875rem;
    transition: color var(--transition);
}

.nav-links a:hover {
    color: var(--text);
}

.nav-links .active {
    color: var(--text);
}

.logout-form {
    display: inline;
}

/* Mobile Nav Toggle */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .nav-links.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
        padding: 1rem;
        gap: 0.5rem;
    }
}

/* ===========================================
   Footer
   =========================================== */
.footer {
    background: var(--bg-footer);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a,
.footer p {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.footer-links a:hover {
    color: var(--text-secondary);
}

/* ===========================================
   Buttons
   =========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 48px;
    padding: 0 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.015em;
    cursor: pointer;
    transition: all var(--transition);
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Primary Button */
.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
}

/* Secondary/Ghost Button */
.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

/* Danger Button */
.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Outline Button */
.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border-light);
}

.btn-outline:hover {
    background: var(--bg-hover);
}

/* Small Button */
.btn-sm {
    height: 40px;
    padding: 0 1rem;
    font-size: 0.875rem;
}

/* Icon Button */
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius);
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text);
}

/* Link Button */
.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 700;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
}

.btn-link:hover {
    text-decoration: underline;
}

/* ===========================================
   Forms
   =========================================== */
.form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
}

.form-group small {
    color: var(--text-muted);
}

/* Input Fields */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea,
select {
    width: 100%;
    height: 48px;
    padding: 0 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--text);
    transition: all var(--transition);
}

/* Input with icon wrapper - must come AFTER base input styles */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper > .material-symbols-outlined {
    position: absolute;
    left: 0.875rem;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

.input-wrapper > .material-symbols-outlined + input {
    padding-left: 2.75rem;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea {
    height: auto;
    min-height: 100px;
    padding: 0.75rem 1rem;
    resize: vertical;
}

/* Password Toggle */
.input-wrapper .password-toggle {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
}

.input-wrapper .password-toggle:hover {
    color: var(--text-secondary);
}

/* Toggle Switch */
.toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border-light);
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}

.toggle input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* Checkbox */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* ===========================================
   Cards
   =========================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background: var(--bg-footer);
    border-top: 1px solid var(--border);
}

/* ===========================================
   Alerts / Flash Messages
   =========================================== */
.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ===========================================
   Auth Pages
   =========================================== */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - var(--header-height) - 100px);
    padding: 2rem 1rem;
}

.auth-card {
    width: 100%;
    max-width: var(--container-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.auth-card-body {
    padding: 2rem;
}

@media (min-width: 640px) {
    .auth-card-body {
        padding: 2rem 2.5rem;
    }
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.auth-card .form {
    gap: 1.25rem;
}

.auth-card .btn-primary {
    width: 100%;
    margin-top: 0.5rem;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.25rem 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.social-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition);
}

.social-btn:hover {
    background: var(--bg-hover);
}

.social-btn img {
    width: 20px;
    height: 20px;
}

.auth-card-footer {
    padding: 1rem 2rem;
    background: var(--bg-footer);
    border-top: 1px solid var(--border);
    text-align: center;
}

.auth-card-footer p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.auth-links {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Password Strength Meter */
.password-strength {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.password-strength-segment {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: var(--radius-full);
    transition: background var(--transition);
}

.password-strength-segment.weak { background: var(--danger); }
.password-strength-segment.medium { background: var(--warning); }
.password-strength-segment.strong { background: var(--success); }

/* Success/Error State Cards */
.status-card {
    text-align: center;
    padding: 3rem 2rem;
}

.status-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.status-icon.success {
    background: var(--success-bg);
    color: var(--success);
}

.status-icon.error {
    background: var(--danger-bg);
    color: var(--danger);
}

.status-icon .material-symbols-outlined {
    font-size: 40px;
}

/* ===========================================
   Gallery Page
   =========================================== */
.gallery-page {
    padding: 2rem 0;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.gallery-header h1 {
    margin-bottom: 0.5rem;
}

.gallery-header p {
    max-width: 500px;
}

.gallery-sort {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gallery-sort select {
    height: 40px;
    padding: 0 2rem 0 1rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239dabb9' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Gallery Card */
.gallery-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition-slow);
}

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

.gallery-card-image {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    cursor: pointer;
}

.gallery-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s ease;
}

.gallery-card:hover .gallery-card-image img {
    transform: scale(1.05);
}

.gallery-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--transition);
}

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

.gallery-card-content {
    padding: 1rem;
}

.gallery-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.gallery-card-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.gallery-card-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.gallery-card-meta {
    flex: 1;
}

.gallery-card-username {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text);
}

.gallery-card-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.gallery-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.gallery-card-stats {
    display: flex;
    gap: 1rem;
}

.gallery-stat {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    transition: color var(--transition);
    padding: 0;
}

.gallery-stat:hover {
    color: var(--text);
}

.gallery-stat.liked {
    color: var(--danger);
}

.gallery-stat .material-symbols-outlined {
    font-size: 20px;
}

.gallery-stat span:last-child {
    font-weight: 600;
}

/* Infinite Scroll Sentinel */
.gallery-sentinel {
    height: 1px;
    width: 100%;
}

.load-more-btn {
    display: block;
    margin: 2rem auto;
}

/* Skeleton Cards */
.gallery-card-skeleton {
    pointer-events: none;
}

.gallery-card-skeleton .gallery-card-image {
    aspect-ratio: 4 / 3;
}

.gallery-card-skeleton .gallery-card-avatar {
    background: var(--bg-input);
}

.skeleton-text {
    border-radius: 4px;
}

/* ===========================================
   Image Modal
   =========================================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.modal.open {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    max-width: 1000px;
    max-height: 90vh;
    width: 100%;
    display: flex;
    overflow: hidden;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.7);
}

.modal-image {
    flex: 1;
    background: black;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 60%;
}

.modal-image img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.modal-details {
    width: 350px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border);
}

.modal-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-actions {
    padding: 1rem;
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
}

.comments-section {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.comment {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.comment:last-child {
    border-bottom: none;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
}

.comment-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.comment-username {
    font-weight: 600;
    font-size: 0.875rem;
}

.comment-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.comment-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-left: 36px;
}

.comment-form {
    padding: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.5rem;
}

.comment-form input {
    flex: 1;
    height: 40px;
}

.comment-form .btn {
    height: 40px;
}

@media (max-width: 768px) {
    .modal-content {
        flex-direction: column;
    }

    .modal-image {
        max-width: 100%;
        max-height: 50vh;
    }

    .modal-details {
        width: 100%;
    }
}

/* ===========================================
   Studio Page
   =========================================== */
.studio-page {
    padding: 2rem 0;
}

.studio-header {
    margin-bottom: 2rem;
}

.studio-header h1 {
    margin-bottom: 0.5rem;
}

.studio-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 1024px) {
    .studio-layout {
        grid-template-columns: 2fr 1fr;
    }
}

/* Editor Section */
.studio-editor {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

/* Tabs */
.studio-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.studio-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.studio-tab:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.studio-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.studio-tab .material-symbols-outlined {
    transition: transform var(--transition);
}

.studio-tab:hover .material-symbols-outlined {
    transform: scale(1.1);
}

/* Viewport */
.studio-viewport {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
}

.studio-viewport video,
.studio-viewport canvas,
.studio-viewport .preview-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sticker-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

/* Interactive sticker wrapper */
.sticker-wrapper {
    position: absolute;
    pointer-events: auto;
    cursor: move;
    transform-origin: center center;
    user-select: none;
    touch-action: none;
}

.sticker-wrapper img {
    display: block;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    pointer-events: none;
}

.sticker-wrapper.active {
    outline: 2px solid var(--primary);
    outline-offset: 4px;
}

/* Resize handles */
.sticker-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #fff;
    border: 2px solid var(--primary);
    border-radius: 50%;
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.15s;
}

.sticker-wrapper:hover .sticker-handle,
.sticker-wrapper.active .sticker-handle {
    opacity: 1;
}

.sticker-handle.nw { top: -7px; left: -7px; cursor: nwse-resize; }
.sticker-handle.ne { top: -7px; right: -7px; cursor: nesw-resize; }
.sticker-handle.sw { bottom: -7px; left: -7px; cursor: nesw-resize; }
.sticker-handle.se { bottom: -7px; right: -7px; cursor: nwse-resize; }

/* Rotate handle */
.sticker-handle.rotate {
    top: -32px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    border-color: var(--primary);
    cursor: grab;
}

.sticker-handle.rotate:active {
    cursor: grabbing;
}

.sticker-handle.rotate::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    width: 2px;
    height: 12px;
    background: var(--primary);
    transform: translateX(-50%);
}

/* Rotation indicator tooltip */
.sticker-rotation-indicator {
    position: absolute;
    top: -52px;
    left: 50%;
    transform: translateX(-50%);
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 11px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}

.sticker-wrapper.rotating .sticker-rotation-indicator {
    opacity: 1;
}

/* Live Badge */
.live-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: rgba(0, 0, 0, 0.6);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
}

.live-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Webcam Error */
.webcam-error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
}

.webcam-error .material-symbols-outlined {
    font-size: 48px;
    color: var(--text-muted);
}

/* Upload Dropzone */
.upload-dropzone {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    border: 2px dashed var(--border-light);
    border-radius: var(--radius);
    margin: 1rem;
    cursor: pointer;
    transition: all var(--transition);
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-dropzone .material-symbols-outlined {
    font-size: 48px;
    color: var(--text-muted);
}

.upload-dropzone p {
    color: var(--text-secondary);
}

.upload-dropzone input {
    display: none;
}

/* Capture Button */
.capture-controls {
    display: flex;
    justify-content: center;
    padding: 1.5rem;
}

.capture-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 4px solid var(--border-light);
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: all var(--transition);
}

.capture-btn::after {
    content: '';
    position: absolute;
    inset: 6px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 20px var(--primary-glow);
    transition: all var(--transition);
}

.capture-btn:hover::after {
    transform: scale(0.9);
}

.capture-btn:active::after {
    transform: scale(0.8);
}

.capture-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.capture-btn.capturing::after {
    animation: pulse 0.5s ease-in-out infinite;
}

/* Sticker Selection */
.sticker-section {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}

.sticker-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.sticker-section h3 {
    font-size: 1rem;
    font-weight: 600;
}

.sticker-required {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.sticker-carousel {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sticker-carousel::-webkit-scrollbar {
    display: none;
}

.sticker-item {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    overflow: hidden;
    transition: all var(--transition);
    position: relative;
}

.sticker-item:hover {
    border-color: var(--primary);
}

.sticker-item.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.sticker-item.selected::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sticker-item.selected::before {
    content: '\e5ca';
    font-family: 'Material Symbols Outlined';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    color: white;
    font-size: 14px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sticker-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0.5rem;
}

.sticker-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sticker-upload-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition);
}

.sticker-upload-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-glow);
}

.sticker-upload-btn .material-symbols-outlined {
    font-size: 18px;
}

.sticker-badge {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 2px 6px;
    background: var(--primary);
    color: white;
    border-radius: 4px;
    white-space: nowrap;
}

/* Previous Captures Sidebar */
.studio-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.captures-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 70vh;
}

.captures-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.captures-header h3 {
    font-size: 1rem;
}

.captures-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.capture-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg);
    flex-shrink: 0;
}

.capture-thumb {
    width: 100%;
    display: block;
}

.capture-thumb img {
    width: 100%;
    height: auto;
    display: block;
}

.capture-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}

.capture-item:hover .capture-info {
    opacity: 1;
}

.capture-name {
    display: none;
}

.capture-time {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.9);
}

.capture-delete {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all var(--transition);
}

.capture-item:hover .capture-delete {
    opacity: 1;
}

.capture-delete:hover {
    background: var(--danger);
    color: white;
}

.capture-delete .material-symbols-outlined {
    font-size: 16px;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    margin: 1rem;
}

.empty-state .material-symbols-outlined {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ===========================================
   Profile Page
   =========================================== */
.profile-page {
    padding: 2rem 0;
    max-width: 960px;
    margin: 0 auto;
}

.profile-header {
    margin-bottom: 2rem;
}

.profile-header h1 {
    margin-bottom: 0.5rem;
}

/* Profile Card (User Info) */
.profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 2rem;
}

.profile-user {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .profile-user {
        flex-direction: row;
        align-items: center;
    }
}

.profile-avatar {
    position: relative;
    width: 128px;
    height: 128px;
    flex-shrink: 0;
    display: block;
    cursor: pointer;
}

.profile-avatar img,
.profile-avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--border);
}

.profile-avatar-placeholder {
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
    font-weight: 700;
}

.profile-avatar-overlay {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: transform var(--transition), background var(--transition);
}

.profile-avatar-overlay .material-symbols-outlined {
    font-size: 18px;
}

.profile-avatar:hover .profile-avatar-overlay {
    transform: scale(1.1);
    background: var(--primary-hover);
}

.profile-info {
    flex: 1;
    text-align: center;
}

@media (min-width: 768px) {
    .profile-info {
        text-align: left;
    }
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.profile-email {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.profile-joined {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

@media (min-width: 768px) {
    .profile-joined {
        justify-content: flex-start;
    }
}

/* Profile Sections Grid */
.profile-sections {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .profile-sections {
        grid-template-columns: repeat(2, 1fr);
    }
}

.profile-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.profile-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.profile-section-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-section-icon.blue {
    background: var(--primary-light);
    color: var(--primary);
}

.profile-section-icon.orange {
    background: rgba(249, 115, 22, 0.1);
    color: var(--orange);
}

.profile-section-icon.purple {
    background: rgba(168, 85, 247, 0.1);
    color: var(--purple);
}

.profile-section h2 {
    font-size: 1rem;
    font-weight: 600;
}

.profile-section-body {
    padding: 1.5rem;
}

.profile-section .form {
    gap: 1rem;
}

.profile-section .btn {
    margin-top: 0.5rem;
}

/* Notification Settings */
.notification-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.notification-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.notification-item:first-child {
    padding-top: 0;
}

.notification-info h4 {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.notification-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Danger Zone */
.danger-zone {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    grid-column: 1 / -1;
}

.danger-zone .profile-section-header {
    border-bottom-color: var(--danger-border);
}

.danger-zone h2 {
    color: var(--danger);
}

.danger-zone p {
    margin-bottom: 1rem;
}

/* ===========================================
   Utilities
   =========================================== */
.hidden { display: none !important; }
.block { display: block; }
.flex { display: flex; }
.grid { display: grid; }

.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }

.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }

.text-primary { color: var(--primary); }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

.w-full { width: 100%; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Selection */
::selection {
    background: var(--primary);
    color: white;
}

/* Focus Visible */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Loading Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-input) 25%,
        var(--bg-hover) 50%,
        var(--bg-input) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
