@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-gradient: radial-gradient(circle at top, #faf9f5 0%, #eae7dc 100%);
    --bg-card: rgba(255, 255, 255, 0.65);
    --bg-card-hover: rgba(255, 255, 255, 0.85);
    --border-color: rgba(0, 0, 0, 0.06);
    --border-hover: rgba(0, 0, 0, 0.12);
    
    --primary: #ca8a04;
    --primary-gradient: linear-gradient(135deg, #eab308 0%, #a16207 100%);
    --accent: #ca8a04;
    --success: #10b981;
    --success-gradient: linear-gradient(135deg, #34d399 0%, #059669 100%);
    
    --text-primary: #1e1b18;
    --text-secondary: #5c564f;
    --text-muted: #8c8276;
    
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 12px 24px -10px rgba(133, 77, 14, 0.08), 0 4px 12px -4px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 20px 32px -8px rgba(133, 77, 14, 0.12), 0 8px 16px -6px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column; /* Change to column to allow layout to stretch */
    align-items: center; /* Center horizontally */
    padding: 24px 16px;
    overflow-x: hidden;
    line-height: 1.5;
}

.container {
    width: 100%;
    max-width: 580px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex-grow: 1; /* Stretch container to fill body height */
}

/* Glassmorphic Background Blur Panels (Light Theme) */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal), background-color var(--transition-normal);
}

.glass-panel:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-lg);
    background: var(--bg-card-hover);
}

/* Header / Avatar Profile Section */
.profile-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    position: relative;
}

.avatar-wrapper {
    position: relative;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    padding: 3px;
    background: var(--primary-gradient);
    box-shadow: 0 8px 20px rgba(161, 98, 7, 0.15);
    animation: pulse 3s infinite ease-in-out;
}

.avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #ffffff;
    background: #eae7dc;
}

.verified-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: #eab308;
    color: #ffffff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.profile-info h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 6px;
    background: linear-gradient(to right, #1e1b18, #854d0e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.profile-info p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    max-width: 95%;
    margin: 0 auto;
    line-height: 1.6;
}

.profile-info strong {
    color: #a16207;
}

/* Highlight badge */
.promo-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(202, 138, 4, 0.08);
    border: 1px solid rgba(202, 138, 4, 0.15);
    color: #a16207;
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 8px;
}

/* Highlight Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    margin-top: 8px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    text-align: center;
    transition: all var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(202, 138, 4, 0.25);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-sm);
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: #1e1b18;
    background: linear-gradient(to bottom right, #1e1b18, #a16207);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
    font-weight: 500;
}

/* Search and Filters Section */
.search-filter-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.search-wrapper {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 14px 16px 14px 44px;
    color: #1e1b18;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all var(--transition-normal);
}

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

.search-input:focus {
    outline: none;
    border-color: rgba(202, 138, 4, 0.4);
    box-shadow: 0 4px 12px rgba(202, 138, 4, 0.05);
    background: #ffffff;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    transition: color var(--transition-normal);
}

.search-input:focus + .search-icon {
    color: #ca8a04;
}

/* District Pills */
.filter-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.filter-scroll::-webkit-scrollbar {
    display: none;
}

.filter-pill {
    padding: 8px 16px;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.filter-pill:hover {
    color: #1e1b18;
    border-color: rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.8);
}

.filter-pill.active {
    background: var(--primary-gradient);
    color: #ffffff;
    border-color: transparent;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(161, 98, 7, 0.2);
}

/* Group Cards List */
.groups-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 100px;
}

.group-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    text-decoration: none;
    color: inherit;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.group-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.group-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.group-card:hover::before {
    opacity: 1;
}

.group-card-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.group-icon-container {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    transition: all var(--transition-normal);
    font-size: 1.25rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.group-card:hover .group-icon-container {
    background: rgba(161, 98, 7, 0.05);
    border-color: rgba(161, 98, 7, 0.2);
    color: var(--accent);
}

.group-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.group-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e1b18;
    line-height: 1.3;
}

.group-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.district-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: #854d0e;
    background: rgba(202, 138, 4, 0.08);
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid rgba(202, 138, 4, 0.15);
}

