/* ============================================================================
   SOCIAL PAGES - CONSOLIDATED STYLES
   ============================================================================ */

/* ============================================================================
   LAYOUT CONTAINERS
   ============================================================================ */

.social-container,
.group-container,
.profile-container,
.dashboard-container {
    max-width: 1100px;
    margin: 60px auto;
    padding: 0 20px;
}

.profile-container {
    max-width: 700px;
}

.group-container {
    max-width: 900px;
}

.dm-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* ============================================================================
   CARDS
   ============================================================================ */

.content-card,
.section-card,
.profile-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    overflow: hidden;
}

.card-header,
.section-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title,
.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.card-badge {
    font-size: 12px;
    background: var(--color-bg);
    color: var(--color-text-tertiary);
    padding: 5px 12px;
    border-radius: var(--radius-md);
}

.card-content {
    padding: 20px 24px;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn-primary {
    padding: 12px 24px;
    background: var(--color-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.15s;
}

.btn-primary:hover {
    background: #124e5f;
}

.btn-secondary {
    padding: 10px 20px;
    background: white;
    color: var(--color-blue);
    border: 1px solid var(--color-blue);
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s;
}

.btn-secondary:hover {
    background: #f5f5f5;
}

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

.btn-orange:hover {
    background: #e66525;
}

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

.btn-join {
    background: var(--color-blue);
    color: white;
    border-color: var(--color-blue);
}

.btn-join:hover {
    background: #124e5f;
}

.btn-leave {
    color: var(--color-red);
    border-color: var(--color-red);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid var(--color-border);
    background: white;
    cursor: pointer;
    font-family: inherit;
}

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

.btn-small.promote {
    color: var(--color-blue);
    border-color: var(--color-blue);
}

.btn-small.demote {
    color: var(--color-orange);
    border-color: var(--color-orange);
}

.btn-small.remove {
    color: var(--color-red);
    border-color: var(--color-red);
}

.btn-copy {
    padding: 12px 20px;
    background: var(--color-orange);
    color: white;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-copy:hover {
    background: #e66525;
}

/* ============================================================================
   TABS
   ============================================================================ */

.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--color-border);
}

.tab {
    padding: 14px 24px;
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-tertiary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.15s;
}

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

.tab.active {
    color: var(--color-blue);
    border-bottom-color: var(--color-blue);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Group tabs (pill style) */
.group-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 6px;
}

.group-tab {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.group-tab:hover {
    background: var(--color-bg);
    color: var(--color-text-primary);
}

.group-tab.active {
    background: var(--color-blue);
    color: white;
}

/* ============================================================================
   MEMBER / TRADER ITEMS
   ============================================================================ */

.member-item,
.trader-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    border-bottom: 1px solid var(--color-border);
}

.member-item:last-child,
.trader-item:last-child {
    border-bottom: none;
}

.member-avatar,
.trader-avatar {
    width: 40px;
    height: 40px;
    background: var(--color-bg);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-secondary);
    flex-shrink: 0;
}

.member-info,
.trader-info {
    flex: 1;
    min-width: 0;
}

.member-address,
.trader-address {
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 2px;
}

.member-address a,
.trader-address a {
    color: inherit;
    text-decoration: none;
}

.member-address a:hover,
.trader-address a:hover {
    color: var(--color-blue);
}

.member-role,
.trader-meta {
    font-size: 12px;
    color: var(--color-text-tertiary);
}

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

.member-volume {
    font-weight: 600;
    font-size: 14px;
}

.member-trades {
    font-size: 12px;
    color: var(--color-text-tertiary);
}

/* Member management */
.member-manage-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

.member-manage-item:last-child {
    border-bottom: none;
}

.member-manage-info {
    flex: 1;
}

.member-manage-actions {
    display: flex;
    gap: 8px;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-creator {
    background: rgba(22, 97, 119, 0.15);
    color: var(--color-blue);
}

.badge-admin {
    background: rgba(248, 114, 45, 0.15);
    color: var(--color-orange);
}

.badge-you {
    background: rgba(26, 135, 84, 0.15);
    color: var(--color-green);
}

.badge-top {
    background: rgba(212, 160, 18, 0.15);
    color: #d4a012;
}

/* ============================================================================
   TOKEN DISPLAY
   ============================================================================ */

.token-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.token-icon,
.token-pill-icon {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    object-fit: cover;
}

.token-icon-placeholder,
.token-pill-icon-placeholder {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: white;
    font-weight: 600;
}

.token-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.token-logo-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    font-weight: 600;
    background: var(--color-blue);
}

