/* =============================================
   Chat Domain - Chat Interface Styles
   ============================================= */

.chat-view {
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10;
}

/* Left side: Story ring + Profile info grouped */
.chat-header .header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header .header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-header h2 {
    font-size: 18px;
    margin: 0;
    line-height: 1.2;
}

/* Seeyaa online status */
.seeyaa-status {
    font-size: 12px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 6px;
}

.seeyaa-status.online {
    color: #22c55e;
}

.seeyaa-status.offline {
    color: #888;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
    animation: pulse-online 2s ease-in-out infinite;
}

.status-dot.busy {
    background: #f59e0b;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
    animation: pulse-busy 3s ease-in-out infinite;
}

.status-dot.offline {
    background: #9ca3af;
}

/* Status text styling */
.seeyaa-status.online {
    color: #22c55e;
}

.seeyaa-status.busy {
    color: #f59e0b;
}

.seeyaa-status.offline {
    color: #9ca3af;
}

.seeyaa-status.offline.sleeping {
    color: #8b5cf6;
}

.seeyaa-status.offline.meeting {
    color: #ef4444;
}

.seeyaa-status.offline.subway {
    color: #6b7280;
}

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

@keyframes pulse-busy {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Legacy - keep for backwards compat */
.logout-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    color: #666;
    padding: 5px;
}

.logout-btn:hover {
    color: #000;
}

/* =============================================
   Settings Menu (Jan 2026 - Session #18)
   ============================================= */
.settings-menu-container {
    position: relative;
}

.settings-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    color: #666;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.settings-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.settings-btn:active {
    transform: scale(0.95);
}

.settings-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    z-index: 100;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.2s ease;
    pointer-events: none;
}

.settings-dropdown.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.settings-dropdown.hidden {
    display: none;
}

.settings-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background 0.15s ease;
    text-align: left;
}

.settings-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

.settings-item:active {
    background: rgba(0, 0, 0, 0.08);
}

.settings-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
    color: #666;
}

.settings-item.danger {
    color: #ef4444;
}

.settings-item.danger i {
    color: #ef4444;
}

.settings-item.danger:hover {
    background: rgba(239, 68, 68, 0.08);
}

.settings-item.success {
    color: #22c55e;
}

.settings-item.success i {
    color: #22c55e;
}

.settings-item:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.settings-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.settings-item.disabled:hover {
    background: none;
}

.settings-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #999;
    padding: 8px 16px 4px;
}

.coming-soon-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.settings-divider {
    height: 1px;
    background: #eee;
    margin: 4px 0;
}

/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* =============================================
   Consecutive Message Grouping - Tighter spacing
   When same sender sends multiple messages in a row
   ============================================= */

/* User sends multiple messages - tight spacing */
.message.user + .message.user {
    margin-top: -11px; /* 15px gap - 11px = 4px effective gap */
}

/* Seeyaa sends multiple messages - tight spacing */
.message.seeyaa + .message.seeyaa,
.message.ai + .message.ai {
    margin-top: -11px;
}

/* Also handle button messages from Seeyaa */
.message.seeyaa + .message.button-message,
.message.button-message + .message.seeyaa {
    margin-top: -11px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.4;
    font-size: 15px;
    position: relative;
}

/* New message animation - smooth slide up and fade in */
.message.new-message {
    animation: messageSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes messageSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.92);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* No animation for messages loaded from history */
.message.from-history {
    animation: none;
}

.message.ai,
.message.seeyaa {
    align-self: flex-start;
    background-color: var(--chat-bg-ai);
    color: var(--chat-text-ai);
    border-bottom-left-radius: 4px;
}

.message.user {
    align-self: flex-end;
    background-color: var(--chat-bg-user);
    color: var(--chat-text-user);
    border-bottom-right-radius: 4px;
}

/* Button Messages */
.message.button-message {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message.button-message .message-text {
    margin: 0;
}

.chat-action-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    align-self: flex-start;
}

