/* ==========================================================================
   AnonymChat — Modern Dark Theme Stylesheet
   ========================================================================== */

:root {
    --bg-main: #0b0f19;
    --bg-surface: #111827;
    --bg-surface-elevated: #1f2937;
    --bg-surface-hover: #374151;
    --border-subtle: #242f40;
    --border-focus: #3b82f6;

    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --text-accent: #60a5fa;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-active: #1e40af;
    --primary-glow: rgba(37, 99, 235, 0.35);

    --msg-mine-bg: #1e3a8a;
    --msg-mine-border: #2563eb;
    --msg-other-bg: #1f2937;
    --msg-other-border: #374151;

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -4px rgba(0, 0, 0, 0.6);

    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

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

html, body {
    height: 100%;
    width: 100%;
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
}

/* ==========================================================================
   Chat Layout
   ========================================================================== */

.chat-app {
    display: flex;
    flex-direction: row;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    max-width: 100%;
    margin: 0;
    padding: 0;
    background-color: var(--bg-main);
    border: none;
    position: relative;
    overflow: hidden;
}

.chat-layout-wrapper {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* ==========================================================================
   LEFT SIDEBAR: Navigation & Channels (WhatsApp Web style)
   ========================================================================== */

.chat-sidebar-left {
    width: 380px;
    min-width: 320px;
    max-width: 420px;
    height: 100%;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 15;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-left-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background-color: var(--bg-surface-elevated);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.sidebar-user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.sidebar-avatar-wrapper {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.avatar-status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--success);
    border: 2px solid var(--bg-surface-elevated);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-nickname {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.sidebar-status-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.sidebar-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Sidebar Search Box */
.sidebar-search-container {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
    background-color: var(--bg-surface);
    flex-shrink: 0;
}

.sidebar-search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--bg-surface-elevated);
    padding: 8px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    transition: border-color var(--transition-fast);
}

.sidebar-search-box:focus-within {
    border-color: #f59e0b;
}

.sidebar-search-box input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.82rem;
    width: 100%;
}

.search-ico {
    font-size: 0.82rem;
    opacity: 0.6;
}

/* Sidebar Navigation Items List */
.sidebar-nav-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.nav-chat-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: background-color var(--transition-fast);
    text-decoration: none;
    color: inherit;
    position: relative;
}

.nav-chat-item:hover {
    background-color: var(--bg-surface-hover);
}

.nav-chat-item.active {
    background-color: rgba(245, 158, 11, 0.08);
    border-left: 3px solid #f59e0b;
}

.nav-item-avatar {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-brand-logo {
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.35);
}

.nav-avatar-media {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(217, 119, 6, 0.25));
    border: 1px solid rgba(245, 158, 11, 0.35);
}

.nav-avatar-pinned {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.25));
    border: 1px solid rgba(59, 130, 246, 0.35);
}

.nav-avatar-security {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.25));
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.nav-icon-glyph {
    font-size: 1.3rem;
}

.nav-online-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background-color: var(--success);
    border: 2px solid var(--bg-surface);
}

.nav-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nav-item-top, .nav-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.nav-item-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.nav-item-time {
    font-size: 0.72rem;
    color: #f59e0b;
    font-weight: 600;
    flex-shrink: 0;
}

.nav-item-preview {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.nav-item-tag {
    font-size: 0.65rem;
    padding: 2px 6px;
    background-color: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
    border-radius: var(--radius-full);
    font-weight: 600;
    flex-shrink: 0;
}

.nav-badge-pill {
    font-size: 0.65rem;
    padding: 2px 6px;
    background-color: #f59e0b;
    color: #0f172a;
    border-radius: var(--radius-full);
    font-weight: 700;
    flex-shrink: 0;
}

.nav-badge-count {
    font-size: 0.68rem;
    background-color: #3b82f6;
    color: #ffffff;
    padding: 1px 6px;
    border-radius: var(--radius-full);
    font-weight: 700;
}

.nav-badge-secure {
    font-size: 0.65rem;
    background-color: rgba(16, 185, 129, 0.2);
    color: #34d399;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    font-weight: 700;
}

.sidebar-left-footer {
    padding: 10px 14px;
    background-color: var(--bg-surface-elevated);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
    flex-shrink: 0;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 90;
    backdrop-filter: blur(3px);
}

/* ==========================================================================
   CENTER COLUMN: Active Chat Column
   ========================================================================== */

.chat-main-column {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--bg-main);
    position: relative;
}