/* ============================================================================
   CHAT WIDGET
   ============================================================================ */

.chat-widget {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 500px;
    min-height: 400px;
}

.chat-widget .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.chat-widget .chat-message {
    margin-bottom: 16px;
}

.chat-widget .chat-message:last-child {
    margin-bottom: 0;
}

.chat-widget .chat-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.chat-widget .chat-message-author {
    font-weight: 600;
    font-size: 13px;
    color: var(--color-blue);
}

.chat-widget .chat-message-time {
    font-size: 11px;
    color: var(--color-text-tertiary);
}

.chat-widget .chat-message-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text-primary);
    word-wrap: break-word;
}

.chat-widget .chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 12px;
    background: var(--color-card);
    flex-shrink: 0;
}

.chat-widget .chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    background: white;
}

.chat-widget .chat-input:focus {
    outline: none;
    border-color: var(--color-blue);
}

.chat-widget .chat-send-btn {
    padding: 12px 24px;
    background: var(--color-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}

.chat-widget .chat-send-btn:hover {
    background: #124e5f;
}

.chat-widget .chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-tertiary);
}

.chat-widget .chat-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.chat-widget .chat-disabled {
    padding: 16px 20px;
    border-top: 1px solid var(--color-border);
    text-align: center;
    color: var(--color-text-tertiary);
    font-size: 13px;
    background: var(--color-bg);
    flex-shrink: 0;
}

/* Chat locked/pending state */
.chat-widget-locked {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    text-align: center;
    padding: 60px 40px;
}

.chat-widget-locked .chat-lock-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.chat-widget-locked .chat-lock-title {
    color: var(--color-text-secondary);
    margin-bottom: 12px;
    font-size: 15px;
    font-weight: 500;
}

.chat-widget-locked .chat-lock-subtitle {
    color: var(--color-text-tertiary);
    font-size: 13px;
    margin-bottom: 24px;
}

.chat-widget-locked .chat-lock-action {
    margin-top: 20px;
}

/* ============================================================================
   GROUP PAGE SPECIFIC
   ============================================================================ */

/* Group header */
.group-header {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 24px;
}

.group-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.group-info h1 {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.015em;
    margin-bottom: 8px;
}

