/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f7f7f7;
    height: 100vh;
    overflow: hidden;
    color: #1d1c1d;
}

/* Chat Container - Slack/Telegram Style */
.chat-container {
    display: flex;
    height: 100vh;
    background: #ffffff;
}

/* Sidebar - Slack Style */
.chat-sidebar {
    width: 260px;
    background: #3f0e40;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #350d36;
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid #350d36;
    transition: background-color 0.2s ease;
}

.sidebar-header:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 1.2em;
    font-weight: 700;
    margin-bottom: 4px;
    color: #ffffff;
}

.sidebar-subtitle {
    font-size: 0.85em;
    color: #d1d2d3;
    opacity: 0.8;
}

/* Sidebar Metrics */
.sidebar-metrics {
    padding: 16px;
    border-bottom: 1px solid #350d36;
}

.sidebar-metric {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.sidebar-metric:last-child {
    margin-bottom: 0;
}

.metric-icon {
    font-size: 1.2em;
}

.metric-label-small {
    font-size: 0.75em;
    color: #d1d2d3;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value-small {
    font-size: 0.95em;
    font-weight: 600;
    color: #ffffff;
}

/* Sidebar Section */
.sidebar-section {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.sidebar-section h3 {
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #d1d2d3;
    margin-bottom: 12px;
    padding: 0 4px;
}

.step-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.step-item {
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.05);
    color: #d1d2d3;
    font-size: 0.9em;
}

.step-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.step-item.active {
    background: #1164a3;
    color: #ffffff;
}

.step-item.completed {
    opacity: 0.6;
}

.step-item.completed::before {
    content: '✓ ';
    color: #2eb886;
    font-weight: bold;
}

.step-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.step-status-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
}

.step-status-icon.pending {
    background: #6c757d;
}

.step-status-icon.in-progress {
    background: #ffc107;
    animation: pulse 2s infinite;
}

.step-status-icon.completed {
    background: #2eb886;
}

.step-status-icon.ready {
    background: #2eb886;
    animation: pulse 2s infinite;
}

.step-item.ready {
    border-left: 3px solid #2eb886;
    background: rgba(46, 184, 134, 0.1);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.step-item-name {
    font-weight: 500;
    flex: 1;
}

.step-item-role {
    font-size: 0.8em;
    opacity: 0.7;
    margin-top: 4px;
}

/* Main Chat Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

/* Chat Header */
.chat-header {
    height: 60px;
    background: #350d36;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid #350d36;
}

.chat-header-info h3 {
    font-size: 1em;
    font-weight: 700;
    margin-bottom: 2px;
}

.chat-status {
    font-size: 0.8em;
    color: #d1d2d3;
    opacity: 0.8;
}

.chat-header-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    background: transparent;
    border: none;
    color: #d1d2d3;
    font-size: 1.2em;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* Chat Messages Container */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f7f7f7;
    background-image: 
        repeating-linear-gradient(0deg, transparent, transparent 35px, rgba(0,0,0,.03) 35px, rgba(0,0,0,.03) 36px);
}

.chat-welcome {
    max-width: 800px;
    margin: 0 auto;
}

/* Message Bubbles - Slack/Telegram Style */
.message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth message appearance */
.message {
    animation: slideIn 0.3s ease-out;
}

/* Metric counter animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.metric-value-small {
    transition: all 0.3s ease;
}

.metric-value-small.updated {
    animation: countUp 0.5s ease-out;
    color: #2eb886;
}

/* Progress bar styles */
.workflow-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin: 12px 0;
}

.workflow-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2eb886 0%, #1ed760 100%);
    border-radius: 3px;
    transition: width 0.5s ease-out;
    box-shadow: 0 0 10px rgba(46, 184, 134, 0.5);
}

/* Step completion celebration */
@keyframes celebrate {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.step-item.completed-celebrating {
    animation: celebrate 0.6s ease-out;
}

/* Confetti animation (simple version) */
@keyframes confetti {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-200px) rotate(360deg);
        opacity: 0;
    }
}

.confetti-particle {
    position: fixed;
    width: 10px;
    height: 10px;
    background: #ff6b6b;
    animation: confetti 2s ease-out forwards;
    pointer-events: none;
    z-index: 10000;
}

/* Typing indicator */
@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

.typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 8px 12px;
    background: #e8e8e8;
    border-radius: 18px;
    margin: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #666;
    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;
}

/* Pulse animation for active step */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(46, 184, 134, 0.7);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(46, 184, 134, 0);
    }
}

.step-item.active {
    animation: pulse 2s infinite;
}

