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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 100%;
    background: #fff;
    border-radius: 12px;
    margin: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.app-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e8e8e8;
    background: #fff;
}

.app-logo {
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

.app-title {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    margin-left: 10px;
    flex: 1;
}

.version-tag {
    font-size: 10px;
    color: #bbb;
    cursor: pointer;
    user-select: none;
}

/* 🌈 Easter egg: 5 clicks on the version tag toggles rainbow mode */
.rainbow-mode {
    animation: rainbow-bg 6s linear infinite;
}

@keyframes rainbow-bg {
    0%   { background: #ffadad; }
    16%  { background: #ffd6a5; }
    33%  { background: #fdffb6; }
    50%  { background: #caffbf; }
    66%  { background: #9bf6ff; }
    83%  { background: #bdb2ff; }
    100% { background: #ffc6ff; }
}

@media (prefers-reduced-motion: reduce) {
    .rainbow-mode { animation: none; background: #caffbf; }
}

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

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 8px;
}

.message-pane {
    padding: 8px 16px;
    overflow-y: auto;
}

.chat-message {
    border-radius: 12px;
    display: inline-block;
    padding: 10px 14px 22px;
    position: relative;
    max-width: 80%;
    margin: 4px 0;
    font-size: 14px;
    line-height: 1.4;
    clear: both;
    animation: bubble-pop-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bubble-pop-in {
    0%   { opacity: 0; transform: scale(0.6) translateY(10px); }
    60%  { opacity: 1; transform: scale(1.05) translateY(0); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .chat-message { animation: none; }
}

.chat-message p {
    white-space: pre-wrap;
    word-break: break-word;
}

.copy-btn {
    position: absolute;
    bottom: 4px;
    right: 6px;
    padding: 2px 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s;
    color: inherit;
}

.chat-message:hover .copy-btn,
.copy-btn:focus {
    opacity: 0.6;
}

.copy-btn:hover {
    opacity: 1 !important;
}

/* Preview bubble has the "✓ Traduction" label bottom-right — move copy to bottom-left */
.agent-preview .copy-btn {
    right: auto;
    left: 6px;
}

.customer {
    background-color: #f0f0f0;
    color: #2d3748;
    float: left;
    margin-right: 20%;
    border-bottom-left-radius: 4px;
}

.agent {
    background-color: #2d8a4e;
    color: #fff;
    float: right;
    margin-left: 20%;
    border-bottom-right-radius: 4px;
}

.agent-preview {
    background-color: #e6f7ed;
    color: #2d3748;
    float: right;
    margin-left: 20%;
    border: 2px solid #2d8a4e;
    border-radius: 12px;
    border-bottom-right-radius: 4px;
}

.agent-preview::after {
    content: '✓ Traduction';
    display: block;
    font-size: 10px;
    color: #2d8a4e;
    font-weight: 600;
    margin-top: 4px;
    text-align: right;
}

.compose-container {
    border-top: 1px solid #e8e8e8;
    padding: 8px 16px 12px;
    background: #fafafa;
}

.compose-input {
    width: 100%;
    min-height: 80px;
    max-height: 120px;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    resize: none;
    font-size: 14px;
    font-family: inherit;
    color: #333;
    background: #fff;
    margin-top: 4px;
    outline: none;
    transition: border-color 0.2s;
}

.compose-input:focus {
    border-color: #2d8a4e;
    box-shadow: 0 0 0 2px rgba(45, 138, 78, 0.1);
}

.compose-input::placeholder {
    color: #aaa;
}

.compose-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    justify-content: flex-end;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #2d8a4e;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover:not(:disabled) {
    background: #246e3f;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #fff;
    color: #2d8a4e;
    border: 1px solid #2d8a4e;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover:not(:disabled) {
    background: #e6f7ed;
}

button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.status-message {
    text-align: center;
    color: #888;
    font-size: 12px;
    padding: 6px;
    font-style: italic;
    clear: both;
}

.error-message {
    text-align: center;
    color: #c53030;
    background: #fff5f5;
    border: 1px solid #feb2b2;
    border-radius: 6px;
    font-size: 12px;
    padding: 8px 12px;
    margin: 8px 16px;
    clear: both;
}

.timestamp {
    font-size: 10px;
    color: #aaa;
    margin-top: 2px;
    clear: both;
}

.timestamp-left {
    float: left;
    padding-left: 4px;
}

.timestamp-right {
    float: right;
    padding-right: 4px;
}
