/* ==================== Global Styles ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* ==================== Header ==================== */
.header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

/* ==================== Stats Section ==================== */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-card h3 {
    font-size: 0.9rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
}

.stat-value.status {
    font-size: 1.3rem;
}

.stat-value.status.online {
    color: #22c55e;
}

.stat-value.status.offline {
    color: #ef4444;
}

.stat-value.loading {
    color: #999;
}

/* Highlight animation for changed stats */
@keyframes highlightYellow {
    0% {
        background-color: #ffff99;
    }
    100% {
        background-color: transparent;
    }
}

.stat-value.highlight {
    animation: highlightYellow 1s ease-out;
    border-radius: 4px;
    padding: 0 4px;
}

/* ==================== Messages Section ==================== */
.messages-section {
    background: white;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.messages-section h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5rem;
}

/* Input Group */
.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

#message-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

#message-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#send-btn {
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

#send-btn:active {
    transform: translateY(0);
}

/* Messages Container */
.messages-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
}

.loading {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-style: italic;
}

/* Message Item */
.message {
    background: white;
    border-left: 4px solid #667eea;
    padding: 15px;
    margin-bottom: 12px;
    border-radius: 6px;
    animation: slideInUp 0.3s ease;
}

.message:last-child {
    margin-bottom: 0;
}

.message-content {
    color: #333;
    font-size: 1rem;
    margin-bottom: 8px;
    word-break: break-word;
}

.message-time {
    font-size: 0.85rem;
    color: #999;
}

/* Scrollbar Styling */
.messages-container::-webkit-scrollbar {
    width: 8px;
}

.messages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.messages-container::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* ==================== API Documentation ==================== */
.api-docs {
    background: white;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.8s ease 0.2s both;
}

.api-docs h2 {
    margin-bottom: 20px;
    color: #333;
}

.api-docs ul {
    list-style: none;
}

.api-docs li {
    padding: 10px;
    background: #f8f9fa;
    margin-bottom: 8px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
}

.api-docs li strong {
    color: #667eea;
}

/* ==================== Footer ==================== */
.footer {
    text-align: center;
    color: white;
    padding: 20px;
    opacity: 0.9;
    font-size: 0.9rem;
}

/* ==================== Animations ==================== */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pulse-subtle {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.98);
    }
}

@keyframes statUpdate {
    0% {
        background-color: #fff3cd;
        transform: scale(1.05);
    }
    100% {
        background-color: white;
        transform: scale(1);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(30px);
    }
}

/* Stat updated highlight */
.stat-updated {
    animation: statUpdate 0.5s ease !important;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.3s ease;
    max-width: 300px;
    font-size: 0.95rem;
    font-weight: 500;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

/* ==================== Responsive Design ==================== */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .messages-section,
    .api-docs {
        padding: 20px;
    }

    .input-group {
        flex-direction: column;
    }

    #send-btn {
        width: 100%;
    }
}