.group-meta {
    font-size: 13px;
    color: var(--color-text-tertiary);
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

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

/* Invite section */
.invite-section {
    background: var(--color-bg);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.invite-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.invite-url {
    flex: 1;
    padding: 10px 14px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.btn-copy-link {
    padding: 10px 16px;
    background: var(--color-blue);
    color: white;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.btn-copy-link:hover {
    background: #124e5f;
}

/* Pattern card */
.pattern-card {
    background: var(--color-blue);
    border-radius: 12px;
    padding: 32px;
    color: white;
    margin-bottom: 24px;
}

.pattern-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.pattern-title {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
}

.pattern-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 600;
}

.pattern-dot {
    width: 10px;
    height: 10px;
    background: var(--color-green);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

.pattern-meta {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
}

.pattern-tokens {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}

.pattern-token {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
}

.pattern-token-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.pattern-token-icon-placeholder {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.pattern-token-info {
    display: flex;
    flex-direction: column;
}

.pattern-token-symbol {
    font-weight: 600;
    font-size: 14px;
}

.pattern-token-name {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
}

.btn-copy-pattern {
    width: 100%;
    padding: 16px;
    background: var(--color-orange);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-copy-pattern:hover {
    background: #e66525;
}

/* No pattern state */
.no-pattern {
    text-align: center;
    padding: 40px 20px;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    margin-bottom: 24px;
}

.no-pattern-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.no-pattern-text {
    font-size: 16px;
    color: var(--color-text-secondary);
    margin-bottom: 20px;
}

.btn-set-pattern {
    padding: 14px 28px;
    background: var(--color-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.btn-set-pattern:hover {
    background: #124e5f;
}

/* ============================================================================
   SETTINGS
   ============================================================================ */

.settings-section {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    margin-bottom: 24px;
    overflow: hidden;
}

.settings-section-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border);
    font-size: 16px;
    font-weight: 600;
}

.settings-section-content {
    padding: 24px;
}

.settings-field {
    margin-bottom: 20px;
}

.settings-field:last-child {
    margin-bottom: 0;
}

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

.settings-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
}

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

.settings-btn {
    padding: 12px 24px;
    background: var(--color-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.settings-btn:hover {
    background: #124e5f;
}

/* Token picker */
.token-picker {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
}

.token-picker-search {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
}

.token-picker-search input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
}

.token-picker-search input:focus {
    outline: none;
    border-color: var(--color-blue);
}

.token-picker-list {
    max-height: 300px;
    overflow-y: auto;
}

.token-picker-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.1s;
}

.token-picker-item:hover {
    background: var(--color-bg);
}

.token-picker-item.selected {
    background: rgba(22, 97, 119, 0.1);
}

.token-picker-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.token-picker-icon-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.token-picker-info {
    flex: 1;
}

.token-picker-symbol {
    font-weight: 600;
    font-size: 14px;
}

.token-picker-name {
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.token-picker-check {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
}

.token-picker-item.selected .token-picker-check {
    background: var(--color-blue);
    border-color: var(--color-blue);
}

.selected-tokens {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    min-height: 40px;
}

.selected-token {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--color-bg);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
}

.selected-token-remove {
    cursor: pointer;
    color: var(--color-text-tertiary);
    font-size: 16px;
    line-height: 1;
}

.selected-token-remove:hover {
    color: var(--color-red);
}

/* Visibility options */
.visibility-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.visibility-option {
    display: block;
    cursor: pointer;
}

.visibility-option input {
    display: none;
}

.visibility-option-content {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--color-bg);
    border: 2px solid transparent;
    border-radius: 8px;
    transition: all 0.15s;
}

.visibility-option input:checked + .visibility-option-content {
    border-color: var(--color-blue);
    background: rgba(22, 97, 119, 0.05);
}

.visibility-option-icon {
    font-size: 24px;
}

.visibility-option-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.visibility-option-desc {
    font-size: 12px;
    color: var(--color-text-tertiary);
}

/* ============================================================================
   LEADERBOARD
   ============================================================================ */

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th {
    text-align: left;
    padding: 14px 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-tertiary);
    border-bottom: 1px solid var(--color-border);
}

.leaderboard-table th:last-child,
.leaderboard-table td:last-child {
    text-align: right;
}

.leaderboard-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
}

.leaderboard-table tr:last-child td {
    border-bottom: none;
}

.leaderboard-table tr:hover {
    background: var(--color-bg);
}

.leaderboard-rank {
    font-weight: 600;
    color: var(--color-text-tertiary);
}

.leaderboard-rank.top-3 {
    color: #d4a012;
}

/* ============================================================================
   MODALS
   ============================================================================ */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--color-card);
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    margin: 20px;
}

.modal-header {
    padding: 24px 24px 0;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.modal-subtitle {
    font-size: 14px;
    color: var(--color-text-tertiary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 0 24px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ============================================================================
   FORMS
   ============================================================================ */

.form-group {
    margin-bottom: 20px;
}

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

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    color: var(--color-text-primary);
}

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

.form-hint {
    font-size: 12px;
    color: var(--color-text-tertiary);
    margin-top: 6px;
}

/* ============================================================================
   EMPTY & LOADING STATES
   ============================================================================ */

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--color-text-tertiary);
}

.empty-state-icon,
.empty-icon {
    font-size: 48px;
    margin-bottom: 14px;
    opacity: 0.5;
}

.empty-state-text,
.empty-text {
    font-size: 15px;
}

.empty-link {
    color: var(--color-blue);
    text-decoration: none;
}

.empty-link:hover {
    color: var(--color-orange);
}

.loading-state {
    text-align: center;
    padding: 56px 24px;
    color: var(--color-text-tertiary);
}

