/* ==========================================================================
   Global Variables & Reset
   ========================================================================== */
:root {
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --card-hover: rgba(51, 65, 85, 0.9);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-blue: #38bdf8;
    --accent-purple: #a855f7;
    --accent-green: #22c55e;
    --accent-line: #06c755;
    --accent-shopee: #ee4d2d;
    --font-thai: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-en: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-thai);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 3rem 1.25rem 2rem;
    position: relative;
    overflow-x: hidden;
}

/* Background Ambient Glow Effect */
.background-glow {
    position: fixed;
    top: -150px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--glow-1, rgba(56, 189, 248, 0.2)) 0%, var(--glow-2, rgba(168, 85, 247, 0.15)) 40%, rgba(15, 23, 42, 0) 70%);
    filter: blur(80px);
    pointer-events: none;
    z-index: 0;
}

/* Container */
.container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 540px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Share Button */
.share-btn {
    position: absolute;
    top: -1.5rem;
    right: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.25s ease;
    backdrop-filter: blur(12px);
}

.share-btn:hover {
    background: var(--accent-blue);
    color: #0f172a;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.4);
}

/* Profile Header */
.profile-header {
    text-align: center;
    margin-bottom: 1.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.avatar-wrapper {
    position: relative;
    width: 105px;
    height: 105px;
    margin-bottom: 1rem;
}

.avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s ease;
}

.avatar:hover {
    transform: scale(1.05);
}

/* Status Indicator (Online/Ready) */
.status-badge {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 16px;
    height: 16px;
    background-color: var(--accent-green);
    border: 3px solid var(--bg-dark);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.8);
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.2rem;
}

.verified-badge {
    color: var(--accent-blue);
    font-size: 1.1rem;
}

.profile-handle {
    font-family: var(--font-en);
    font-size: 0.95rem;
    color: var(--accent-blue);
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.profile-bio {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
    max-width: 440px;
    font-weight: 300;
}

/* Social Bar */
.social-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.social-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    text-decoration: none;
    transition: all 0.25s ease;
    backdrop-filter: blur(10px);
}

.social-icon:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.social-icon.line:hover { background: #06c755; color: #fff; border-color: #06c755; }
.social-icon.fb:hover { background: #1877f2; color: #fff; border-color: #1877f2; }
.social-icon.ig:hover { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%,#d6249f 60%,#285AEB 90%); color: #fff; }
.social-icon.tiktok:hover { background: #000; color: #fff; border-color: #fe2c55; }
.social-icon.email:hover { background: #ea4335; color: #fff; border-color: #ea4335; }

/* Links Section */
.links-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

/* Link Card */
.link-card {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
}

.link-card:hover {
    background: var(--card-hover);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Featured Card with Border Glow */
.link-card.featured {
    border: 1px solid rgba(6, 199, 85, 0.5);
    background: linear-gradient(135deg, rgba(6, 199, 85, 0.15) 0%, rgba(30, 41, 59, 0.8) 100%);
}

.link-card.featured:hover {
    border-color: rgba(6, 199, 85, 0.9);
    box-shadow: 0 8px 30px rgba(6, 199, 85, 0.25);
}

.card-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-right: 1rem;
    color: var(--accent-blue);
    transition: all 0.25s ease;
}

.link-card.featured .card-icon {
    color: var(--accent-line);
    background: rgba(6, 199, 85, 0.2);
}

.link-card:hover .card-icon {
    transform: scale(1.1);
}

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

.card-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
    flex-wrap: wrap;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
}

.card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Badges / Tags */
.tag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
}

.tag.popular {
    background: rgba(6, 199, 85, 0.2);
    color: #4ade80;
    border: 1px solid rgba(6, 199, 85, 0.4);
}

.tag.sale {
    background: rgba(238, 77, 45, 0.2);
    color: #fb7185;
    border: 1px solid rgba(238, 77, 45, 0.4);
}

.arrow-icon {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-left: 0.5rem;
    transition: transform 0.25s ease;
}

.link-card:hover .arrow-icon {
    transform: translateX(4px);
    color: var(--text-primary);
}

/* Footer */
.footer {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: auto;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(15, 23, 42, 0.95);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    font-size: 0.9rem;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Mobile responsive adjustments */
@media (max-width: 480px) {
    body {
        padding: 2.5rem 1rem 1.5rem;
    }
    
    .profile-name {
        font-size: 1.35rem;
    }

    .card-title {
        font-size: 0.95rem;
    }

    .card-desc {
        font-size: 0.8rem;
    }
}


/* ==========================================================================
   Auth & Admin Dashboard Components
   ========================================================================== */
.auth-box, .admin-box {
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    margin-bottom: 2rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    text-align: left;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
}

.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
    background: rgba(15, 23, 42, 0.85);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);
    color: #0f172a;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(56, 189, 248, 0.5);
    color: #0f172a;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn-danger:hover {
    background: #ef4444;
    color: white;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn-block {
    width: 100%;
}

.alert {
    padding: 0.85rem 1.25rem;
    border-radius: 10px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.alert-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #86efac;
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

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

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

/* Admin Dashboard Specific */
.admin-navbar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--card-border);
}

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

.section-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent-blue);
}

