/* OttoPage Dashboard - Fixed Layout */

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

:root {
    --bg: #030303;
    --bg-secondary: #0a0a0a;
    --bg-card: #111111;
    --bg-hover: #1a1a1a;
    --border: #222222;
    --text: #ffffff;
    --text-secondary: #888888;
    --text-muted: #555555;
    --primary: #6366f1;
    --primary-hover: #5558e3;
    --primary-soft: rgba(99, 102, 241, 0.15);
    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, 0.15);
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.15);
    --gradient: linear-gradient(135deg, #6366f1, #a855f7);
    --sidebar-width: 260px;
    --radius: 12px;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* Loading */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    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); }
}

/* App Layout */
.app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand,
.sidebar-brand:hover,
.sidebar-brand:visited,
.sidebar-brand:active {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    text-decoration: none !important;
    color: inherit;
    transition: opacity 0.2s;
}

.sidebar-brand:hover {
    opacity: 0.8;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
}

.logo-icon-img {
    width: 36px;
    height: 36px;
    max-width: 36px;
    max-height: 36px;
    flex-shrink: 0;
    object-fit: contain;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}

.nav-link:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.nav-link.active {
    background: var(--primary-soft);
    color: var(--primary);
}

/* Visual Builder Button */
.sidebar-builder-btn {
    padding: 12px;
    margin-top: auto;
}

.sidebar-builder-btn .btn {
    width: 100%;
    justify-content: center;
    gap: 8px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-hover);
    flex-shrink: 0;
}

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

.user-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.user-plan {
    font-size: 11px;
    color: var(--text-secondary);
}

.logout-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.logout-btn:hover {
    background: var(--danger-soft);
    border-color: var(--danger);
    color: var(--danger);
}

/* Main Content */
.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 24px;
    background: rgba(3, 3, 3, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

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

.mobile-menu-btn {
    display: none;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    gap: 6px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}

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

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

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

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

.btn-gradient {
    background: var(--gradient);
    color: white;
}

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

.btn-sm {
    padding: 8px 12px;
    font-size: 12px;
}

/* Sections */
.section {
    display: none;
}

.section.active {
    display: block;
}

/* Section Header */
.section-header {
    margin-bottom: 20px;
}

/* Links List */
.links-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.link-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.15s;
}

.link-card:hover {
    border-color: #333;
}

.link-card.inactive {
    opacity: 0.5;
}

.link-card.dragging {
    opacity: 0.5;
    background: var(--bg-hover);
    border-color: var(--primary);
    transform: scale(1.02);
}

.link-card[draggable="true"] {
    cursor: grab;
}

.link-card[draggable="true"]:active {
    cursor: grabbing;
}

.link-drag-handle {
    color: var(--text-muted);
    cursor: grab;
    flex-shrink: 0;
}

.link-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border-radius: 8px;
    font-size: 16px;
    flex-shrink: 0;
}

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

.link-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-url {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-stats {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-hover);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-shrink: 0;
    max-width: 80px;
}

.link-clicks-count {
    font-weight: 600;
    white-space: nowrap;
}

.link-clicks-period {
    font-size: 10px;
    opacity: 0.7;
}

.link-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.link-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--bg-hover);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.link-toggle.active {
    background: var(--success);
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: all 0.15s;
}

.link-toggle.active .toggle-thumb {
    left: 23px;
}

.link-edit-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

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

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-icon {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 20px;
    color: var(--text-muted);
}

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

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 14px;
    max-width: 300px;
}

/* Cards */
.cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

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

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

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

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

/* Form Elements */
.form-group {
    margin-bottom: 16px;
}

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

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

.input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    transition: all 0.15s;
}

.input:focus {
    outline: none;
    border-color: var(--primary);
}

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

.textarea {
    resize: vertical;
    min-height: 80px;
}

.form-value {
    font-size: 14px;
    color: var(--text-secondary);
}