.chat-action-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

.chat-action-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.chat-action-btn.success {
    background: #22c55e;
}

/* Load More Indicator */
.load-more-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    color: #888;
    font-size: 13px;
}

.spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Input Area */
.input-area {
    padding: 15px;
    border-top: 1px solid #eee;
    background: white;
    display: flex;
    gap: 10px;
    align-items: center;
}

.input-area input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
}

.input-area input:focus {
    border-color: var(--primary-color);
}

.send-btn, .mic-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.mic-btn {
    background: #f5f5f5;
    color: #333;
}

.mic-btn.recording {
    background: #ef4444;
    color: white;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Typing Indicator */
.typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--chat-bg-ai);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    align-self: flex-start;
}

.dot {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* =============================================
   Reactions System
   ============================================= */

/* Message content wrapper */
.message-content {
    word-wrap: break-word;
}

/* Reactions container below message */
.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
    min-height: 0;
}

.message-reactions:empty {
    display: none;
}

/* Individual reaction badge */
.reaction-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.reaction-badge:hover {
    background: rgba(0, 0, 0, 0.15);
    transform: scale(1.1);
}

.reaction-badge:active {
    transform: scale(0.95);
}

/* User message reactions - lighter badge */
.message.user .reaction-badge {
    background: rgba(255, 255, 255, 0.25);
}

.message.user .reaction-badge:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Reactions Picker Popup */
.reactions-picker {
    position: fixed;
    display: flex;
    gap: 4px;
    background: white;
    border-radius: 25px;
    padding: 8px 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center bottom;
}

.reactions-picker.hidden {
    opacity: 0;
    transform: scale(0.8);
    pointer-events: none;
    visibility: hidden;
}

.reactions-picker.visible {
    opacity: 1;
    transform: scale(1);
    visibility: visible;
}

/* Position variants */
.reactions-picker.position-above {
    transform-origin: center bottom;
}

.reactions-picker.position-below {
    transform-origin: center top;
}

/* Reaction button in picker */
.reaction-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reaction-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    transform: scale(1.2);
}

.reaction-btn:active {
    transform: scale(1.4);
}

/* Message highlight when picker is open */
.message.reaction-highlight {
    box-shadow: 0 0 0 3px var(--primary-color);
    transform: scale(1.02);
}