.loading-icon {
    font-size: 36px;
    margin-bottom: 14px;
    animation: pulse 1.5s infinite;
}

/* ============================================================================
   PNL COLORS
   ============================================================================ */

.positive,
.pnl-positive {
    color: var(--color-green);
}

.negative,
.pnl-negative {
    color: var(--color-red);
}

/* ============================================================================
   MOBILE RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .social-container,
    .group-container,
    .profile-container,
    .dashboard-container {
        margin: 40px auto;
    }

    .dm-container {
        padding: 16px;
    }

    /* Chat widget mobile */
    .chat-widget {
        height: 400px;
        min-height: 350px;
    }

    .chat-widget .chat-input-area {
        padding: 12px 16px;
    }

    .chat-widget .chat-send-btn {
        padding: 12px 16px;
    }

    /* Group page mobile */
    .group-top {
        flex-direction: column;
        gap: 16px;
    }

    .group-actions {
        width: 100%;
    }

    .group-actions button,
    .group-actions a {
        flex: 1;
    }

    .invite-section {
        flex-direction: column;
        align-items: stretch;
    }

    .pattern-header {
        flex-direction: column;
        gap: 12px;
    }

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

    .group-tab {
        flex: 1 1 45%;
    }

    /* Tables */
    .leaderboard-table {
        display: block;
        overflow-x: auto;
    }
}

@media (max-width: 480px) {
    .chat-widget {
        height: 350px;
        min-height: 300px;
    }

    .chat-widget .chat-messages {
        padding: 16px;
    }

    .chat-widget-locked {
        padding: 40px 20px;
    }
}

/* ============================================================================
   CHAT WIDGET - IMPROVED MOBILE & STYLING
   ============================================================================ */

/* Better message bubbles */
.chat-widget .chat-message {
    margin-bottom: 12px;
    padding: 10px 14px;
    background: var(--color-bg);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
}

.chat-widget .chat-message:last-child {
    margin-bottom: 0;
}

.chat-widget .chat-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.chat-widget .chat-message-author {
    font-weight: 600;
    font-size: 12px;
    color: var(--color-blue);
}

.chat-widget .chat-message-time {
    font-size: 10px;
    color: var(--color-text-tertiary);
}

.chat-widget .chat-message-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text-primary);
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* Input area improvements */
.chat-widget .chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 10px;
    background: var(--color-card);
    flex-shrink: 0;
}

.chat-widget .chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    background: var(--color-bg);
    min-height: 40px;
    max-height: 120px;
}

.chat-widget .chat-input:focus {
    outline: none;
    border-color: var(--color-blue);
    background: white;
}

.chat-widget .chat-send-btn {
    padding: 10px 20px;
    background: var(--color-blue);
    color: white;
    border: none;
    border-radius: 20px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
    align-self: flex-end;
}

.chat-widget .chat-send-btn:hover {
    background: #124e5f;
}

.chat-widget .chat-send-btn:active {
    transform: scale(0.98);
}

/* Empty state */
.chat-widget .chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-tertiary);
    padding: 40px 20px;
    text-align: center;
}

.chat-widget .chat-empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* Mobile specific */
@media (max-width: 768px) {
    .chat-widget {
        height: calc(100vh - 200px);
        max-height: 500px;
        min-height: 300px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .chat-widget .chat-messages {
        padding: 12px;
    }

    .chat-widget .chat-message {
        padding: 8px 12px;
        margin-bottom: 8px;
    }

    .chat-widget .chat-input-area {
        padding: 10px 12px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    .chat-widget .chat-input {
        padding: 10px 14px;
        font-size: 16px; /* Prevents iOS zoom */
    }

    .chat-widget .chat-send-btn {
        padding: 10px 16px;
    }
}

@media (max-width: 480px) {
    .chat-widget {
        height: calc(100vh - 160px);
        min-height: 250px;
    }

    .chat-widget .chat-message-author {
        font-size: 11px;
    }

    .chat-widget .chat-message-text {
        font-size: 13px;
    }
}

/* Fix for iOS safe areas */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .chat-widget .chat-input-area {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}