.input-prefix-wrap {
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.input-prefix {
    padding: 12px 0 12px 14px;
    color: var(--text-secondary);
    font-size: 14px;
    flex-shrink: 0;
}

.input-prefix-wrap .input {
    border: none;
    padding-left: 0;
}

/* Avatar Editor */
.avatar-editor {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.avatar-large {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-hover);
    flex-shrink: 0;
}

/* Theme Grid */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.theme-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.theme-btn:hover {
    border-color: #444;
}

.theme-btn.active {
    border-color: var(--primary);
}

.theme-preview {
    width: 100%;
    height: 40px;
    border-radius: 6px;
}

.theme-btn span {
    font-size: 11px;
    color: var(--text-secondary);
}

.divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

.subsection-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
}

/* Color Grid */
.color-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.color-field label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.color-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-input-wrap input[type="color"] {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background: none;
    padding: 0;
}

.color-input-wrap input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-input-wrap input[type="color"]::-webkit-color-swatch {
    border-radius: 6px;
    border: 2px solid var(--border);
}

.color-value {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: monospace;
}

/* Social Icons Section */
.social-icons-section {
    margin-bottom: 8px;
}

.social-inputs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.social-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.social-icon-label {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border-radius: 6px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.social-input-row .input {
    flex: 1;
    font-size: 12px;
}

@media (max-width: 600px) {
    .social-inputs-grid {
        grid-template-columns: 1fr;
    }
}

/* Style Options */
.style-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.style-btn {
    width: 100%;
    height: 44px;
    padding: 0 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.style-btn .style-label {
    pointer-events: none;
}

.style-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.style-btn.active {
    box-shadow: 0 0 0 3px var(--primary);
}

/* All button style buttons use consistent brand styling */
.style-btn {
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
}

.style-btn:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.style-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Button Style Grid (new compact style) */
.button-style-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.style-btn-grid {
    padding: 10px 8px;
    font-size: 12px;
    font-weight: 600;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.style-btn-grid:hover {
    background: var(--hover);
    border-color: var(--text-muted);
    color: var(--text);
}

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

/* Button style preview */
.style-preview {
    width: 100%;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
}

/* Stats */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.stat-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    flex-shrink: 0;
}

.stat-icon.views {
    background: var(--primary-soft);
    color: var(--primary);
}

.stat-icon.clicks {
    background: var(--success-soft);
    color: var(--success);
}

.stat-icon.ctr {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.stat-content {
    min-width: 0;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    display: block;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Period Tabs */
.period-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
}

.period-tab {
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.period-tab:hover {
    border-color: #444;
}

.period-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Empty Text */
.empty-text {
    color: var(--text-muted);
    text-align: center;
    padding: 30px 20px;
    font-size: 13px;
}

.empty-text p {
    margin-bottom: 8px;
}

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

/* Plan Box */
.plan-box {
    text-align: center;
    padding: 10px 0;
}

.plan-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}

.plan-badge.free {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.plan-badge.pro {
    background: var(--gradient);
    color: white;
}

.plan-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.danger-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* Preview Panel - Desktop Only */
.preview-panel {
    display: none;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
}

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

.modal-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.modal-body {
    padding: 20px;
}

.modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.modal-actions-right {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

/* Share */
.share-url-box {
    display: flex;
    gap: 8px;
}

.share-url-box .input {
    flex: 1;
}

.share-hint {
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    animation: toastIn 0.2s ease;
    font-size: 13px;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
}

.toast-success { border-color: var(--success); }
.toast-error { border-color: var(--danger); }

.toast button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 0 0 0 8px;
}

.toast.fade-out {
    animation: toastOut 0.2s ease forwards;
}

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

/* Large Screens - Show Preview */
@media (min-width: 1200px) {
    .main {
        margin-right: 340px;
    }

    .preview-panel {
        display: flex;
        flex-direction: column;
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: 340px;
        background: var(--bg-secondary);
        border-left: 1px solid var(--border);
    }

    .preview-header {
        padding: 16px;
        border-bottom: 1px solid var(--border);
        font-size: 13px;
        font-weight: 500;
        color: var(--text-secondary);
    }

    .preview-close {
        display: none;
    }

    .preview-device {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 20px;
    }

    .preview-notch {
        width: 100px;
        height: 20px;
        background: #000;
        border-radius: 0 0 12px 12px;
        margin-bottom: -10px;
        z-index: 1;
    }

    .preview-content {
        width: 240px;
        height: 480px;
        background: #0f0f0f;
        border-radius: 28px;
        border: 3px solid #333;
        overflow: hidden;
        overflow-y: auto;
    }

    .preview-content::-webkit-scrollbar {
        display: none;
    }

    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablet */
@media (max-width: 1024px) {
    .stats-row {
        grid-template-columns: 1fr;
    }

    .theme-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        width: 260px;
        transition: left 0.3s ease;
        z-index: 200;
    }

    .sidebar.open {
        left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 199;
    }

    .sidebar.open + .sidebar-overlay {
        display: block;
    }

    .main {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .topbar {
        padding: 12px 16px;
    }

    .page-title {
        font-size: 16px;
    }

    .topbar-right .btn span {
        display: none;
    }

    .content {
        padding: 16px;
    }

    .link-card {
        flex-wrap: wrap;
        gap: 10px;
    }

    .link-drag-handle {
        display: none;
    }

    .link-info {
        flex: 1 1 calc(100% - 60px);
        order: 1;
    }

    .link-icon {
        order: 0;
    }

    .link-stats {
        order: 2;
    }

    .link-actions {
        order: 3;
        margin-left: auto;
    }

    .stats-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 18px;
    }

    .theme-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .style-options {
        flex-direction: column;
    }

    .modal-content {
        max-width: 100%;
        margin: 10px;
    }

    .toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }
}

/* Extra small */
@media (max-width: 400px) {
    .topbar-right .btn {
        padding: 8px 10px;
    }

    .period-tabs {
        flex-wrap: wrap;
    }
}

/* ============================================
   PRO FEATURES & LOCKED STATES
   ============================================ */

/* Section header with limit display */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.section-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Link limit display */
.link-limit-display {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
}

.link-limit-display .limit-text {
    color: var(--text-secondary);
}

.link-limit-display .limit-warning {
    color: var(--warning);
    font-weight: 600;
}

/* At limit state for add button */
.btn.at-limit {
    background: var(--bg-hover);
    color: var(--text-muted);
    cursor: not-allowed;
}

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

/* Pro badge on buttons */
.pro-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--gradient);
    color: white;
    font-size: 8px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.pro-badge-small {
    display: inline-block;
    background: var(--gradient);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    margin-left: 8px;
}

/* Locked theme button */
.theme-btn {
    position: relative;
    overflow: hidden;
}

.theme-btn.locked {
    cursor: not-allowed;
}

.theme-btn.locked:hover {
    border-color: var(--border);
}

.theme-btn.locked .theme-preview {
    filter: grayscale(60%);
    opacity: 0.5;
}

/* Theme PRO badge overlay - more visible */
.theme-pro-badge {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.theme-pro-badge span {
    background: var(--gradient);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 4px;
    letter-spacing: 1px;
}

/* Locked period tab */
.period-tab.locked {
    opacity: 0.6;
    cursor: not-allowed;
    position: relative;
}

.period-tab.locked:hover {
    border-color: var(--border);
    background: var(--bg-card);
}

.period-tab .pro-badge {
    position: static;
    margin-left: 6px;
    font-size: 8px;
    padding: 2px 4px;
}

/* Pro feature section (custom colors) */
.pro-feature-section {
    position: relative;
}

.pro-feature-header {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.pro-feature-header .subsection-title {
    margin-bottom: 0;
}

.pro-feature-overlay {
    display: none;
}

.pro-feature-section.pro-locked {
    position: relative;
}

.pro-feature-section.pro-locked .color-grid {
    opacity: 0.4;
    pointer-events: none;
    filter: blur(1px);
}

.pro-feature-section.pro-locked .pro-feature-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    inset: 0;
    top: 30px;
    z-index: 5;
}

.pro-feature-section.pro-locked .pro-feature-overlay span {
    background: var(--gradient);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

/* Hide pro badge in section header when pro */
body.is-pro .pro-badge-small {
    display: none;
}

body.is-pro .pro-feature-section.pro-locked .color-grid {
    opacity: 1;
    pointer-events: auto;
    filter: none;
}

body.is-pro .pro-feature-section.pro-locked .pro-feature-overlay {
    display: none;
}

/* Upgrade Modal Styles */
.upgrade-modal .modal-header {
    border-bottom: none;
    padding-bottom: 0;
}

.upgrade-modal-body {
    text-align: center;
    padding: 10px 24px 24px;
}

.upgrade-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.upgrade-modal-body > p {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 20px;
}

.upgrade-features {
    list-style: none;
    text-align: left;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg);
    border-radius: 10px;
}

.upgrade-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 14px;
}

.upgrade-features li svg {
    color: var(--success);
    flex-shrink: 0;
}

.btn-large {
    width: 100%;
    padding: 14px 24px;
    font-size: 15px;
}

/* User plan badge in sidebar */
.user-plan {
    font-size: 11px;
    color: var(--text-secondary);
}

body.is-pro .user-plan {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
}

/* Hide upgrade prompts for pro users */
body.is-pro #freePlan {
    display: none !important;
}

body.is-pro #proPlan {
    display: block !important;
}

