/* ===== Tab Bar (Bottom of Sidebar) ===== */
.tab-bar {
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: var(--bg-header);
    border-top: 1px solid var(--border);
    padding: 4px 0;
    flex-shrink: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
    font-family: var(--font);
    font-size: 11px;
    min-width: 52px;
    position: relative;
}

.tab-btn svg {
    transition: color 0.15s;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: var(--accent);
}

.tab-btn.active span {
    font-weight: 600;
}

/* Active indicator line */
.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
}

/* ===== Category Bar (Pill Buttons) ===== */
.category-bar {
    display: flex;
    gap: 8px;
    padding: 6px 16px 8px;
    overflow-x: auto;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.category-bar::-webkit-scrollbar {
    display: none;
}

.category-btn {
    background: var(--bg-search);
    color: var(--text-secondary);
    border: none;
    padding: 5px 14px;
    border-radius: 16px;
    font-size: 13px;
    font-family: var(--font);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.category-btn:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}

.category-btn.active {
    background: var(--accent);
    color: #fff;
}

/* ===== Tab Panels ===== */
.tab-content {
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.tab-panel {
    display: none;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.tab-panel.active {
    display: flex;
    flex-direction: column;
}

.tab-panel::-webkit-scrollbar {
    width: 6px;
}

.tab-panel::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 3px;
}

/* Tab empty state */
.tab-empty-state {
    padding: 40px 20px;
    text-align: center;
}

.tab-empty-state p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

/* ===== Chat Settings Panel ===== */
.chat-settings-panel {
    position: absolute;
    top: 60px;
    right: 0;
    width: 280px;
    max-height: calc(100% - 60px);
    background: var(--bg-modal);
    border-left: 1px solid var(--border);
    z-index: 50;
    overflow-y: auto;
    animation: slideInRight 0.2s ease;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.chat-settings-panel.hidden {
    display: none;
}

.chat-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.chat-settings-header h4 {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.chat-settings-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chat-settings-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-settings-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.chat-settings-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
}

.chat-settings-toggle-label input[type="checkbox"] {
    accent-color: var(--accent);
}

.chat-settings-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-family: var(--font);
    outline: none;
}

.chat-settings-select:focus {
    border-color: var(--accent);
}

/* Color swatches */
.color-swatches {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.color-swatch:hover {
    transform: scale(1.1);
    border-color: var(--text-secondary);
}

.color-swatch.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 168, 132, 0.3);
}

.color-swatch.swatch-default {
    background: var(--bg-input);
    border: 2px dashed var(--border-light);
}

/* Custom chat background override */
#chat-area.custom-bg .messages {
    background-color: var(--chat-bg-custom, var(--bg-chat));
}

/* Custom bubble color override */
#chat-area.custom-bubble .message.sent .message-bubble {
    background: var(--bubble-color-custom, var(--bg-bubble-user));
}

#chat-area.custom-bubble .message.sent .message-bubble::before {
    border-left-color: var(--bubble-color-custom, var(--bg-bubble-user));
}

/* ===== Status Feature ===== */
.status-list {
    display: flex;
    flex-direction: column;
}

.status-user-section {
    border-bottom: 1px solid var(--border);
}

.status-add-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
}

.status-add-btn:hover {
    background: var(--bg-hover);
}

