/* List of Links (LoL) - Admin Styles */

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

:root {
    --bg: #0f0f13;
    --bg-surface: #1a1a23;
    --bg-hover: #22222e;
    --bg-input: #15151d;
    --border: #2a2a3a;
    --text: #e4e4ed;
    --text-muted: #8888a0;
    --primary: #6366f1;
    --primary-hover: #5558e6;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #22c55e;
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ─── Auth Views (Setup & Login) ─────────────────────────── */
.auth-view {
    display: none;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
}

.auth-view.active {
    display: flex;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    text-align: center;
}

.auth-logo {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: -0.3px;
    margin-bottom: 24px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.auth-card h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

.auth-form {
    text-align: left;
}

.auth-form .form-group {
    margin-bottom: 16px;
}

.auth-form .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-muted);
}

.auth-form .form-group input {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.15s ease;
}

.auth-form .form-group input:focus {
    border-color: var(--primary);
}

.auth-error {
    margin-top: 12px;
    font-size: 13px;
    color: var(--danger);
    text-align: center;
    min-height: 20px;
}

.auth-back-link {
    display: inline-block;
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s ease;
}

.auth-back-link:hover {
    color: var(--text);
}

/* ─── Admin View ─────────────────────────────────────────── */
.admin-view {
    display: none;
}

.admin-view.active {
    display: block;
}

/* Header */
.header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--bg-hover);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* Main */
.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* Views */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}

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

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.btn-small {
    padding: 4px 10px;
    font-size: 12px;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

/* ─── Page Grid ──────────────────────────────────────────── */
.page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.page-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: border-color 0.15s ease;
}

.page-card:hover {
    border-color: var(--primary);
}

.page-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.page-card-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-hover);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 20px;
}

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

.page-card-info {
    flex: 1;
    min-width: 0;
}

.page-card-title {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-card-slug {
    font-size: 12px;
    color: var(--text-muted);
}

.page-card-bio {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.page-card-actions {
    display: flex;
    gap: 8px;
}

.page-card-actions .btn {
    flex: 1;
    justify-content: center;
}

/* ─── Empty State ────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 80px 24px;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h2 {
    font-size: 20px;
    margin-bottom: 8px;
}

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

/* ─── Editor Layout ──────────────────────────────────────── */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    align-items: start;
}

.editor-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.editor-header h2 {
    flex: 1;
    font-size: 18px;
}

/* ─── Form ───────────────────────────────────────────────── */
.form-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    background: var(--bg-surface);
}

.form-section legend {
    font-size: 14px;
    font-weight: 600;
    padding: 0 8px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-muted);
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.15s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary);
}

.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Color Input */
.color-input {
    display: flex;
    gap: 8px;
    align-items: center;
}

.color-input input[type="color"] {
    width: 40px;
    height: 38px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    cursor: pointer;
}

.color-input input[type="text"] {
    flex: 1;
}

/* Avatar Input */
.avatar-input {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.avatar-preview {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-hover);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border);
}

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

.avatar-placeholder {
    font-size: 24px;
    color: var(--text-muted);
}

.avatar-controls {
    flex: 1;
}

.avatar-upload-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.text-muted {
    color: var(--text-muted);
    font-size: 12px;
}

.upload-label {
    cursor: pointer;
}

/* ─── Links Editor ───────────────────────────────────────── */
.link-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    position: relative;
}

.link-item-fields {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.link-item-fields input {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    background: var(--bg-surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
}

.link-item-fields input:focus {
    border-color: var(--primary);
}

.link-item-icon {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.link-item-icon i {
    font-size: 14px;
    color: var(--primary);
}

.link-item-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.link-item-actions button {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s ease;
}

.link-item-actions button:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.link-item-actions button.btn-remove:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

/* ─── Preview Panel ──────────────────────────────────────── */
.preview-panel {
    position: sticky;
    top: 84px;
}

.preview-frame {
    display: flex;
    justify-content: center;
}

.preview-phone {
    width: 340px;
    height: 600px;
    border-radius: 32px;
    border: 3px solid var(--border);
    overflow: hidden;
    background: var(--bg-surface);
    position: relative;
}

.preview-content {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 16px 24px;
}

.preview-content .p-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.preview-content .p-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-content .p-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
    text-align: center;
}

.preview-content .p-bio {
    font-size: 11px;
    text-align: center;
    margin-bottom: 20px;
    opacity: 0.85;
    line-height: 1.4;
}

.preview-content .p-social-icons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.preview-content .p-social-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.preview-content .p-links {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preview-content .p-link {
    display: block;
    width: 100%;
    padding: 12px 16px;
    text-decoration: none;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    transition: transform 0.15s ease;
}

.preview-content .p-link:hover {
    transform: scale(1.02);
}

/* ─── Toast ──────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: var(--success);
    color: #fff;
}

.toast.error {
    background: var(--danger);
    color: #fff;
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
    .editor-layout {
        grid-template-columns: 1fr;
    }

    .preview-panel {
        position: static;
        order: -1;
    }

    .preview-phone {
        width: 100%;
        max-width: 340px;
        margin: 0 auto;
    }
}

@media (max-width: 600px) {
    .main {
        padding: 16px;
    }

    .page-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .header-inner {
        padding: 0;
    }

    .header-actions {
        gap: 6px;
    }

    .auth-badge {
        display: none;
    }

    .auth-card {
        padding: 32px 20px;
    }
}