/* ============================================
   TOP LINKS ANALYTICS
   ============================================ */

.top-links-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.top-link-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: all 0.15s;
}

.top-link-item:hover {
    border-color: #333;
}

.top-link-rank {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 30px;
    flex-shrink: 0;
}

.top-link-item:nth-child(1) .top-link-rank {
    color: #fbbf24;
}

.top-link-item:nth-child(2) .top-link-rank {
    color: #94a3b8;
}

.top-link-item:nth-child(3) .top-link-rank {
    color: #d97706;
}

.top-link-content {
    flex: 1;
    min-width: 0;
}

.top-link-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-link-numbers {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
}

.top-link-clicks-wrap {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.top-link-clicks {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.top-link-clicks-label {
    font-size: 11px;
    color: var(--text-muted);
}

.top-link-ctr {
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-hover);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Responsive top links */
@media (max-width: 500px) {
    .top-link-item {
        flex-wrap: wrap;
        gap: 8px;
    }

    .top-link-content {
        flex: 1 1 calc(100% - 100px);
    }

    .top-link-clicks {
        font-size: 16px;
    }
}

/* ============================================
   APPEARANCE SAVE BAR
   ============================================ */

.appearance-save-bar {
    position: fixed;
    bottom: -80px;
    left: var(--sidebar-width);
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    z-index: 100;
    transition: bottom 0.3s ease;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
}

.appearance-save-bar.visible {
    bottom: 0;
}

.save-bar-message {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--warning);
    font-size: 14px;
    font-weight: 500;
}

.save-bar-message svg {
    flex-shrink: 0;
}

.save-bar-actions {
    display: flex;
    gap: 10px;
}

.btn-discard {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

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

@media (min-width: 1200px) {
    .appearance-save-bar {
        right: 340px;
    }
}

@media (max-width: 768px) {
    .appearance-save-bar {
        left: 0;
        padding: 12px 16px;
    }

    .save-bar-message span {
        display: none;
    }
}

/* Disabled color inputs */
input[type="color"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   FONT SELECT
   ============================================ */
.font-select {
    font-size: 14px;
    cursor: pointer;
}

.font-select optgroup {
    font-weight: 600;
    color: var(--text-secondary);
    font-style: normal;
}

.font-select option {
    padding: 8px;
}

.font-select option[data-pro="true"]:not(.unlocked)::after {
    content: " (PRO)";
    color: var(--primary);
}

/* ============================================
   ANIMATION GRID
   ============================================ */
.animation-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.anim-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.anim-btn:hover {
    border-color: #444;
}

.anim-btn.active {
    border-color: var(--primary);
}

.anim-btn span {
    font-size: 11px;
    color: var(--text-secondary);
}

.anim-preview {
    width: 100%;
    height: 40px;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

/* Animation previews */
.anim-none {
    background: var(--bg-hover);
}

.anim-particles {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
}
.anim-particles::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, #fff 1px, transparent 1px);
    background-size: 8px 8px;
    opacity: 0.3;
    animation: float-preview 2s ease-in-out infinite;
}

.anim-confetti {
    background: linear-gradient(135deg, #fdf2f8, #fce7f3);
}
.anim-confetti::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, #ff6b6b 3px, transparent 3px),
        radial-gradient(circle at 50% 50%, #feca57 3px, transparent 3px),
        radial-gradient(circle at 80% 40%, #48dbfb 3px, transparent 3px),
        radial-gradient(circle at 30% 70%, #ff9ff3 3px, transparent 3px),
        radial-gradient(circle at 70% 80%, #54a0ff 3px, transparent 3px);
    animation: confetti-preview 1.5s ease-in-out infinite;
}

.anim-stars {
    background: linear-gradient(135deg, #0a0a1a, #1a1a2e);
}
.anim-stars::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, #fff 1px, transparent 1px);
    background-size: 12px 12px;
    animation: twinkle-preview 1.5s ease-in-out infinite;
}

.anim-bubbles {
    background: linear-gradient(135deg, #0c4a6e, #0369a1);
}
.anim-bubbles::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(255,255,255,0.2) 8px, transparent 8px),
        radial-gradient(circle at 50% 60%, rgba(255,255,255,0.15) 12px, transparent 12px),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,0.1) 6px, transparent 6px);
    animation: bubble-preview 2s ease-in-out infinite;
}

.anim-aurora {
    background: linear-gradient(180deg, #0a0a1a, #1a0533);
}
.anim-aurora::before {
    content: '';
    position: absolute;
    inset: -20%;
    background: linear-gradient(180deg, transparent, #00ff8730, #60efff30, #9f7aea30, transparent);
    filter: blur(10px);
    animation: aurora-preview 3s ease-in-out infinite;
}

@keyframes float-preview {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes confetti-preview {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(2px) rotate(3deg); }
}

@keyframes twinkle-preview {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

@keyframes bubble-preview {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes aurora-preview {
    0%, 100% { transform: translateY(0) scaleY(1); }
    50% { transform: translateY(-10%) scaleY(1.1); }
}

/* Animation section locked state */
#animationSection.pro-locked .animation-grid {
    opacity: 0.4;
    pointer-events: none;
    filter: blur(1px);
}

#animationSection.pro-locked .pro-feature-overlay {
    display: flex;
}

body.is-pro #animationSection .pro-feature-overlay {
    display: none;
}

body.is-pro #animationSection.pro-locked .animation-grid {
    opacity: 1;
    pointer-events: auto;
    filter: none;
}

/* Pro button styles section */
#proButtonStyles.pro-locked .style-options {
    opacity: 0.4;
    pointer-events: none;
    filter: blur(1px);
}

#proButtonStyles.pro-locked .pro-feature-overlay {
    display: flex;
    position: absolute;
    inset: 0;
    z-index: 5;
    align-items: center;
    justify-content: center;
}

#proButtonStyles {
    position: relative;
}

body.is-pro #proButtonStyles .pro-feature-overlay {
    display: none;
}