/* Header */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 10;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-mobile-menu {
    display: none;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-info-col {
    display: flex;
    flex-direction: column;
}

.brand-img-logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.35);
    flex-shrink: 0;
}

.brand-title {
    background: linear-gradient(135deg, #fcd34d, #f59e0b, #d97706);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    font-size: 1.05rem;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Status Pill */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.status-connected .status-dot { background-color: var(--success); box-shadow: 0 0 6px var(--success); }
.status-connected .status-text { color: var(--success); }

.status-connecting .status-dot { background-color: var(--warning); animation: pulse 1.5s infinite; }
.status-connecting .status-text { color: var(--warning); }

.status-disconnected .status-dot { background-color: var(--danger); }
.status-disconnected .status-text { color: var(--danger); }

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

/* User Badge */
.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-surface-elevated);
    padding: 5px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
}

.user-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border-radius: 4px;
    transition: color var(--transition-fast), background var(--transition-fast);
}

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

/* ==========================================================================
   Main Message Area
   ========================================================================== */

.chat-main {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
.chat-main::-webkit-scrollbar {
    width: 6px;
}
.chat-main::-webkit-scrollbar-track {
    background: transparent;
}
.chat-main::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 3px;
}
.chat-main::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* History Bar */
.history-container {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.history-loader {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Message List */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: auto;
}

/* Message Item */
.message-item {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: fadeInSlide 0.2s ease-out;
}

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

.message-item.msg-mine {
    align-self: flex-end;
    align-items: flex-end;
}

.message-item.msg-other {
    align-self: flex-start;
    align-items: flex-start;
}

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

.msg-author {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-accent);
}

.msg-mine .msg-author {
    color: #93c5fd;
}

.msg-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.message-bubble {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-wrap;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.msg-mine .message-bubble {
    background-color: var(--msg-mine-bg);
    border: 1px solid var(--msg-mine-border);
    color: #eff6ff;
    border-bottom-right-radius: 2px;
}

.msg-other .message-bubble {
    background-color: var(--msg-other-bg);
    border: 1px solid var(--msg-other-border);
    color: var(--text-primary);
    border-bottom-left-radius: 2px;
}

/* Skeletons */
.messages-skeleton {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.skeleton-bubble {
    height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(90deg, #161e2e 25%, #232f46 50%, #161e2e 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
}

.skeleton-left {
    width: 60%;
    align-self: flex-start;
}

.skeleton-right {
    width: 50%;
    align-self: flex-end;
}

@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    margin: auto 0;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 3.5rem;
    margin-bottom: 12px;
    opacity: 0.7;
}

.empty-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.empty-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    max-width: 320px;
}

/* Floating Scroll to Bottom */
.btn-scroll-bottom {
    position: absolute;
    bottom: 20px;
    right: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: transform var(--transition-fast), background-color var(--transition-fast);
    z-index: 5;
}

.btn-scroll-bottom:hover {
    background-color: var(--bg-surface-hover);
    transform: translateY(-2px);
}

.unread-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-full);
}

/* ==========================================================================
   Footer & Message Input Form
   ========================================================================== */

.chat-footer {
    padding: 12px 20px 16px;
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    position: relative;
    flex-shrink: 0;
}

.toast-container {
    position: absolute;
    bottom: 100%;
    left: 20px;
    right: 20px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
    z-index: 20;
}

.toast {
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-md);
    animation: toastPop 0.25s ease-out;
    pointer-events: auto;
}

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

.toast-error {
    background-color: #7f1d1d;
    border: 1px solid var(--danger);
    color: #fef2f2;
}

.toast-warning {
    background-color: #78350f;
    border: 1px solid var(--warning);
    color: #fffbeb;
}

.toast-success {
    background-color: #064e3b;
    border: 1px solid var(--success);
    color: #ecfdf5;
}