.status-add-icon {
    width: 49px;
    height: 49px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.status-add-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.status-add-title {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 400;
}

.status-add-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.status-section-label {
    padding: 10px 16px 6px;
    font-size: 13px;
    color: var(--accent);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-author-entry {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
}

.status-author-entry:hover {
    background: var(--bg-hover);
}

/* Status ring around avatar */
.status-avatar-wrap {
    position: relative;
    width: 49px;
    height: 49px;
    flex-shrink: 0;
}

.status-avatar-wrap .avatar-img,
.status-avatar-wrap .avatar-placeholder {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 43px !important;
    height: 43px !important;
}

.status-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 49px;
    height: 49px;
    border-radius: 50%;
    border: 2.5px solid var(--accent);
}

.status-author-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.status-author-name {
    font-size: 16px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-author-time {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ===== Status Viewer Overlay ===== */
.status-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.status-viewer {
    width: 100%;
    max-width: 420px;
    height: 100%;
    max-height: 720px;
    display: flex;
    flex-direction: column;
    background: var(--bg-chat);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

/* Progress bar */
.status-progress-bar {
    display: flex;
    gap: 3px;
    padding: 8px 8px 0;
}

.status-progress-seg {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    transition: background 0.3s;
}

.status-progress-seg.active {
    background: var(--accent);
}

/* Viewer header */
.status-viewer-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
}

.status-viewer-header .avatar-img {
    border-radius: 50%;
}

.status-viewer-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.status-viewer-name {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 500;
}

.status-viewer-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.status-viewer-close {
    color: var(--text-secondary);
}

/* Viewer content */
.status-viewer-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.status-viewer-text {
    font-size: 20px;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.5;
    max-width: 320px;
}

/* Viewer actions */
.status-viewer-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    padding: 12px;
    border-top: 1px solid var(--border);
}

.status-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 20px;
    transition: background 0.15s, color 0.15s;
    font-size: 14px;
    font-family: var(--font);
}

.status-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.status-action-btn.liked {
    color: #E53935;
}

.status-action-btn.liked svg path {
    fill: #E53935;
}

/* Status compose */
.status-compose-input {
    resize: vertical;
    min-height: 60px;
    max-height: 150px;
}

/* ===== Learning Feature ===== */
.learn-create-btn {
    border-bottom: 1px solid var(--border) !important;
}

.learn-flashcard-section {
    padding: 16px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

.learn-flashcard-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 12px;
}

.learn-flashcard-header h4 {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

.learn-flashcard-hint {
    font-size: 11px;
    color: var(--text-secondary);
}

.learn-lang-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.learn-lang-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 8px;
    background: var(--bg-search);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-family: var(--font);
    font-size: 12px;
    color: var(--text-primary);
}

.learn-lang-card:hover {
    background: var(--bg-active);
    border-color: var(--accent);
}

.learn-lang-flag {
    font-size: 24px;
}

/* Tags */
.learn-tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.learn-tag-btn {
    background: var(--bg-search);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 4px 12px;
    border-radius: 14px;
    font-size: 13px;
    font-family: var(--font);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.learn-tag-btn:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}

.learn-tag-btn.active {
    background: rgba(0, 168, 132, 0.15);
    color: var(--accent);
    border-color: var(--accent);
}

/* ===== Flashcard Modal ===== */
.flashcard-modal {
    max-width: 380px;
}

.flashcard-body {
    align-items: center;
}

.flashcard-counter {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 4px;
}

.flashcard {
    width: 100%;
    min-height: 160px;
    perspective: 600px;
    cursor: pointer;
    margin-bottom: 8px;
}

.flashcard-front,
.flashcard-back {
    width: 100%;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    border-radius: 12px;
    font-size: 20px;
    text-align: center;
    line-height: 1.4;
    backface-visibility: hidden;
    transition: transform 0.4s ease;
}

.flashcard-front {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.flashcard-back {
    background: rgba(0, 168, 132, 0.1);
    color: var(--accent);
    border: 1px solid rgba(0, 168, 132, 0.3);
    position: absolute;
    top: 0;
    left: 0;
    transform: rotateY(180deg);
}

.flashcard.flipped .flashcard-front {
    transform: rotateY(180deg);
}

.flashcard.flipped .flashcard-back {
    transform: rotateY(0deg);
}

.flashcard-actions {
    display: flex;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

.flashcard-actions .btn-secondary,
.flashcard-actions .btn-primary {
    flex: 1;
    text-align: center;
}

/* ===== Mobile Adjustments ===== */
@media (max-width: 768px) {
    .tab-btn {
        padding: 6px 8px;
        min-width: 44px;
        font-size: 10px;
    }

    .tab-btn svg {
        width: 20px;
        height: 20px;
    }

    .category-btn {
        padding: 4px 12px;
        font-size: 12px;
    }

    .chat-settings-panel {
        width: 100%;
        left: 0;
        right: 0;
        border-left: none;
        border-radius: 0;
    }

    .status-viewer {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .learn-lang-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .tab-btn span {
        font-size: 9px;
    }
}