/* Prevent text selection during long press */
.message {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* OLD Audio Queue CSS removed - replaced by Voice Message System */

/* =============================================
   Message Status Ticks - WhatsApp Style
   ============================================= */

/* Message content needs to make room for status */
.message.user .message-content {
    padding-right: 36px;
    position: relative;
}

/* Status container - bottom right corner */
.message-status {
    position: absolute;
    bottom: -6px;
    right: -10px;
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    opacity: 0.55;
}

/* Time + tick wrapper */
.message-status .status-ticks {
    display: flex;
    align-items: center;
    height: 16px;
}

/* SVG tick icons */
.message-status .tick-icon {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: all 0.3s ease;
}

/* Single tick - sent (white/light) */
.message-status.sent {
    color: rgba(255, 255, 255, 0.7);
}

.message-status.sent .tick-icon {
    opacity: 1;
}

/* Double tick - seen (bright blue) */
.message-status.seen {
    color: #34D399;
    opacity: 1;
}

.message-status.seen .tick-icon {
    opacity: 1;
}

/* Second tick hidden by default, shown for seen */
.message-status .tick-icon.tick-2 {
    margin-left: -10px;
    opacity: 0;
    transform: translateX(-5px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.message-status.seen .tick-icon.tick-2 {
    opacity: 1;
    transform: translateX(0);
}

/* Smooth color transition */
.message-status .tick-icon {
    transition: stroke 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
}

/* =============================================
   Image Messages - Seeyaa's Photos
   ============================================= */

.message.image-message {
    max-width: 280px;
}

.message-image-container {
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 4px;
    background: #f0f0f0;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-image {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
    display: block;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.message-image:hover {
    transform: scale(1.02);
}

.message.seeyaa .message-image-container {
    border-radius: 0 12px 12px 12px;
}

.message.user .message-image-container {
    border-radius: 12px 0 12px 12px;
}

.image-caption {
    padding: 8px 12px !important;
    font-size: 14px;
    margin-top: 0;
}

.image-error {
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
    text-align: center;
}

/* Fullscreen Image Overlay */
.image-fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

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

.image-fullscreen-container {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.image-fullscreen {
    max-width: 100%;
    max-height: calc(100vh - 100px);
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.image-fullscreen-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    padding: 10px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.image-fullscreen-close:hover {
    opacity: 1;
}

.image-fullscreen-caption {
    color: white;
    margin-top: 15px;
    font-size: 16px;
    text-align: center;
    opacity: 0.9;
}

/* =============================================
   Voice Message System - WhatsApp/Messenger Style
   ============================================= */

/* Voice Message Bubble */
.message.voice-message {
    padding: 8px 12px;
    min-width: 200px;
    max-width: 280px;
}

.voice-player {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

/* Play/Pause Button */
.voice-play-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s ease, background 0.2s ease;
}

.voice-play-btn:hover {
    transform: scale(1.05);
}

.voice-play-btn:active {
    transform: scale(0.95);
}

.message.seeyaa .voice-play-btn {
    background: #666;
}

.message.user .voice-play-btn {
    background: rgba(255, 255, 255, 0.3);
}

/* Waveform Container - bars fill up as progress! */
.voice-waveform {
    flex: 1;
    height: 32px;
    display: flex;
    align-items: center;
    gap: 2px;
    overflow: hidden;
}

.voice-wave-bar {
    width: 3px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 2px;
    transition: background 0.2s linear; /* Smooth flow - matches timeupdate ~200-250ms */
}

/* Played state - bar fills up with color */
.voice-wave-bar.played {
    background: var(--primary-color);
}

.message.seeyaa .voice-wave-bar {
    background: rgba(0, 0, 0, 0.25);
}

.message.seeyaa .voice-wave-bar.played {
    background: #666;
}

.message.user .voice-wave-bar {
    background: rgba(255, 255, 255, 0.4);
}

.message.user .voice-wave-bar.played {
    background: rgba(255, 255, 255, 0.95);
}

/* Duration Display */
.voice-duration {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.5);
    min-width: 35px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.message.user .voice-duration {
    color: rgba(255, 255, 255, 0.7);
}

/* =============================================
   Recording Overlay - Shows during recording
   ============================================= */

.recording-overlay {
    position: fixed;
    bottom: 80px;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0.7));
    padding: 20px;
    z-index: 1000;
    animation: slideUpFade 0.2s ease;
}

.recording-overlay.hidden {
    display: none;
}

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

.recording-content {
    max-width: 400px;
    margin: 0 auto;
    text-align: center;
}

.recording-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 15px;
}

.recording-pulse {
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    animation: recordingPulse 1s ease-in-out infinite;
}

@keyframes recordingPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }
}

.recording-time {
    font-size: 24px;
    font-weight: 600;
    color: white;
    font-variant-numeric: tabular-nums;
}

/* Recording Waveform - REAL audio visualization driven by Web Audio API */
#recording-waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 50px;
    margin-bottom: 15px;
}

.waveform-bar {
    width: 4px;
    background: #ef4444;
    border-radius: 2px;
    height: 10%; /* Default minimum, JS will update dynamically */
    transition: height 0.05s linear; /* Smooth but fast transitions */
}

/* 🔧 SESSION #19: Centered STOP button for easier mobile reach */
.recording-stop-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #ef4444;
    border: none;
    color: white;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px auto;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.recording-stop-btn:hover {
    background: #dc2626;
    transform: scale(1.05);
}