.chat-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.input-wrapper {
    flex: 1;
    position: relative;
    background-color: var(--bg-main);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-tool-todo {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    padding: 0;
}

.btn-tool-todo:hover:not(:disabled) {
    background-color: rgba(245, 158, 11, 0.15);
    border-color: #f59e0b;
    color: #f59e0b;
    transform: scale(1.04);
}

.btn-tool-todo:active:not(:disabled) {
    transform: scale(0.96);
}

.btn-tool-todo:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.input-wrapper:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.chat-textarea {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    padding: 12px 14px 24px;
    resize: none;
    outline: none;
    max-height: 140px;
    min-height: 46px;
    line-height: 1.4;
}

.chat-textarea::placeholder {
    color: var(--text-muted);
}

.input-meta {
    position: absolute;
    bottom: 6px;
    right: 12px;
    display: flex;
    align-items: center;
}

.char-counter {
    font-size: 0.7rem;
    color: var(--text-muted);
    user-select: none;
}

.char-counter.counter-warning {
    color: var(--warning);
}

.char-counter.counter-limit {
    color: var(--danger);
    font-weight: 700;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

.btn-primary:active:not(:disabled) {
    background-color: var(--primary-active);
    transform: scale(0.98);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-send {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.btn-secondary {
    background-color: var(--bg-surface-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--bg-surface-hover);
    border-color: var(--text-muted);
}

.btn-block {
    width: 100%;
    padding: 12px;
}

/* Spinner */
.spinner-sm {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Nickname Modal
   ========================================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 9999;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 420px;
    width: 100%;
    padding: 28px 24px;
    animation: modalScale 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScale {
    from { opacity: 0; transform: scale(0.94); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    text-align: center;
    margin-bottom: 22px;
}

.modal-badge {
    display: inline-block;
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--success);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    margin-bottom: 10px;
}

.modal-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.modal-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.input-icon-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 12px;
    font-size: 1rem;
    pointer-events: none;
}

.form-input {
    width: 100%;
    background-color: var(--bg-main);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 14px 12px 40px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.form-help {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.alert-error {
    background-color: var(--danger-bg);
    border: 1px solid var(--danger);
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    line-height: 1.35;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 640px) {
    .chat-app {
        border-left: none;
        border-right: none;
    }

    .chat-header {
        padding: 10px 14px;
    }

    .chat-main {
        padding: 12px 14px;
    }

    .chat-footer {
        padding: 10px 14px 12px;
    }

    .message-item {
        max-width: 90%;
    }

    .modal-card {
        padding: 22px 18px;
    }
}

/* ==========================================================================
   Context Menu (Right Click Dropdown)
   ========================================================================== */

.context-menu {
    position: fixed;
    z-index: 1000;
    min-width: 180px;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    backdrop-filter: blur(12px);
    animation: contextMenuFade 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top left;
    user-select: none;
}

@keyframes contextMenuFade {
    from {
        opacity: 0;
        transform: scale(0.92);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.context-menu-item svg {
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: color var(--transition-fast);
}

.context-menu-item:hover {
    background-color: var(--primary);
    color: #ffffff;
}

.context-menu-item:hover svg {
    color: #ffffff;
}

.context-menu-item.text-danger {
    color: #f87171;
}

.context-menu-item.text-danger svg {
    color: #f87171;
}

.context-menu-item.text-danger:hover {
    background-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.context-menu-item.text-danger:hover svg {
    color: #fca5a5;
}

.message-highlighted .message-bubble {
    box-shadow: 0 0 0 2px var(--primary-glow), var(--shadow-md);
}

.message-item.message-removing {
    opacity: 0;
    transform: scale(0.92) translateY(-6px);
    transition: opacity 0.25s ease, transform 0.25s ease, max-height 0.25s ease;
    max-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* ==========================================================================
   WhatsApp-like Reply Preview Bar (Above Input Form)
   ========================================================================== */

.reply-preview-bar {
    display: flex;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-bottom: none;
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
    padding: 8px 14px;
    margin-bottom: 0;
    position: relative;
    animation: slideUpReply 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

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

.reply-preview-border {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--primary), var(--text-accent));
}

.reply-preview-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.reply-preview-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-accent);
    font-weight: 500;
}

.reply-preview-label strong {
    color: #93c5fd;
    font-weight: 700;
}

.btn-cancel-reply {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border-radius: var(--radius-full);
    transition: color var(--transition-fast), background-color var(--transition-fast);
}

.btn-cancel-reply:hover {
    color: var(--danger);
    background-color: rgba(239, 68, 68, 0.15);
}

.reply-preview-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* ==========================================================================
   Edit Preview Banner (Above Input Bar)
   ========================================================================== */

.edit-preview-bar {
    display: flex;
    align-items: stretch;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-bottom: none;
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
    overflow: hidden;
    animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}

.edit-preview-border {
    width: 4px;
    background-color: #f59e0b;
    flex-shrink: 0;
}

.edit-preview-content {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.edit-preview-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #fcd34d;
}

.edit-preview-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* Connect input smoothly with edit/reply bar */
.chat-footer:has(.reply-preview-bar[style*="display: flex"]) .input-wrapper,
.chat-footer:has(.edit-preview-bar[style*="display: flex"]) .input-wrapper {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.msg-edited-tag {
    display: inline-flex;
    align-items: center;
    font-size: 0.68rem;
    color: var(--text-muted);
    font-style: italic;
    margin-left: 4px;
    user-select: none;
}

/* ==========================================================================
   Todo List Tasks in Message Bubble
   ========================================================================== */

.todo-list-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 4px 0;
}

.todo-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 2px 0;
    transition: opacity var(--transition-fast);
    line-height: 1.4;
    user-select: text;
}

.todo-checkbox {
    width: 18px;
    height: 18px;
    min-width: 18px;
    border-radius: 4px;
    border: 2px solid var(--border-medium);
    background-color: rgba(255, 255, 255, 0.05);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    margin-top: 2px;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    color: transparent;
    user-select: none;
    outline: none;
}

.todo-checkbox:hover {
    border-color: #f59e0b;
    background-color: rgba(245, 158, 11, 0.12);
    transform: scale(1.08);
}

.todo-checkbox.checked {
    background-color: #f59e0b;
    border-color: #f59e0b;
    color: #0f172a;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.todo-checkbox svg {
    width: 12px;
    height: 12px;
    stroke-width: 3.5;
    transition: transform 0.18s ease;
}

.todo-checkbox.checked svg {
    transform: scale(1);
}

.todo-text {
    flex: 1;
    min-width: 0;
    word-break: break-word;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: color 0.18s ease, opacity 0.18s ease, text-decoration 0.18s ease;
}

.todo-text.is-completed {
    text-decoration: line-through;
    color: var(--text-muted);
    opacity: 0.65;
}

.msg-mine .todo-checkbox:hover {
    border-color: #fcd34d;
}

.msg-mine .todo-checkbox.checked {
    background-color: #fcd34d;
    border-color: #fcd34d;
    color: #1e1b4b;
}

.msg-mine .todo-text.is-completed {
    color: rgba(255, 255, 255, 0.55);
}

/* ==========================================================================
   Quoted Message Inside Bubble (WhatsApp Style)
   ========================================================================== */

.message-quote {
    background-color: rgba(0, 0, 0, 0.35);
    border-left: 3.5px solid var(--text-accent);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background-color var(--transition-fast), transform var(--transition-fast);
    user-select: none;
    position: relative;
    overflow: hidden;
}

.msg-mine .message-quote {
    background-color: rgba(0, 0, 0, 0.25);
    border-left-color: #93c5fd;
}

.message-quote:hover {
    background-color: rgba(0, 0, 0, 0.55);
    transform: scale(0.99);
}

.message-quote-author {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-accent);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.msg-mine .message-quote-author {
    color: #93c5fd;
}

.message-quote-text {
    font-size: 0.8rem;
    color: #d1d5db;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   Clickable URLs with Automatic Copying
   ========================================================================== */

.chat-url-link {
    color: #60a5fa;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    font-weight: 500;
    padding: 1px 3px;
    border-radius: 3px;
    transition: background-color var(--transition-fast), color var(--transition-fast);
    word-break: break-all;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.chat-url-link:hover {
    background-color: rgba(96, 165, 250, 0.2);
    color: #93c5fd;
}

.chat-url-link:active {
    transform: scale(0.98);
}

.url-copy-badge {
    font-size: 0.65rem;
    opacity: 0.7;
    margin-left: 2px;
}

/* ==========================================================================
   Jump to Original Message Highlight Animation
   ========================================================================== */

.message-jump-highlight {
    animation: jumpGlow 1.6s ease-out;
}

@keyframes jumpGlow {
    0% {
        transform: scale(1.03);
    }
    20%, 40% {
        box-shadow: 0 0 0 4px var(--primary), var(--shadow-lg);
        background-color: rgba(37, 99, 235, 0.35);
        transform: scale(1.02);
    }
    100% {
        box-shadow: none;
        transform: scale(1);
    }
}

/* ==========================================================================
   Chat Layout Wrapper & Pinned Sidebar
   ========================================================================== */

.chat-layout-wrapper {
    display: flex;
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.chat-main-column {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

/* Header Toggle Button for Pinned */
.btn-pinned-toggle {
    position: relative;
    color: var(--text-secondary);
}

.btn-pinned-toggle:hover {
    color: #fcd34d;
    background-color: rgba(252, 211, 77, 0.1);
}

.btn-pinned-toggle.active {
    color: #f59e0b;
    background-color: rgba(245, 158, 11, 0.15);
}

.badge-count {
    position: absolute;
    top: -3px;
    right: -3px;
    background-color: #f59e0b;
    color: #0f172a;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: var(--radius-full);
    min-width: 16px;
    text-align: center;
    line-height: 1.2;
}

/* Pinned Sidebar */
.pinned-sidebar {
    width: 330px;
    flex-shrink: 0;
    background-color: var(--bg-surface);
    border-left: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 10;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.pinned-sidebar-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.pinned-sidebar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-primary);
}

.pinned-sidebar-title svg {
    color: #f59e0b;
}

.pinned-badge {
    background-color: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-close-pinned {
    display: none;
    color: var(--text-muted);
}

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

/* Pinned Messages List */
.pinned-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

/* Pinned Message Card */
.pinned-card {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    box-shadow: var(--shadow-sm);
    border-left: 3.5px solid #f59e0b;
}

.pinned-card:hover {
    background-color: #1e293b;
    border-color: rgba(245, 158, 11, 0.4);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.pinned-card:active {
    transform: scale(0.99);
}

.pinned-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.pinned-card-author {
    font-size: 0.8rem;
    font-weight: 700;
    color: #fcd34d;
    display: flex;
    align-items: center;
    gap: 4px;
}

.pinned-card-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pinned-card-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.btn-unpin-card {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    opacity: 0.7;
    transition: opacity var(--transition-fast), color var(--transition-fast), background-color var(--transition-fast);
}

.pinned-card:hover .btn-unpin-card {
    opacity: 1;
}

.btn-unpin-card:hover {
    color: var(--danger);
    background-color: rgba(239, 68, 68, 0.15);
}

.pinned-card-quote {
    background-color: rgba(0, 0, 0, 0.25);
    border-left: 2px solid var(--text-accent);
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pinned-card-text {
    font-size: 0.84rem;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Pinned Empty State */
.pinned-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 16px;
    margin: auto 0;
    color: var(--text-secondary);
}

.pinned-empty-icon {
    font-size: 2.2rem;
    margin-bottom: 8px;
    opacity: 0.6;
}

.pinned-empty-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.pinned-empty-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.35;
    max-width: 200px;
}

/* Pin indicator on pinned messages inside chat */
.message-item.is-pinned .message-bubble {
    border-top: 2px solid #f59e0b;
}

.msg-pinned-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.68rem;
    color: #fcd34d;
    font-weight: 600;
    margin-left: 6px;
}

/* ==========================================================================
   Responsive Drawer Mode for Mobile / Tablet (< 992px)
   ========================================================================== */

@media (max-width: 991px) {
    .btn-mobile-menu {
        display: inline-flex;
    }

    .chat-sidebar-left {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 320px;
        max-width: 85vw;
        z-index: 100;
        box-shadow: var(--shadow-lg);
        transform: translateX(-100%);
    }

    .chat-sidebar-left.sidebar-open {
        transform: translateX(0);
    }

    .pinned-sidebar {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: 320px;
        max-width: 85vw;
        z-index: 100;
        box-shadow: var(--shadow-lg);
        transform: translateX(100%);
    }

    .pinned-sidebar.drawer-open {
        transform: translateX(0);
    }

    .btn-close-pinned {
        display: inline-flex;
    }

    .pinned-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.65);
        z-index: 95;
        backdrop-filter: blur(3px);
        animation: fadeIn 0.2s ease;
    }
}

/* ==========================================================================
   Media Library Navigation Button in Chat Header
   ========================================================================== */

.btn-notifications {
    position: relative;
}

.btn-notifications.active svg {
    color: #f59e0b;
}

.notif-status-dot {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 5px var(--success);
}

.btn-nav-media {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.btn-nav-media:hover {
    background-color: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
}

.btn-nav-media svg {
    color: #f59e0b;
}

/* ==========================================================================
   Media Library Page Styles (media.php)
   ========================================================================== */

.media-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-width: 1260px;
    margin: 0 auto;
    background-color: var(--bg-main);
    border-left: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
    overflow-y: auto;
}

.media-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(8px);
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-text-group {
    display: flex;
    flex-direction: column;
}

.brand-badge-sub {
    font-size: 0.72rem;
    color: #f59e0b;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.btn-back-chat {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}

.media-main-column {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100vh;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.media-main {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
}

/* Hero Section */
.media-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    padding: 20px 0 10px;
}

.media-hero-title {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fcd34d, #f59e0b, #d97706);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.media-hero-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    max-width: 600px;
    line-height: 1.5;
}

.media-hero-subtitle strong {
    color: #fcd34d;
}

/* Search Bar */
.media-search-wrapper {
    position: relative;
    width: 100%;
    max-width: 540px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    opacity: 0.6;
}

.media-search-input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.media-search-input:focus {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

/* Category Pills */
.media-categories {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.cat-pill {
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 7px 14px;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.cat-pill:hover {
    background-color: rgba(245, 158, 11, 0.1);
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.3);
}

.cat-pill.active {
    background-color: #f59e0b;
    color: #0f172a;
    border-color: #f59e0b;
    font-weight: 700;
}

/* Media Grid */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

/* Media Card */
.media-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.media-card:hover {
    transform: translateY(-3px);
    border-color: rgba(245, 158, 11, 0.5);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 12px rgba(245, 158, 11, 0.15);
}

.media-card:active {
    transform: scale(0.99);
}

/* Card Preview */
.media-card-preview {
    height: 140px;
    background-color: var(--bg-surface-elevated);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.media-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.media-card:hover .media-thumbnail {
    transform: scale(1.05);
}

.media-icon-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.cat-big-icon {
    font-size: 3rem;
}

.media-cat-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    backdrop-filter: blur(6px);
    background-color: rgba(15, 23, 42, 0.85);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Card Body */
.media-card-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.media-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-card-filename {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.media-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.btn-download-media {
    margin-top: 10px;
    width: 100%;
    padding: 8px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #0f172a;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: background-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-download-media:hover {
    background: linear-gradient(135deg, #fcd34d, #f59e0b);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

/* Media Empty State */
.media-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.media-empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.6;
}

/* Media Upload Component Styles */
.btn-upload-media {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #0f172a;
    font-weight: 700;
    padding: 7px 14px;
    font-size: 0.85rem;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.btn-upload-media:hover {
    background: linear-gradient(135deg, #fcd34d, #f59e0b);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
    transform: translateY(-1px);
}

.btn-hero-upload-btn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #0f172a;
    font-weight: 700;
    padding: 10px 20px;
    font-size: 0.95rem;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border: none;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
    transition: all var(--transition-fast);
    margin-top: 10px;
}

.btn-upload-media:active,
.btn-hero-upload-btn:active {
    transform: scale(0.95) !important;
    filter: brightness(0.92);
}

.modal-upload-card {
    max-width: 520px;
    width: 100%;
    position: relative;
}

.modal-header-with-close {
    position: relative;
    text-align: center;
    margin-bottom: 20px;
}

.btn-modal-close {
    position: absolute;
    top: -12px;
    right: -10px;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    line-height: 1;
}

.btn-modal-close:hover {
    color: var(--text-primary);
    border-color: #f59e0b;
    background-color: rgba(245, 158, 11, 0.18);
    transform: scale(1.1);
}

/* Upload Dropzone */
.upload-dropzone {
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-md);
    padding: 24px 16px;
    text-align: center;
    background-color: var(--bg-surface-elevated);
    cursor: pointer;
    position: relative;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: #f59e0b;
    background-color: rgba(245, 158, 11, 0.08);
}

.upload-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}

.dropzone-icon {
    font-size: 2.2rem;
}

.dropzone-main-text {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.dropzone-main-text strong {
    color: #fcd34d;
}

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

/* Multi-file Selected Area */
.upload-selected-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.upload-files-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    color: #fcd34d;
    font-weight: 600;
    padding: 2px 4px;
}

.btn-clear-all-files {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.78rem;
    text-decoration: underline;
    transition: color var(--transition-fast);
}

.btn-clear-all-files:hover {
    color: var(--danger);
}

.upload-file-list {
    max-height: 160px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 4px;
}

.upload-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    transition: border-color var(--transition-fast);
}

.upload-file-item:hover {
    border-color: rgba(245, 158, 11, 0.4);
}

.upload-file-item-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.upload-file-item-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    font-weight: 500;
}

.upload-file-item-size {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-left: 6px;
}

.upload-file-item-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.upload-file-item-remove:hover {
    color: var(--danger);
    background-color: rgba(239, 68, 68, 0.15);
}

@media (max-width: 640px) {
    .media-grid {
        grid-template-columns: 1fr;
    }
    .media-hero-title {
        font-size: 1.4rem;
    }
    .btn-nav-media-text {
        display: none;
    }
}





