:root {
    --bg: #0a0a0f;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.08);
    --text: #f4f4f5;
    --text-muted: #a1a1aa;
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.35);
    --success: #22c55e;
    --error: #ef4444;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --font: "Inter", system-ui, -apple-system, sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

.bg-gradient {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.25), transparent),
        radial-gradient(ellipse 60% 40% at 100% 50%, rgba(168, 85, 247, 0.12), transparent),
        radial-gradient(ellipse 50% 30% at 0% 80%, rgba(59, 130, 246, 0.1), transparent);
    pointer-events: none;
    z-index: 0;
}

.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at center, black 20%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    background: rgba(10, 10, 15, 0.7);
    border-bottom: 1px solid var(--border);
}

.header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 1.25rem;
}

.logo__icon {
    font-size: 1.5rem;
}

.nav {
    display: flex;
    gap: 8px;
}

.nav__link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s, background 0.2s;
}

.nav__link:hover {
    color: var(--text);
    background: var(--bg-card);
}

/* Hero */
.hero {
    position: relative;
    z-index: 1;
    padding: 80px 0 60px;
    text-align: center;
}

.hero__badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--accent-light);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 24px;
}

.hero__title {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 20px;
}

.hero__accent {
    background: linear-gradient(135deg, var(--accent-light), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero__subtitle {
    max-width: 560px;
    margin: 0 auto 48px;
    color: var(--text-muted);
    font-size: 1.125rem;
}

.stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 32px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(10px);
    min-width: 140px;
}

.stat-card__value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.stat-card__label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Alerts */
.alerts {
    position: relative;
    z-index: 1;
    margin-bottom: 24px;
}

.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    margin-bottom: 8px;
}

.alert--success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.alert--error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* Sections */
.upload-section,
.gallery-section {
    position: relative;
    z-index: 1;
    padding: 60px 0;
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

/* Upload */
.upload-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 640px;
    margin: 0 auto;
}

.dropzone {
    position: relative;
    padding: 48px 32px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.dropzone:hover,
.dropzone--active {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.06);
    box-shadow: 0 0 40px var(--accent-glow);
}

.dropzone__icon {
    color: var(--accent-light);
    margin-bottom: 16px;
}

.dropzone__title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.dropzone__hint {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.dropzone__formats {
    margin-top: 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.dropzone__preview {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.dropzone__preview img {
    max-width: 200px;
    max-height: 160px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    box-shadow: var(--shadow);
}

.dropzone__preview span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
}

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

.btn--primary {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: white;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn--primary:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

.btn--ghost {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn--ghost:hover {
    background: rgba(255, 255, 255, 0.18);
}

.btn--danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn--danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn--sm {
    padding: 8px 14px;
    font-size: 0.8rem;
}

/* Gallery */
.gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.gallery-count {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.photo-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.photo-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: rgba(99, 102, 241, 0.3);
}

.photo-card__image-wrap {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
}

.photo-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.photo-card:hover .photo-card__image {
    transform: scale(1.05);
}

.photo-card__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.2s;
}

.photo-card:hover .photo-card__overlay {
    opacity: 1;
}

.photo-card__info {
    padding: 16px;
}

.photo-card__name {
    display: block;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 8px;
}

.photo-card__meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.photo-card__delete {
    margin: 0;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 80px 24px;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.empty-state__icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* Footer */
.footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--border);
    padding: 32px 0;
    margin-top: 40px;
}

.footer__inner {
    text-align: center;
}

.footer__muted {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 4px;
}

/* Toast for copy */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 24px;
    background: var(--success);
    color: white;
    border-radius: var(--radius-sm);
    font-weight: 500;
    box-shadow: var(--shadow);
    z-index: 1000;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2s forwards;
}

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

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

/* Responsive */
@media (max-width: 640px) {
    .hero {
        padding: 48px 0 40px;
    }

    .stats {
        flex-direction: column;
        align-items: stretch;
    }

    .stat-card {
        flex-direction: row;
        justify-content: space-between;
        padding: 16px 20px;
    }

    .gallery-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .photo-card__overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent 60%);
        align-items: flex-end;
        padding-bottom: 12px;
    }

    .nav {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .admin-table-wrap {
        overflow-x: auto;
    }
}

/* Auth */
.auth-section {
    position: relative;
    z-index: 1;
    padding: 48px 0 80px;
}