.recording-stop-btn:active {
    transform: scale(0.95);
}

.recording-hint {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
}

/* =============================================
   Voice Preview Modal - Before sending
   ============================================= */

.voice-preview-modal {
    position: fixed;
    bottom: 80px;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    animation: slideUpFade 0.2s ease;
}

.voice-preview-modal.hidden {
    display: none;
}

.voice-preview-content {
    max-width: 400px;
    margin: 0 auto;
}

.voice-preview-player {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 12px;
    margin-bottom: 15px;
}

.preview-play-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 16px;
    transition: transform 0.15s ease;
}

.preview-play-btn:hover {
    transform: scale(1.05);
}

.preview-play-btn:active {
    transform: scale(0.95);
}

/* Preview Waveform */
#preview-waveform {
    flex: 1;
    height: 40px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.preview-waveform-bar {
    width: 3px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 2px;
    min-height: 4px;
    transition: background 0.2s linear; /* Smooth flow - matches timeupdate */
}

/* Played state for preview - fills up during playback */
.preview-waveform-bar.played {
    background: var(--primary-color);
}

.preview-duration {
    font-size: 14px;
    color: #666;
    min-width: 40px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Preview Action Buttons */
.voice-preview-actions {
    display: flex;
    gap: 12px;
}

.preview-cancel-btn,
.preview-send-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.15s ease, opacity 0.2s ease;
}

.preview-cancel-btn {
    background: #f5f5f5;
    color: #666;
}

.preview-cancel-btn:hover {
    background: #eee;
}

.preview-send-btn {
    background: var(--primary-color);
    color: white;
}

.preview-send-btn:hover {
    opacity: 0.9;
}

.preview-cancel-btn:active,
.preview-send-btn:active {
    transform: scale(0.98);
}

/* =============================================
   Mic Button Recording State Enhancement
   ============================================= */

.mic-btn.recording {
    background: #ef4444 !important;
    color: white !important;
    animation: micPulse 1.5s infinite;
}

@keyframes micPulse {
    0% { 
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); 
    }
    70% { 
        box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); 
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); 
    }
}

/* =============================================
   📱 INSTAGRAM STORIES SYSTEM (Jan 2026)
   Story ring indicator + fullscreen viewer
   ============================================= */

/* Story Ring Container in Header */
.story-ring-container {
    flex-shrink: 0;
    margin-right: 12px;
}

.story-ring {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    padding: 3px;
    cursor: pointer;
    transition: transform 0.2s ease;
    background: transparent;
}

.story-ring:hover {
    transform: scale(1.05);
}

/* Story ring gradient when there are unviewed stories */
.story-ring.has-stories.unviewed {
    background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
}

/* Greyed out ring when all stories viewed */
.story-ring.has-stories.viewed {
    background: #ddd;
}

.story-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    padding: 2px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-avatar .avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Story Viewer - Fullscreen Modal */
.story-viewer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.story-viewer.hidden {
    display: none;
}

/* Story Viewer Header */
.story-viewer-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    z-index: 10;
    background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent);
}

/* Progress Bar */
.story-progress {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

.progress-segment {
    height: 2px;
    border-radius: 2px;
    background: rgba(255,255,255,0.3);
    position: relative;
    overflow: hidden;
}

.progress-segment.viewed {
    background: rgba(255,255,255,0.9);
}

.progress-segment.active {
    background: rgba(255,255,255,0.3);
}

.progress-segment.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: rgba(255,255,255,0.9);
    animation: storyProgress var(--duration, 5000ms) linear forwards;
}

@keyframes storyProgress {
    from { width: 0%; }
    to { width: 100%; }
}

/* Story Header Info */
.story-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.story-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid white;
}