.link-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    gap: 1rem;
}

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

.link-item-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.15rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

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


/* ==========================================================================
   Color Themes (data-theme)
   ========================================================================== */
/* 1. Midnight Neon (Default) */
[data-theme="midnight"], :root {
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(255, 255, 255, 0.1);
    --card-hover: rgba(51, 65, 85, 0.9);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-blue: #38bdf8;
    --accent-purple: #a855f7;
    --glow-1: rgba(56, 189, 248, 0.22);
    --glow-2: rgba(168, 85, 247, 0.18);
}

/* 2. Emerald Forest */
[data-theme="emerald"] {
    --bg-dark: #091c16;
    --card-bg: rgba(16, 44, 35, 0.75);
    --card-border: rgba(52, 211, 153, 0.18);
    --card-hover: rgba(22, 65, 52, 0.9);
    --text-primary: #f0fdf4;
    --text-secondary: #86efac;
    --accent-blue: #34d399;
    --accent-purple: #10b981;
    --glow-1: rgba(16, 185, 129, 0.28);
    --glow-2: rgba(52, 211, 153, 0.2);
}

/* 3. Sunset Rose */
[data-theme="sunset"] {
    --bg-dark: #1a0b1c;
    --card-bg: rgba(45, 19, 48, 0.75);
    --card-border: rgba(244, 63, 94, 0.2);
    --card-hover: rgba(68, 28, 73, 0.9);
    --text-primary: #fff1f2;
    --text-secondary: #fda4af;
    --accent-blue: #fb7185;
    --accent-purple: #f97316;
    --glow-1: rgba(244, 63, 94, 0.28);
    --glow-2: rgba(249, 115, 22, 0.22);
}

/* 4. Royal Violet */
[data-theme="violet"] {
    --bg-dark: #120926;
    --card-bg: rgba(33, 17, 71, 0.75);
    --card-border: rgba(168, 85, 247, 0.2);
    --card-hover: rgba(50, 26, 107, 0.9);
    --text-primary: #faf5ff;
    --text-secondary: #d8b4fe;
    --accent-blue: #c084fc;
    --accent-purple: #e879f9;
    --glow-1: rgba(168, 85, 247, 0.28);
    --glow-2: rgba(236, 72, 153, 0.22);
}

/* 5. Cyber Gold */
[data-theme="gold"] {
    --bg-dark: #17130e;
    --card-bg: rgba(38, 29, 18, 0.75);
    --card-border: rgba(245, 158, 11, 0.2);
    --card-hover: rgba(58, 44, 25, 0.9);
    --text-primary: #fffbeb;
    --text-secondary: #fcd34d;
    --accent-blue: #f59e0b;
    --accent-purple: #fbbf24;
    --glow-1: rgba(245, 158, 11, 0.28);
    --glow-2: rgba(217, 119, 6, 0.22);
}

/* 6. Clean Minimal Light */
[data-theme="light"] {
    --bg-dark: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.88);
    --card-border: rgba(15, 23, 42, 0.08);
    --card-hover: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent-blue: #0284c7;
    --accent-purple: #7c3aed;
    --glow-1: rgba(56, 189, 248, 0.18);
    --glow-2: rgba(147, 197, 253, 0.25);
}
[data-theme="light"] .card-icon {
    background: rgba(2, 132, 199, 0.1);
    color: #0284c7;
}
[data-theme="light"] .link-card {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .link-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .avatar {
    border: 3px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .auth-box, [data-theme="light"] .admin-box {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .form-input, [data-theme="light"] .form-textarea, [data-theme="light"] .form-select {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
}
[data-theme="light"] .link-item-row {
    background: #f8fafc;
    border-color: #e2e8f0;
}

/* ==========================================================================
   Theme Selector Grid Styles
   ========================================================================== */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.theme-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.15rem;
    background: rgba(15, 23, 42, 0.5);
    border: 2px solid var(--card-border);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.theme-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.theme-card:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(15, 23, 42, 0.85);
    transform: translateY(-2px);
}

.theme-card.active {
    border-color: var(--accent-blue);
    background: rgba(56, 189, 248, 0.12);
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.25);
}

.theme-preview {
    display: flex;
    align-items: center;
    gap: 0;
}

.color-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    margin-right: -6px;
    border: 2px solid rgba(15, 23, 42, 0.6);
}

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

.theme-name {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.theme-desc {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.theme-active-badge {
    color: var(--accent-blue);
    font-size: 0.9rem;
}