body.is-pro #proButtonStyles.pro-locked .style-options {
    opacity: 1;
    pointer-events: auto;
    filter: none;
}

/* Hide PRO badges for pro users */
body.is-pro .theme-pro-badge {
    display: none;
}

body.is-pro .theme-btn[data-pro="true"] {
    cursor: pointer;
}

/* Responsive animation grid */
@media (max-width: 500px) {
    .animation-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Readonly inputs */
.input-prefix-wrap.readonly {
    background: var(--bg);
    opacity: 0.7;
}

.input-prefix-wrap.readonly .input {
    cursor: not-allowed;
    color: var(--text-muted);
}

/* Form hints */
.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.form-hint.warning {
    color: var(--warning);
}

/* Pro Feature Locked State */
.pro-feature-locked {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px 20px;
    background: var(--bg);
    border-radius: 12px;
    border: 1px dashed var(--border);
}

.locked-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border-radius: 50%;
    margin-bottom: 16px;
    color: var(--text-muted);
}

.locked-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.locked-desc {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 280px;
    margin-bottom: 16px;
    line-height: 1.5;
}

/* Traffic Sources PRO badge in card header */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Hide PRO badge for Pro users */
body.is-pro #trafficSourcesProBadge {
    display: none;
}

/* Hide Domain PRO badge for Pro users */
body.is-pro #domainProBadge {
    display: none;
}