.member-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.group-tags {
    display: flex;
    gap: 6px;
    margin-top: 2px;
}

.tag {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-color);
    padding: 1px 6px;
    border-radius: 4px;
}

.action-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-normal);
    flex-shrink: 0;
    margin-left: 12px;
}

.group-card:hover .action-btn {
    background: var(--primary-gradient);
    color: #ffffff;
    border-color: transparent;
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(161, 98, 7, 0.25);
}

/* Guide / Template Section */
.guide-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    color: #1e1b18;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title svg {
    color: var(--accent);
}

.guide-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.step-card {
    display: flex;
    gap: 14px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 16px;
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(202, 138, 4, 0.08);
    border: 1px solid rgba(202, 138, 4, 0.18);
    color: #854d0e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

.step-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.step-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e1b18;
}

.step-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Template Copy Card */
.template-card {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
}

.template-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.template-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.copy-btn {
    background: rgba(202, 138, 4, 0.06);
    border: 1px solid rgba(202, 138, 4, 0.15);
    color: #854d0e;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
}

.copy-btn:hover {
    background: rgba(202, 138, 4, 0.12);
    border-color: rgba(202, 138, 4, 0.25);
}

.copy-btn.copied {
    background: var(--success-gradient);
    color: #ffffff;
    border-color: transparent;
}

.template-body {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 12px;
    font-family: monospace;
    font-size: 0.8rem;
    color: #2d2a26;
    white-space: pre-line;
    line-height: 1.6;
    max-height: 160px;
    overflow-y: auto;
}

/* Footer & Support Banner */
.footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    margin-top: auto; /* Push footer to the bottom of the stretched container */
    padding-bottom: 24px;
}

.support-cta {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--primary-gradient);
    color: #ffffff;
    text-decoration: none;
    padding: 16px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 0.95rem;
    transition: all var(--transition-normal);
    box-shadow: 0 8px 20px rgba(161, 98, 7, 0.18);
}

.support-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(161, 98, 7, 0.28);
}

.support-cta svg {
    width: 20px;
    height: 20px;
}

.copyright {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* No results state */
.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    gap: 8px;
    width: 100%;
}

.no-results svg {
    width: 40px;
    height: 40px;
    color: var(--text-muted);
}