.auth-container {
    max-width: 440px;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    backdrop-filter: blur(10px);
}

.auth-card--wide {
    max-width: 520px;
    margin: 0 auto;
}

.auth-card__title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-card__subtitle {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.auth-card__footer {
    margin-top: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-card__footer a {
    color: var(--accent-light);
    text-decoration: none;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-group input {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
}

.btn--full {
    width: 100%;
}

.hero__actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

.nav__user {
    color: var(--accent-light);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 12px;
}

.nav__link--accent {
    color: var(--accent-light);
    border: 1px solid rgba(99, 102, 241, 0.4);
}

.nav__link--admin {
    color: #fbbf24;
}

.photo-card__owner {
    font-size: 0.75rem;
    color: var(--accent-light);
    margin-bottom: 8px;
}

/* Page header */
.page-header {
    position: relative;
    z-index: 1;
    padding: 48px 0 24px;
}

.page-header--admin .page-header__title {
    color: #fbbf24;
}

.page-header__title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.page-header__subtitle {
    color: var(--text-muted);
}

.page-header__actions {
    margin-top: 16px;
}

.stats-bar {
    position: relative;
    z-index: 1;
    padding-bottom: 24px;
}

.profile-info {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.profile-info__row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.9rem;
}

.profile-info__row span {
    color: var(--text-muted);
}

/* Admin */
.admin-section {
    position: relative;
    z-index: 1;
    padding-bottom: 80px;
}

.admin-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.admin-nav__link {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--bg-card);
    transition: all 0.2s;
}

.admin-nav__link:hover,
.admin-nav__link--active {
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.4);
    background: rgba(251, 191, 36, 0.08);
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card--admin {
    border-color: rgba(251, 191, 36, 0.2);
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.admin-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.admin-panel__title {
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.admin-table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.admin-table th,
.admin-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    color: var(--text-muted);
    font-weight: 500;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.admin-mini-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.admin-mini-gallery__item {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.admin-mini-gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-empty,
.text-muted {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.badge--admin {
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.4);
}

.badge--success {
    color: #86efac;
    border-color: rgba(34, 197, 94, 0.3);
}

.badge--danger {
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

/* Folders */
.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.folder-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: transform 0.2s, border-color 0.2s;
}

.folder-card:hover {
    transform: translateY(-3px);
    border-color: rgba(99, 102, 241, 0.35);
}

.folder-card--shared {
    border-color: rgba(34, 197, 94, 0.2);
}

.folder-card__icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.folder-card__title {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.folder-card__meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.folder-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.folder-create {
    margin-bottom: 32px;
}

.folder-create__form {
    max-width: 520px;
}

.folder-share-url {
    word-break: break-all;
    font-size: 0.85rem;
    color: var(--accent-light);
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-sm);
}

.folder-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 12px;
}

.form-select {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
}

.admin-panel--danger {
    border-color: rgba(239, 68, 68, 0.25);
}

.form-inline-input {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.85rem;
    margin-right: 6px;
    margin-bottom: 6px;
}

.form-inline-input--sm {
    width: 90px;
}

.form-select--sm {
    padding: 6px 10px;
    font-size: 0.8rem;
    min-width: 120px;
}

.group-edit-form,
.group-assign-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.quota-bar-wrap {
    margin-top: 20px;
    max-width: 520px;
}

.quota-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.quota-bar__header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.quota-bar__track {
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.quota-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 999px;
    transition: width 0.3s;
}

.quota-bar__fill--warn {
    background: linear-gradient(90deg, #ef4444, #f97316);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.settings-form .admin-panel {
    margin-bottom: 0;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.quota-bar__limits {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.quota-bar__track--sm {
    height: 6px;
    margin-top: 8px;
}

.form-hint {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.form-hint--warn {
    color: #f97316;
}

.ad-banners {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 24px 0;
}

.ad-banners--main,
.ad-banners--cabinet {
    padding-top: 0;
}

.ad-banners--footer {
    padding-bottom: 0;
}

.ad-banner {
    width: min(100%, 728px);
}

.ad-banner__link {
    display: block;
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ad-banner__link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.ad-banner__img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.banner-preview {
    display: flex;
    align-items: center;
    gap: 12px;
}

.banner-preview__img {
    width: 120px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.banner-edit-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.banner-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.form-checkbox--inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.badge--muted {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

.admin-table--groups td {
    vertical-align: top;
}