/* Hide SEO PRO badge for Pro users */
body.is-pro #seoProBadge {
    display: none;
}

/* OG Image Upload Styles */
.og-image-upload {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.og-image-preview {
    width: 100%;
    aspect-ratio: 1200 / 630;
    max-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--bg);
    border: 2px dashed var(--border);
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 12px;
    overflow: hidden;
}

.og-image-preview.has-image {
    border-style: solid;
    border-color: var(--primary);
}

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

.og-image-actions {
    display: flex;
    gap: 8px;
}

/* Custom Domain Styles */
.domain-intro {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.6;
}

.domain-status {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg);
    border-radius: 12px;
    margin-bottom: 20px;
}

.domain-status-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--bg-hover);
    color: var(--text-muted);
}

.domain-status-icon.pending {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.domain-status-icon.success {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.domain-status-text {
    flex: 1;
}

.domain-name {
    display: block;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.domain-status-msg {
    font-size: 13px;
    color: var(--text-muted);
}

.domain-status-msg.pending {
    color: #fbbf24;
}

.domain-status-msg.success {
    color: #22c55e;
}

.dns-instructions {
    background: var(--bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.dns-instructions h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.dns-instructions > p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.dns-record {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}

.dns-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dns-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dns-value {
    font-size: 12px;
    font-family: monospace;
    color: var(--text);
    background: var(--bg-hover);
    padding: 4px 8px;
    border-radius: 4px;
    user-select: all;
    word-break: break-all;
    text-align: right;
    max-width: 200px;
}

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

.domain-actions {
    display: flex;
    gap: 12px;
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid var(--error);
    color: var(--error);
}

.btn-danger-outline:hover {
    background: var(--error);
    color: white;
}

/* Text Styling Controls */
.text-styling-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.text-control-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.text-control-row {
    display: flex;
    gap: 8px;
}

.text-control-row select {
    flex: 1;
}

.size-input-group {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 80px;
}

.size-input {
    width: 50px;
    text-align: center;
    padding: 8px 4px;
    -moz-appearance: textfield;
}

/* Hide number input spinners/arrows */
.size-input::-webkit-outer-spin-button,
.size-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

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

.input-sm {
    padding: 8px 10px;
    font-size: 13px;
    height: auto;
}

/* Text styling section locked state */
#textStylingSection.pro-locked .text-styling-controls {
    opacity: 0.4;
    pointer-events: none;
    filter: blur(1px);
}

#textStylingSection.pro-locked .pro-feature-overlay {
    display: flex;
}

body.is-pro #textStylingSection .pro-feature-overlay {
    display: none;
}

body.is-pro #textStylingSection.pro-locked .text-styling-controls {
    opacity: 1;
    pointer-events: auto;
    filter: none;
}

/* ============================================
   PHOTO GALLERY
   ============================================ */

.photo-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.photo-add-btn {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--bg);
    border: 2px dashed var(--border);
    border-radius: 12px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.photo-add-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.photo-add-btn span {
    font-size: 11px;
    font-weight: 500;
}

.gallery-photo {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
}

.gallery-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-photo-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    background: rgba(0,0,0,0.7);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
}