/* Success checkmark animation */
@keyframes checkmark {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.step-status-icon.completed {
    animation: checkmark 0.5s ease-out;
}

/* Button press animation */
@keyframes buttonPress {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.quick-reply-btn:active {
    animation: buttonPress 0.2s ease-out;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9em;
    flex-shrink: 0;
    color: #ffffff;
}

.message-avatar.manager {
    background: #611f69;
}

.message-avatar.supervisor {
    background: #1264a3;
}

.message-avatar.employee {
    background: #2eb886;
}

.message-avatar.system {
    background: #e01e5a;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.message-author {
    font-weight: 700;
    font-size: 0.95em;
    color: #1d1c1d;
}

.message-time {
    font-size: 0.75em;
    color: #616061;
}

.message-bubble {
    background: #ffffff;
    padding: 12px 16px;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    line-height: 1.5;
    color: #1d1c1d;
    word-wrap: break-word;
}

.message-bubble.system {
    background: #f8f8f8;
    border-left: 3px solid #e01e5a;
}

.message-bubble.urgent {
    background: #fff3cd;
    border-left: 3px solid #ffc107;
}

.message-bubble.success {
    background: #d4edda;
    border-left: 3px solid #28a745;
}

.message-text {
    margin-bottom: 8px;
}

.message-meta {
    font-size: 0.85em;
    color: #616061;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e8e8e8;
}

.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

/* Quick Reply Buttons - Telegram Style */
.quick-replies {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 0;
}

.quick-reply-btn {
    background: #ffffff;
    border: 1px solid #e8e8e8;
    border-radius: 16px;
    padding: 8px 16px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s;
    color: #1d1c1d;
    font-weight: 500;
}

.quick-reply-btn:hover {
    background: #f0f0f0;
    border-color: #d0d0d0;
}

.quick-reply-btn.approve {
    background: #2eb886;
    color: #ffffff;
    border-color: #2eb886;
}

.quick-reply-btn.approve:hover {
    background: #28a875;
}

.quick-reply-btn.deny {
    background: #e01e5a;
    color: #ffffff;
    border-color: #e01e5a;
}

.quick-reply-btn.deny:hover {
    background: #c91a4f;
}

/* Chat Input Area */
.chat-input-area {
    background: #ffffff;
    border-top: 1px solid #e8e8e8;
    padding: 16px 20px;
}

/* Welcome Message */
.welcome-message {
    background: #ffffff;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-width: 700px;
    margin: 40px auto;
}

.welcome-message h2 {
    font-size: 1.8em;
    margin-bottom: 16px;
    color: #1d1c1d;
}

.welcome-message h3 {
    font-size: 1.2em;
    margin-bottom: 12px;
    color: #1d1c1d;
}

.welcome-message p {
    font-size: 0.95em;
    color: #616061;
    line-height: 1.6;
    margin-bottom: 16px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin: 4px;
}

.btn-primary {
    background: #611f69;
    color: white;
}

.btn-primary:hover {
    background: #4a154b;
}

.btn-primary:disabled {
    background: #8b5a8c;
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: #616061;
    color: white;
}

.btn-secondary:hover {
    background: #4a4a4a;
}

.btn-success {
    background: #2eb886;
    color: white;
}

.btn-success:hover {
    background: #28a875;
}

.btn-danger {
    background: #e01e5a;
    color: white;
}

.btn-danger:hover {
    background: #c91a4f;
}

/* Receipt Modal */
.receipt-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.receipt-modal-content {
    background: #ffffff;
    border-radius: 8px;
    max-width: 800px;
    max-height: 90vh;
    width: 90%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.receipt-modal-header {
    padding: 20px;
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.receipt-modal-header h2 {
    font-size: 1.3em;
    color: #1d1c1d;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2em;
    color: #616061;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f0f0f0;
    color: #1d1c1d;
}

.receipt-content {
    padding: 20px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    line-height: 1.8;
    white-space: pre-wrap;
    color: #1d1c1d;
}

/* Info Boxes */
.info-box {
    background: #f8f9fa;
    border-left: 4px solid #611f69;
    padding: 16px;
    border-radius: 4px;
    margin: 16px 0;
}

.info-box h3 {
    color: #611f69;
    margin-bottom: 8px;
    font-size: 1em;
}

.info-box p {
    color: #616061;
    font-size: 0.9em;
    line-height: 1.6;
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar,
.sidebar-section::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track,
.sidebar-section::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb,
.sidebar-section::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.sidebar-section::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-sidebar {
        width: 200px;
    }
    
    .welcome-message {
        padding: 20px;
        margin: 20px;
    }
}