.story-username {
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.story-time {
    color: rgba(255,255,255,0.7);
    font-size: 12px;
}

/* Close Button */
.story-close-btn {
    position: absolute;
    top: 50px;
    right: 16px;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.story-close-btn:hover {
    opacity: 1;
}

/* Story Content */
.story-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
}

.story-content .story-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Text-only Story */
.story-text-content {
    padding: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    margin: 20px;
}

.story-text-content .story-text {
    color: white;
    font-size: 24px;
    font-weight: 500;
    text-align: center;
    max-width: 80%;
    line-height: 1.4;
}

/* Story Caption */
.story-caption {
    position: absolute;
    bottom: 40px;
    left: 0;
    right: 0;
    padding: 20px;
    text-align: center;
    color: white;
    font-size: 16px;
    background: linear-gradient(to top, rgba(0,0,0,0.5), transparent);
}

.story-caption.hidden {
    display: none;
}

/* Navigation Areas */
.story-navigation {
    position: absolute;
    top: 100px;
    bottom: 100px;
    left: 0;
    right: 0;
    display: flex;
}

.story-nav-prev,
.story-nav-next {
    flex: 1;
    cursor: pointer;
}

.story-nav-prev {
    cursor: w-resize;
}

.story-nav-next {
    cursor: e-resize;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .story-ring {
        width: 46px;
        height: 46px;
    }
    
    .story-ring-container {
        margin-right: 10px;
    }
    
    .story-text-content .story-text {
        font-size: 20px;
    }
    
    .story-close-btn {
        top: 45px;
        right: 10px;
    }
}

/* =============================================
   🔧 Admin Panel Modal (Jan 2026)
   ============================================= */

.admin-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.admin-modal.hidden {
    display: none;
}

.admin-modal-content {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: #fff;
    border-radius: 16px 16px 0 0;
}

.admin-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.admin-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.admin-close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

/* State Display */
.admin-state {
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.admin-state-loading,
.admin-state-error {
    text-align: center;
    color: #666;
    font-size: 14px;
    padding: 10px;
}

.admin-state-error {
    color: #ef4444;
}

.admin-state-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.state-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.state-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.state-value {
    font-size: 13px;
    color: #333;
    font-weight: 500;
}

.state-value.online {
    color: #22c55e;
}

.state-value.offline {
    color: #9ca3af;
}

/* Action Buttons Grid */
.admin-actions {
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.admin-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.admin-action-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
    transform: translateY(-1px);
}

.admin-action-btn:active {
    transform: translateY(0);
}

.admin-action-btn i {
    font-size: 20px;
    color: #4a90d9;
    margin-bottom: 2px;
}

.admin-action-btn .action-label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.admin-action-btn .action-desc {
    font-size: 10px;
    color: #888;
    line-height: 1.3;
}

/* Success/Warning variants */
.admin-action-btn.success {
    border-color: #86efac;
    background: #f0fdf4;
}

.admin-action-btn.success:hover {
    background: #dcfce7;
    border-color: #4ade80;
}

.admin-action-btn.success i {
    color: #22c55e;
}

.admin-action-btn.warning {
    border-color: #fcd34d;
    background: #fefce8;
}

.admin-action-btn.warning:hover {
    background: #fef9c3;
    border-color: #facc15;
}

.admin-action-btn.warning i {
    color: #f59e0b;
}

/* Result Display */
.admin-result {
    padding: 0 16px 16px;
    min-height: 20px;
}

.admin-result-loading {
    text-align: center;
    color: #666;
    font-size: 13px;
    padding: 10px;
}

.admin-result-success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
}

.admin-result-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
}

/* Mobile Adjustments for Admin */
@media (max-width: 480px) {
    .admin-modal-content {
        max-height: 90vh;
        border-radius: 12px;
    }
    
    .admin-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 12px;
    }
    
    .admin-action-btn {
        padding: 12px 8px;
    }
    
    .admin-action-btn i {
        font-size: 18px;
    }
    
    .admin-action-btn .action-label {
        font-size: 12px;
    }
    
    .admin-action-btn .action-desc {
        font-size: 9px;
    }
}