.gallery-photo:hover .gallery-photo-remove {
    opacity: 1;
}

/* Photo Gallery Pro Locked */
#photoGallerySection.pro-locked .photo-gallery-grid {
    opacity: 0.4;
    pointer-events: none;
    filter: blur(1px);
}

#photoGallerySection.pro-locked .pro-feature-overlay {
    display: flex;
}

body.is-pro #photoGallerySection .pro-feature-overlay {
    display: none;
}

body.is-pro #photoGallerySection.pro-locked .photo-gallery-grid {
    opacity: 1;
    pointer-events: auto;
    filter: none;
}

/* Featured Content Pro Locked */
#featuredContentSection.pro-locked .form-group {
    opacity: 0.4;
    pointer-events: none;
    filter: blur(1px);
}

#featuredContentSection.pro-locked .pro-feature-overlay {
    display: flex;
}

body.is-pro #featuredContentSection .pro-feature-overlay {
    display: none;
}

body.is-pro #featuredContentSection.pro-locked .form-group {
    opacity: 1;
    pointer-events: auto;
    filter: none;
}

/* ============================================
   AVATAR SHAPE OPTIONS
   ============================================ */

.avatar-shape-options {
    display: flex;
    gap: 12px;
}

.shape-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.shape-btn:hover {
    border-color: #444;
}

