/**
 * Matrix Chat Widget Styles
 * Dark theme optimized for EXCH.BLACK
 */

.matrix-widget {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    box-sizing: border-box;
}

/* Position variants */
.matrix-widget--bottom-right {
    bottom: 20px;
    right: 20px;
}

.matrix-widget--bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Toggle button */
.matrix-widget__toggle {
    position: relative;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #20cfcf 0%, #1ab3b3 100%);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(32, 207, 207, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0d0d0d;
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

.matrix-widget__toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(32, 207, 207, 0.4);
}

.matrix-widget__toggle:active {
    transform: scale(0.95);
}

/* Notification badge */
.matrix-widget__notification {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Chat container */
.matrix-widget__container {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 360px;
    height: 520px;
    background: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.matrix-widget--open .matrix-widget__container {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.matrix-widget--minimized .matrix-widget__container {
    height: 60px;
    bottom: 70px;
}

/* Header */
.matrix-widget__header {
    background: linear-gradient(135deg, #20cfcf 0%, #1ab3b3 100%);
    color: #0d0d0d;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.matrix-widget__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
}

.matrix-widget__controls {
    display: flex;
    gap: 8px;
}

.matrix-widget__minimize,
.matrix-widget__close {
    background: rgba(0, 0, 0, 0.1);
    border: none;
    color: #0d0d0d;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.matrix-widget__minimize:hover,
.matrix-widget__close:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* Content area */
.matrix-widget__content {
    height: calc(100% - 56px);
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
}

.matrix-widget--minimized .matrix-widget__content {
    display: none;
}

/* Messages area */
.matrix-widget__messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #0f0f0f;
}

.matrix-widget__messages::-webkit-scrollbar {
    width: 6px;
}

.matrix-widget__messages::-webkit-scrollbar-track {
    background: transparent;
}

.matrix-widget__messages::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

/* Welcome message */
.matrix-widget__welcome {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

.matrix-widget__welcome-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.matrix-widget__welcome-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #e0e0e0;
}

.matrix-widget__welcome-text {
    font-size: 14px;
    line-height: 1.5;
    color: #888;
}

/* Messages */
.matrix-widget__message {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.matrix-widget__message--user {
    align-items: flex-end;
}

.matrix-widget__message--agent {
    align-items: flex-start;
}

.matrix-widget__message-content {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
}

.matrix-widget__message--user .matrix-widget__message-content {
    background: linear-gradient(135deg, #20cfcf 0%, #1ab3b3 100%);
    color: #0d0d0d;
    border-bottom-right-radius: 4px;
}

.matrix-widget__message--agent .matrix-widget__message-content {
    background: #2a2a2a;
    color: #e0e0e0;
    border: 1px solid #333;
    border-bottom-left-radius: 4px;
}

.matrix-widget__message-text {
    margin-bottom: 4px;
    line-height: 1.4;
}

.matrix-widget__message-time {
    font-size: 10px;
    opacity: 0.7;
}

/* Error message */
.matrix-widget__error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    margin-bottom: 12px;
    font-size: 13px;
}

/* Input area */
.matrix-widget__input-container {
    padding: 12px 16px;
    background: #1a1a1a;
    border-top: 1px solid #333;
}

/* Cooldown timer */
.matrix-widget__cooldown {
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 10px;
    text-align: center;
    font-size: 12px;
    color: #eab308;
}

.matrix-widget__cooldown-timer {
    font-weight: bold;
    color: #ef4444;
}

.matrix-widget__input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.matrix-widget__input {
    flex: 1;
    background: #0f0f0f;
    border: 1px solid #333;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
    max-height: 120px;
    min-height: 40px;
    color: #e0e0e0;
}

.matrix-widget__input:focus {
    border-color: #20cfcf;
}

.matrix-widget__input::placeholder {
    color: #666;
}

.matrix-widget__input:disabled {
    background-color: #1a1a1a;
    color: #666;
    cursor: not-allowed;
}

.matrix-widget__send {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #20cfcf 0%, #1ab3b3 100%);
    border: none;
    border-radius: 50%;
    color: #0d0d0d;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.matrix-widget__send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(32, 207, 207, 0.3);
}

.matrix-widget__send:active {
    transform: scale(0.95);
}

.matrix-widget__send:disabled {
    background: #333;
    cursor: not-allowed;
    opacity: 0.6;
}

.matrix-widget__send:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Status indicator */
.matrix-widget__status {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    font-size: 11px;
    font-weight: normal;
    opacity: 0.8;
}

.matrix-widget__status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}

.matrix-widget__status-dot--online {
    background-color: #22c55e;
}

.matrix-widget__status-dot--offline {
    background-color: #ef4444;
}

.matrix-widget__status-dot--transition {
    background-color: #eab308;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Responsive design */
@media (max-width: 480px) {
    .matrix-widget__container {
        width: calc(100vw - 40px);
        right: -10px;
        height: 70vh;
        max-height: 520px;
    }
    
    .matrix-widget--bottom-left .matrix-widget__container {
        left: -10px;
        right: auto;
    }
}

