/* ========================================
   JKCHAT - ENTERPRISE MESSENGER STYLES
   ======================================== */

/* Reset & Base */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    /* Messenger-inspired Colors */
    --primary: #0084ff;
    --primary-dark: #0066cc;
    --primary-light: #e7f3ff;
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --text-main: #050505;
    --text-sub: #65676b;
    --border: #e4e6eb;
    --shadow: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

body.dark-mode {
    --bg: #18191a;
    --card-bg: #242526;
    --text-main: #e4e6eb;
    --text-sub: #b0b3b8;
    --border: #3a3b3c;
}

/* Smooth Scrolling */
html { scroll-behavior: smooth; }

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #bcc0c4;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #8e9296;
}

.dark-mode ::-webkit-scrollbar-thumb {
    background: #4e4f50;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* Room Cards - Messenger Style */
.room-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.room-card:hover {
    background: #f2f3f5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.room-card:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

.room-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #e4e6eb;
}

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

.room-card-info h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-card-info p {
    font-size: 13px;
    color: var(--text-sub);
}

/* Member List Items */
.member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.member-item:hover {
    background: #f2f3f5;
}

.member-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    position: relative;
}

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

.member-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

/* Online Status Dot */
.online-dot {
    width: 10px;
    height: 10px;
    background: #31a24c;
    border-radius: 50%;
    border: 2px solid white;
    position: absolute;
    bottom: 0;
    right: 0;
}

/* Message Bubbles - Already implemented in script.js with Tailwind */
/* But adding some helper classes for consistency */

.message-sending {
    opacity: 0.6;
}

.message-error {
    border: 1px solid #f02849;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #90949c;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.empty-state i {
    font-size: 64px;
    color: #d0d2d6;
    margin-bottom: 16px;
}

.empty-state p {
    color: var(--text-sub);
    font-size: 15px;
    font-weight: 500;
}

/* Modal Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

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

/* Sidebar Toggle Animation */
#sidebar.active {
    transform: translateX(0) !important;
}

.sidebar-overlay.active {
    display: block !important;
}

/* Avatar Grid for Presets */
.avatar-option {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    object-fit: cover;
}

.avatar-option:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.avatar-option.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0,132,255,0.1);
}

/* Responsive Utilities */
@media (max-width: 768px) {
    .room-card {
        padding: 10px;
    }
    
    .room-card-icon {
        width: 48px;
        height: 48px;
    }
    
    .room-card-info h4 {
        font-size: 14px;
    }
    
    .room-card-info p {
        font-size: 12px;
    }
}

/* Focus States for Accessibility */
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Smooth Transitions */
* {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-duration: 150ms;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Premium Gradients */
.bg-primary-gradient {
    background: linear-gradient(135deg, #0084ff 0%, #00a3ff 100%);
}

.text-gradient {
    background: linear-gradient(135deg, #0084ff 0%, #00a3ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