.shape-btn.active {
    border-color: var(--primary);
}

.shape-btn .shape-preview {
    width: 40px;
    height: 40px;
    background: var(--text-muted);
}

.shape-btn.active .shape-preview {
    background: var(--primary);
}

.shape-btn .shape-preview.circle {
    border-radius: 50%;
}

.shape-btn .shape-preview.rounded {
    border-radius: 20%;
}

.shape-btn .shape-preview.square {
    border-radius: 8px;
}

.shape-btn span {
    font-size: 11px;
    color: var(--text-secondary);
}

.shape-btn.active span {
    color: var(--primary);
}

/* ============================================
   ANIMATION COLOR PICKER
   ============================================ */

.anim-color-picker {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg);
    border-radius: 10px;
}

.anim-color-picker label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.anim-color-picker .form-hint {
    margin-top: 8px;
}

/* Animation Controls (speed, count, size) */
.animation-controls {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.anim-control-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.anim-control-row:last-child {
    margin-bottom: 0;
}

.anim-control-row label {
    width: 60px;
    font-size: 13px;
    color: var(--text-secondary);
}

.slider-with-value {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.slider-with-value .range-input {
    flex: 1;
}

.slider-value {
    width: 40px;
    text-align: right;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

/* ============================================
   BACKGROUND IMAGE
   ============================================ */

.bg-image-preview {
    width: 100%;
    height: 120px;
    background: var(--bg);
    border: 2px dashed var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.bg-image-preview:hover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.bg-image-preview span {
    color: var(--text-muted);
    font-size: 13px;
}

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

.bg-image-actions {
    display: flex;
    gap: 8px;
}

.range-input {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    background: var(--bg-hover);
    border-radius: 3px;
    outline: none;
}

.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
}

.range-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Background Image Pro Locked */
#backgroundImageSection.pro-locked .bg-image-preview,
#backgroundImageSection.pro-locked .form-group {
    opacity: 0.4;
    pointer-events: none;
    filter: blur(1px);
}

#backgroundImageSection.pro-locked .pro-feature-overlay {
    display: flex;
}

body.is-pro #backgroundImageSection .pro-feature-overlay {
    display: none;
}