/* Animations */
@keyframes pulse {
    0% {
        box-shadow: 0 8px 20px rgba(161, 98, 7, 0.1);
    }
    50% {
        box-shadow: 0 8px 30px rgba(161, 98, 7, 0.22);
    }
    100% {
        box-shadow: 0 8px 20px rgba(161, 98, 7, 0.1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn var(--transition-normal) forwards;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    body {
        padding: 16px 8px;
    }
    
    .glass-panel {
        padding: 18px;
        border-radius: 20px;
    }
    
    .stats-grid {
        gap: 8px;
    }
    
    .stat-card {
        padding: 8px 4px;
    }
    
    .stat-value {
        font-size: 1rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .group-card {
        padding: 12px 14px;
        border-radius: 16px;
    }
    
    .group-icon-container {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        font-size: 1.1rem;
    }
    
    .group-title {
        font-size: 0.9rem;
    }
    
    .district-badge {
        font-size: 0.7rem;
    }
    
    .member-count {
        font-size: 0.7rem;
    }
}

/* Multi-column Layout & Stats Panel Styles */
.stats-panel-title {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #a16207;
    margin-bottom: 18px;
    text-align: center;
}

@media (min-width: 992px) and (max-width: 1199px) {
    .container {
        max-width: 100% !important;
        width: 100% !important;
        padding-left: 16px !important;
        padding-right: 16px !important;
        display: grid !important;
        grid-template-columns: 270px 1fr 270px !important;
        grid-template-rows: 1fr auto !important;
        gap: 16px !important;
        align-items: start !important;
    }
    
    .layout-left, .layout-middle, .layout-right {
        display: flex;
        flex-direction: column;
        gap: 16px;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    .footer {
        grid-column: 1 / -1;
        width: 100%;
        margin-top: 12px;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1200px !important;
        width: 100% !important;
        display: grid !important;
        grid-template-columns: 320px 1fr 320px !important;
        grid-template-rows: 1fr auto !important;
        gap: 24px !important;
        align-items: start !important;
    }
    
    .layout-left, .layout-middle, .layout-right {
        display: flex;
        flex-direction: column;
        gap: 20px;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
    
    .footer {
        grid-column: 1 / -1;
        width: 100%;
        margin-top: 12px;
    }
}

@media (max-width: 991px) {
    .container {
        max-width: 580px !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 20px !important;
    }
    
    .layout-left {
        order: 1;
    }
    
    .layout-right {
        order: 2;
    }
    
    .layout-middle {
        order: 3;
    }
    
    .footer {
        order: 4;
    }
}

/* Floating Action Button (FAB) support styles */
.fab-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    width: 56px;
    height: 56px;
}

.fab-main-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #ffffff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(161, 98, 7, 0.25), 0 0 0 0px rgba(161, 98, 7, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2; /* Main button stays on top */
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: fab-pulse 2.2s infinite;
}

.fab-main-btn:hover {
    transform: scale(1.05);
}

.fab-options {
    position: absolute;
    bottom: 0; /* Align directly behind the main button when inactive */
    right: 4px; /* Center alignment (56px main button vs 48px options = 4px offset) */
    display: flex;
    flex-direction: column-reverse; /* Reverses order to stack naturally */
    gap: 12px;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    z-index: 1; /* Sits behind the main button */
    transform: translateY(0);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Hover or Active toggling */
.fab-container:hover .fab-options,
.fab-container.active .fab-options {
    opacity: 1;
    pointer-events: auto;
    bottom: 68px; /* Slides up above the main button (56px main + 12px gap) */
}

.fab-container:hover #fabIconDefault,
.fab-container.active #fabIconDefault {
    display: none !important;
}

.fab-container:hover #fabIconActive,
.fab-container.active #fabIconActive {
    display: block !important;
}

.fab-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    position: relative;
    transition: all 0.25s ease;
}

.fab-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

.fab-phone {
    background: #10b981; /* Emerald green phone bubble */
}

.fab-zalo {
    background: #0068ff; /* Zalo official blue */
}

/* Tooltip Labels */
.fab-label {
    position: absolute;
    right: 60px;
    background: #1e1b18;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateX(8px);
    transition: all 0.25s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Hover state shows label */
.fab-btn:hover .fab-label {
    opacity: 1;
    transform: translateX(0);
}

@keyframes fab-pulse {
    0% {
        box-shadow: 0 4px 16px rgba(161, 98, 7, 0.25), 0 0 0 0px rgba(161, 98, 7, 0.4);
    }
    70% {
        box-shadow: 0 4px 16px rgba(161, 98, 7, 0.25), 0 0 0 12px rgba(161, 98, 7, 0);
    }
    100% {
        box-shadow: 0 4px 16px rgba(161, 98, 7, 0.25), 0 0 0 0px rgba(161, 98, 7, 0);
    }
}

/* Top Areas Highlight Filter Pills */
.filter-pill.top-pill:not(.active) {
    background: rgba(251, 191, 36, 0.08) !important;
    border: 1px solid rgba(217, 119, 6, 0.4) !important;
    color: #b45309 !important;
    font-weight: 700;
}

.filter-pill.top-pill:hover:not(.active) {
    background: rgba(251, 191, 36, 0.15) !important;
    border-color: rgba(217, 119, 6, 0.6) !important;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.1);
}

.filter-pill.top-pill span {
    margin-right: 2px;
    animation: fire-wiggle 1.5s infinite ease-in-out;
    display: inline-block;
}

@keyframes fire-wiggle {
    0%, 100% { transform: rotate(-5deg) scale(1); }
    50% { transform: rotate(10deg) scale(1.15); }
}

/* Top District Badge inside Group Cards */
.district-badge.top-badge {
    background: rgba(251, 191, 36, 0.12) !important;
    border: 1px solid rgba(217, 119, 6, 0.45) !important;
    color: #b45309 !important;
    font-weight: 700 !important;
}

.district-badge.top-badge span {
    margin-right: 2px;
    animation: fire-wiggle 1.5s infinite ease-in-out;
    display: inline-block;
}
