/* 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 {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.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-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);
}

.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;
    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;
}

/* Style Options */
.style-options {
    display: flex;
    gap: 8px;
}

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

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

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

/* 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;
}

/* 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;
}