body.is-pro #backgroundImageSection.pro-locked .bg-image-preview,
body.is-pro #backgroundImageSection.pro-locked .form-group {
    opacity: 1;
    pointer-events: auto;
    filter: none;
}

/* ============================================
   PHOTO EDITOR MODAL
   ============================================ */

.photo-editor-content {
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.photo-editor-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.photo-editor-canvas-wrap {
    position: relative;
    width: 100%;
    max-height: 250px;
    background: var(--bg);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#photoEditorCanvas {
    max-width: 100%;
    max-height: 250px;
    object-fit: contain;
}

.crop-overlay {
    position: absolute;
    border: 2px dashed var(--primary);
    pointer-events: none;
    display: none;
}

.photo-editor-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
}

.tool-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.tool-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tool-buttons {
    display: flex;
    gap: 4px;
}

.tool-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
    font-weight: 600;
}

.tool-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.tool-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.photo-editor-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.photo-editor-actions {
    display: flex;
    gap: 8px;
}

.btn-danger-outline {
    color: #ef4444;
    border-color: #ef4444;
    background: transparent;
}

.btn-danger-outline:hover {
    background: #ef444420;
}

/* Gallery photo edit button */
.gallery-photo {
    position: relative;
    cursor: pointer;
}

.gallery-photo:hover .gallery-photo-edit {
    opacity: 1;
}

.gallery-photo-edit {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 8px;
    color: white;
    font-size: 12px;
    font-weight: 500;
}

/* ============================================
   HEADER & DIVIDER CARDS
   ============================================ */

.header-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
}

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

.header-card .header-content {
    flex: 1;
    min-width: 0;
}

.header-card .header-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.header-card .type-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-card .header-actions {
    display: flex;
    gap: 6px;
}

.divider-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.divider-card .divider-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border-radius: 6px;
    color: var(--text-muted);
}

.divider-card .divider-line-preview {
    flex: 1;
    height: 1px;
    background: var(--border);
}

.divider-card .type-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.divider-card .divider-actions {
    display: flex;
    gap: 6px;
}

/* ============================================
   LINK SCHEDULING (PRO)
   ============================================ */

.scheduling-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    position: relative;
}

.scheduling-section .pro-feature-header {
    margin-bottom: 12px;
}

.scheduling-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 500px) {
    .scheduling-inputs {
        grid-template-columns: 1fr;
    }
}

.scheduling-section.pro-locked .scheduling-inputs {
    opacity: 0.4;
    pointer-events: none;
    filter: blur(1px);
}

.scheduling-section.pro-locked .pro-feature-overlay {
    display: flex;
}

body.is-pro .scheduling-section .pro-feature-overlay {
    display: none;
}

body.is-pro .scheduling-section.pro-locked .scheduling-inputs {
    opacity: 1;
    pointer-events: auto;
    filter: none;
}

body.is-pro #scheduleProBadge {
    display: none;
}

/* Scheduled link indicator in link card */
.link-scheduled-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    background: rgba(245, 158, 11, 0.15);
    border-radius: 4px;
    font-size: 10px;
    color: var(--warning);
    margin-left: 8px;
}

.link-scheduled-badge svg {
    width: 12px;
    height: 12px;
}

/* ============================================
   ANALYTICS BREAKDOWN (Device/Country)
   ============================================ */

.analytics-breakdown {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.breakdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.breakdown-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border-radius: 8px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

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

.breakdown-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.breakdown-bar {
    height: 4px;
    background: var(--bg-hover);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.breakdown-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.breakdown-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    flex-shrink: 0;
}

.breakdown-percent {
    font-size: 11px;
    color: var(--text-muted);
}

/* Hide PRO badges for Pro users */
body.is-pro #devicesProBadge,
body.is-pro #countriesProBadge {
    display: none;
}
