/* ============================================================
   Глобальные стили
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0A0F27;
    color: #ffffff;
    min-height: 100vh;
}

/* ============================================================
   Главная страница
   ============================================================ */

.main-page {
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

.bg-gradient {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.container {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 48px 16px;
    max-width: 520px;
    margin: 0 auto;
}

/* Avatar */
.section-avatar {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 24px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    opacity: 0;
    animation: fadeIn 0.6s ease-out forwards;
}

.section-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #3B82F6, #9333EA);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
}

/* Name */
.user-name {
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 16px;
    opacity: 0;
    animation: fadeIn 0.6s ease-out forwards;
}

/* Bio */
.user-bio {
    margin-bottom: 24px;
    opacity: 0;
    animation: fadeIn 0.6s ease-out forwards;
    line-height: 1.5;
    max-width: 400px;
}

/* Links */
.links-list {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.link-card {
    display: block;
    width: 100%;
    padding: 16px;
    text-decoration: none;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.link-card:hover {
    transform: scale(1.03);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

.link-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.link-icon { font-size: 24px; }

.link-image {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}

.link-title { flex: 1; text-align: center; }

.link-desc {
    font-size: 13px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: center;
}

.link-arrow {
    width: 20px;
    height: 20px;
    opacity: 0;
    transition: opacity 0.3s;
}

.link-card:hover .link-arrow { opacity: 1; }

/* Text section */
.section-text { margin-bottom: 16px; }
.section-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
}
.section-body {
    font-size: 15px;
    line-height: 1.6;
}

/* Social section */
.section-social {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.social-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0.7;
    transition: all 0.3s;
}

.social-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

.social-icon svg {
    width: 28px;
    height: 28px;
}

/* Image section */
.section-image {
    width: 100%;
    max-width: 480px;
    margin-bottom: 16px;
}

.section-image img {
    width: 100%;
    border-radius: 12px;
}

.image-caption {
    font-size: 13px;
    opacity: 0.7;
    text-align: center;
    margin-top: 8px;
}

/* Divider */
.section-divider {
    width: 100%;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 16px 0;
}

/* Button section */
.section-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    text-decoration: none;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s;
    border-radius: 12px;
}

.section-button:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* Video section */
.section-video {
    width: 100%;
    max-width: 480px;
    margin-bottom: 16px;
}

/* No content */
.empty-state {
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    padding: 40px 0;
}

/* ============================================================
   Анимации
   ============================================================ */

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

.animate-fade-in {
    opacity: 0;
    animation: fadeIn 0.6s ease-out forwards;
}

/* ============================================================
   Login
   ============================================================ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0A0F27;
    padding: 16px;
}

.login-card {
    width: 100%;
    max-width: 448px;
    padding: 32px;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 32px;
}

.login-form { display: flex; flex-direction: column; gap: 24px; }

.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-size: 14px; font-weight: 500; color: #d1d5db; }
.form-group input, .form-group textarea, .form-group select {
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #4b5563;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 16px;
    outline: none;
    font-family: inherit;
}
.form-group input:focus, .form-group textarea:focus {
    border-color: #3B82F6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}
.form-group input::placeholder, .form-group textarea::placeholder { color: #9ca3af; }

.btn-login {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    color: white;
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #3B82F6, #9333EA);
    transition: all 0.3s;
}
.btn-login:hover { background: linear-gradient(135deg, #2563eb, #7c3aed); }

.alert { padding: 12px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.alert-success { background: rgba(34, 197, 94, 0.2); color: #86efac; }

/* ============================================================
   Admin
   ============================================================ */

.admin-page {
    min-height: 100vh;
    background: #0A0F27;
    padding: 16px;
}
@media (min-width: 768px) { .admin-page { padding: 32px; } }

.admin-container { max-width: 960px; margin: 0 auto; }

/* Header */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.admin-header h1 { font-size: 24px; font-weight: 700; }
.header-actions { display: flex; gap: 8px; }

.btn-preview {
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    text-decoration: none;
    font-size: 14px;
}
.btn-logout {
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    text-decoration: none;
    font-size: 14px;
}

/* Tabs */
.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 4px;
}
.tab-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: none;
    color: #9ca3af;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}
.tab-btn.active { background: rgba(255, 255, 255, 0.1); color: white; }
.tab-btn:hover:not(.active) { color: white; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Section panel */
.section-panel, .design-panel, .profile-panel {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 24px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.panel-header h2 { font-size: 18px; }

.btn-add-block {
    padding: 8px 16px;
    border-radius: 8px;
    background: linear-gradient(135deg, #3B82F6, #9333EA);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

/* Section item */
.sections-list { display: flex; flex-direction: column; gap: 8px; }

.section-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    transition: background 0.2s;
}
.section-item:hover { background: rgba(255, 255, 255, 0.06); }

.drag-handle {
    cursor: grab;
    color: #6b7280;
    font-size: 16px;
    user-select: none;
}

.section-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}
.section-icon { font-size: 24px; }
.section-info strong { display: block; font-size: 14px; }
.section-preview { font-size: 12px; color: #9ca3af; }

.section-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}
.section-controls button {
    padding: 6px 8px;
    border: none;
    background: none;
    color: #9ca3af;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
}
.section-controls button:hover:not(:disabled) { color: white; background: rgba(255,255,255,0.1); }
.section-controls button:disabled { opacity: 0.3; cursor: default; }
.btn-delete-section { color: #f87171 !important; }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #4b5563;
    border-radius: 22px;
    transition: 0.3s;
}
.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}
input:checked + .slider { background: #3B82F6; }
input:checked + .slider:before { transform: translateX(18px); }
.switch.small { width: 32px; height: 18px; }
.switch.small .slider:before { height: 12px; width: 12px; }
.switch.small input:checked + .slider:before { transform: translateX(14px); }

/* ============================================================
   Design panel
   ============================================================ */

.design-panel h2 { margin-bottom: 24px; font-size: 18px; }

.design-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}
@media (min-width: 640px) {
    .design-grid { grid-template-columns: 1fr 1fr; }
}

.design-group {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 16px;
}
.design-group h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #d1d5db;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.color-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.color-row label {
    flex: 1;
    font-size: 13px;
    color: #9ca3af;
}
.color-row input[type="color"] {
    width: 36px;
    height: 36px;
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    cursor: pointer;
    background: none;
    padding: 2px;
}
.color-row input[type="text"] {
    flex: 1;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid #4b5563;
    background: rgba(255,255,255,0.05);
    color: white;
    font-size: 13px;
    font-family: monospace;
}

.field-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.field-row label {
    flex: 1;
    font-size: 13px;
    color: #9ca3af;
}
.field-row input[type="range"] {
    width: 120px;
}
.field-row select {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #4b5563;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 13px;
}
.field-row span {
    font-size: 13px;
    color: #d1d5db;
    min-width: 40px;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.toggle-row label { font-size: 13px; color: #9ca3af; }

.btn-save-design {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    background: linear-gradient(135deg, #3B82F6, #9333EA);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    margin-top: 24px;
}

/* ============================================================
   Profile
   ============================================================ */

.profile-panel h2 { margin-bottom: 24px; font-size: 18px; }
.profile-form { display: flex; flex-direction: column; gap: 16px; }

.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.avatar-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    color: #9ca3af;
    font-size: 14px;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }

.btn-upload {
    padding: 8px 16px;
    border-radius: 6px;
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: none;
    cursor: pointer;
    font-size: 14px;
}
.upload-hint { font-size: 12px; color: #6b7280; }

.btn-save {
    padding: 10px 20px;
    border-radius: 8px;
    background: #16a34a;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}
.btn-save:hover { background: #15803d; }

/* ============================================================
   Modals
   ============================================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal {
    background: #1e293b;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.modal-header h3 { font-size: 18px; }
.modal-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
}
.modal-close:hover { color: white; }

.modal-body { padding: 24px; }

.block-types {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
@media (max-width: 480px) { .block-types { grid-template-columns: repeat(2, 1fr); } }

.block-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.block-type-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
}
.block-type-icon { font-size: 28px; }

/* ============================================================
   Editor overlay
   ============================================================ */

.editor-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.editor-panel {
    background: #1e293b;
    border-radius: 16px;
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.editor-header h3 { font-size: 18px; }

.editor-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}

.editor-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* Link editor */
.link-editor-item {
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.link-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}
.link-fields input {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #4b5563;
    background: rgba(255,255,255,0.05);
    color: white;
    font-size: 14px;
}

.link-editor-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-upload-link-img {
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: none;
    cursor: pointer;
    font-size: 13px;
}

.btn-delete-link {
    padding: 6px 12px;
    border-radius: 6px;
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: none;
    cursor: pointer;
    font-size: 13px;
}

.btn-add-link {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 2px dashed rgba(255,255,255,0.2);
    background: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 16px;
}
.btn-add-link:hover { border-color: #3B82F6; color: #3B82F6; }

.link-img-preview {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
}

.btn-small {
    padding: 2px 6px;
    background: none;
    border: none;
    color: #f87171;
    cursor: pointer;
    font-size: 14px;
}

.hint {
    color: #9ca3af;
    font-size: 14px;
    line-height: 1.5;
}

/* ============================================================
   Scrollbar
   ============================================================ */

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }

::selection { background-color: rgba(59, 130, 246, 0.3); color: white; }
