:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-tertiary: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #888888;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #262626;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

/* Messages */
.messages {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 90%;
    max-width: 400px;
}

.message {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    animation: slideDown 0.3s ease;
}

.message-success { background: var(--success); color: white; }
.message-error { background: var(--danger); color: white; }
.message-warning { background: var(--warning); color: black; }
.message-info { background: var(--accent); color: white; }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

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

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

.btn-secondary:hover {
    border-color: var(--accent);
}

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

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

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

.btn-full {
    width: 100%;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
}

.btn-icon {
    padding: 0.5rem;
    background: transparent;
    border: none;
    font-size: 1rem;
    cursor: pointer;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s;
}

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

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

.form-error {
    display: block;
    color: var(--danger);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.form-help {
    display: block;
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.form-checkbox {
    width: auto;
    margin-right: 0.5rem;
}

.form-group-checkbox {
    display: flex;
    align-items: center;
}

.form-group-checkbox label {
    margin-bottom: 0;
}

.inline-form {
    display: inline;
}

/* Auth Pages */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.auth-container {
    width: 100%;
    max-width: 400px;
}

.auth-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid var(--border);
}

.auth-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.auth-subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 2rem;
}

.auth-form {
    margin-bottom: 1.5rem;
}

.auth-footer {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

.auth-footer a:hover {
    text-decoration: underline;
}

/* Dashboard */
.dashboard {
    padding: 1rem;
}

.dashboard-container {
    max-width: 600px;
    margin: 0 auto;
}

.dashboard-header {
    margin-bottom: 2rem;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.header-top h1 {
    font-size: 1.5rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.stats-bar {
    display: flex;
    justify-content: space-around;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* Links Section */
.links-section {
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h2 {
    font-size: 1.25rem;
}

.slot-counter {
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 20px;
}

.slot-counter.full {
    background: var(--warning);
    color: black;
}

.add-link-btn {
    margin-bottom: 1rem;
}

.links-list {
    list-style: none;
}

.link-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

.link-item:hover {
    border-color: var(--accent);
}

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

.link-drag-handle {
    color: var(--text-secondary);
    cursor: grab;
    font-size: 1.25rem;
    line-height: 1;
}

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

.link-title {
    display: block;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.link-url {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-stats {
    text-align: right;
}

.click-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.link-actions {
    display: flex;
    gap: 0.25rem;
}

.no-links {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

/* Profile Link Section */
.profile-link-section {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.profile-link-section h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.profile-url-box {
    display: flex;
    gap: 0.5rem;
}

.profile-url-box .form-input {
    flex: 1;
    font-size: 0.875rem;
}

/* Link Form Page */
.link-form-page {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.form-container {
    width: 100%;
    max-width: 500px;
}

.form-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid var(--border);
}

.form-header {
    margin-bottom: 2rem;
}

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    display: block;
    margin-bottom: 0.5rem;
}

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

.form-header h1 {
    font-size: 1.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.form-actions .btn {
    flex: 1;
}

/* Zen Profile (Public) */
.zen-profile {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.profile-container {
    max-width: 420px;
    width: 100%;
    text-align: center;
}

.profile-header {
    margin-bottom: 2rem;
}

.username {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.links-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.link-card {
    display: block;
    padding: 1rem 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.link-card:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.profile-footer {
    margin-top: 3rem;
}

.branding {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Content container (replaces links-container) */
.content-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Media cards */
.media-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.media-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.15);
}

.image-card img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.image-card img:hover {
    transform: scale(1.02);
}

.video-card video {
    width: 100%;
    max-height: 300px;
    background: black;
}

.media-title {
    display: block;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    cursor: zoom-out;
}

.lightbox.active {
    display: flex;
}

.lightbox img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 8px;
}

/* Link type icon in dashboard */
.link-type-icon {
    font-size: 1.25rem;
    min-width: 30px;
    text-align: center;
}

/* TYGP Dashboard */
.tygp-dash-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tygp-dash-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 8px #6366f1);
}

.tygp-dash-name {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-username {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.dash-section {
    margin-bottom: 2rem;
}

.section-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 20px;
}

/* Cartridge list */
.cartridge-list,
.session-list {
    list-style: none;
}

.cartridge-item,
.session-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 0.5rem;
    transition: border-color 0.2s;
}

.cartridge-item:hover,
.session-item:hover {
    border-color: var(--accent);
}

.cartridge-item.cartridge-inactive {
    opacity: 0.5;
}

.cartridge-icon,
.session-icon {
    font-size: 1.75rem;
    flex-shrink: 0;
}

.cartridge-info,
.session-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.cartridge-title,
.session-title {
    font-weight: 600;
    font-size: 1rem;
}

.cartridge-meta,
.session-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.badge-ready {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-disabled {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-active {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-paused {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.empty-state {
    padding: 2.5rem 1rem;
    text-align: center;
    background: var(--bg-secondary);
    border: 1px dashed var(--border);
    border-radius: 12px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.75rem;
}

.empty-sub {
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* Landing Page */
.landing {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.landing-container {
    max-width: 600px;
    width: 100%;
    text-align: center;
}

.hero {
    margin-bottom: 3rem;
}

.logo {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.tagline {
    font-size: 1.25rem;
    color: var(--text-secondary);
}

.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.feature {
    padding: 1.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.feature-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.75rem;
}

.feature h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.feature p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

.cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 3rem;
}

.landing-footer {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* TYGP Landing */
.tygp-logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.tygp-logo-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 0 12px #6366f1);
}

.tygp-logo {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 60%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tygp-subtitle {
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

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

/* ========================================
   SUBTLE DOPAMINE SYSTEM
   Micro-rewards that feel good without being obvious
   ======================================== */

/* Satisfying button press - slight "push" feeling */
.btn:active {
    transform: scale(0.97);
    transition: transform 0.1s ease;
}

.btn-primary:active {
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

/* Gentle pulse on successful actions */
@keyframes subtlePulse {
    0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
    100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.link-item.just-added {
    animation: subtlePulse 0.6s ease-out;
}

/* Smooth number transitions for click counts */
.click-count {
    transition: all 0.3s ease;
}

.click-count.updated {
    color: var(--accent);
    transform: scale(1.1);
}

/* Satisfying toggle animation */
@keyframes toggleOn {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@keyframes toggleOff {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.8); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

.btn-icon:active {
    animation: toggleOn 0.2s ease;
}

/* Gentle glow on link hover - feels "alive" */
.link-item {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.link-item:hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.1);
    transform: translateX(4px);
}

/* Copy button satisfaction */
@keyframes copySuccess {
    0% { background: var(--bg-secondary); }
    50% { background: var(--success); color: white; }
    100% { background: var(--bg-secondary); }
}

.btn.copied {
    animation: copySuccess 0.8s ease;
}

/* Smooth page load fade-in */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-container {
    animation: fadeInUp 0.4s ease-out;
}

.link-item {
    animation: fadeInUp 0.3s ease-out backwards;
}

.link-item:nth-child(1) { animation-delay: 0.05s; }
.link-item:nth-child(2) { animation-delay: 0.1s; }
.link-item:nth-child(3) { animation-delay: 0.15s; }

/* Slot counter subtle animation when approaching limit */
.slot-counter {
    transition: all 0.3s ease;
}

.slot-counter.full {
    animation: subtlePulse 2s infinite;
}

/* Profile URL box - satisfying focus state */
.profile-url-box .form-input:focus {
    background: var(--bg-tertiary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Add link button - inviting hover */
.add-link-btn {
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.add-link-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.add-link-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

/* Subtle progress indicator in header (hidden but functional) */
.header-top h1 {
    position: relative;
}

.header-top h1::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    width: var(--progress, 0%);
    transition: width 0.5s ease;
    border-radius: 1px;
    opacity: 0.6;
}

/* Form input satisfaction */
.form-input {
    transition: all 0.2s ease;
}

.form-input:focus {
    transform: scale(1.01);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Delete confirmation - slight hesitation feel */
.btn-danger:hover {
    transform: scale(1.1);
    transition: transform 0.15s ease;
}

/* Smooth message dismissal */
.message {
    transition: all 0.3s ease;
}

.message.dismissing {
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
}

/* Public profile link cards - magnetic hover */
.link-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.link-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.25);
}

.link-card:active {
    transform: translateY(-2px) scale(1.01);
    transition: transform 0.1s ease;
}

/* Responsive */
@media (max-width: 600px) {
    .features {
        grid-template-columns: 1fr;
    }

    .logo {
        font-size: 2rem;
    }

    .cta {
        flex-direction: column;
    }

    .header-top {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .link-item {
        flex-wrap: wrap;
    }

    .link-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.5rem;
    }
}
