/* 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-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.login-box h1 {
    font-size: 24px;
    margin-bottom: 10px;
    color: #667eea;
}

.login-box .subtitle {
    color: #999;
    margin-bottom: 30px;
    font-size: 14px;
}

/* Navigation */
.navbar {
    background-color: #2c3e50;
    color: white;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.navbar-brand h2 {
    margin: 0;
    font-size: 20px;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    font-size: 14px;
    opacity: 0.9;
}

/* Main Layout */
.container {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    gap: 20px;
    padding: 20px;
    min-height: calc(100vh - 60px);
}

.sidebar {
    width: 200px;
    flex-shrink: 0;
}

.menu {
    list-style: none;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.menu li {
    border-bottom: 1px solid #eee;
}

.menu li:last-child {
    border-bottom: none;
}

.menu a {
    display: block;
    padding: 12px 15px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
}

.menu a:hover,
.menu a.active {
    background-color: #667eea;
    color: white;
}

.content {
    flex: 1;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.content h1 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.content h2 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 20px;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h1 {
    margin: 0;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.card {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #eee;
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 18px;
}

.card p {
    color: #666;
    margin-bottom: 15px;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Messages List */
.messages-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.message-card {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 12px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: auto;
    gap: 6px;
}

.message-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.message-card h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 15px;
    flex-shrink: 0;
    line-height: 1.3;
}

.message-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.message-card-info {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
}

.message-card .badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 10px;
    white-space: nowrap;
    line-height: 1.2;
}

.badge-text {
    background-color: #e8f4f8;
    color: #0066cc;
}

.badge-embed {
    background-color: #f0e8f8;
    color: #6600cc;
}

.badge-both {
    background-color: #e8f8e8;
    color: #00cc00;
}

.badge-active {
    background-color: #e8f8e8;
    color: #00aa00;
}

.badge-inactive {
    background-color: #f8e8e8;
    color: #cc0000;
}

.message-preview {
    background: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 20px;
    color: #666;
    max-height: 50px;
    overflow: hidden;
    border-left: 3px solid #667eea;
    flex: 1;
    line-height: 1.4;
}

.message-meta {
    font-size: 11px;
    color: #999;
}

.message-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.message-actions .btn {
    font-size: 11px;
    padding: 5px 10px;
    white-space: nowrap;
}

.loading {
    text-align: center;
    color: #999;
    padding: 40px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="url"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus,
.form-group input[type="url"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input[type="checkbox"],
.form-group input[type="radio"] {
    margin-right: 8px;
    cursor: pointer;
}

.form-group label input[type="checkbox"],
.form-group label input[type="radio"] {
    margin-right: 8px;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #999;
    font-size: 12px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

.login-form {
    margin-top: 20px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #667eea;
    color: white;
}

.btn-primary:hover {
    background-color: #5568d3;
}

.btn-secondary {
    background-color: #ccc;
    color: #333;
}

.btn-secondary:hover {
    background-color: #aaa;
}

.btn-success {
    background-color: #27ae60;
    color: white;
}

.btn-success:hover {
    background-color: #229954;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    overflow-y: auto;
}

.modal.show {
    display: block;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 30px;
    border: 1px solid #888;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
}

/* Fieldset */
fieldset {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
}

legend {
    padding: 0 10px;
    color: #2c3e50;
    font-weight: 500;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 4px;
    border-left: 4px solid;
}

.alert-error {
    background-color: #fdeaea;
    color: #c53030;
    border-left-color: #c53030;
}

.alert-success {
    background-color: #f0fff4;
    color: #22543d;
    border-left-color: #22543d;
}

.alert-warning {
    background-color: #fffaf0;
    color: #7c2d12;
    border-left-color: #7c2d12;
}

.alert-info {
    background-color: #ebf8ff;
    color: #2c5282;
    border-left-color: #2c5282;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .menu {
        display: flex;
        flex-wrap: wrap;
    }

    .menu li {
        border-bottom: none;
        border-right: 1px solid #eee;
        flex: 1;
    }

    .menu li:last-child {
        border-right: none;
    }

    .menu a {
        text-align: center;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header .btn {
        width: 100%;
        margin-top: 10px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .message-card {
        flex-direction: column;
    }

    .message-card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .message-card-info {
        width: 100%;
    }

    .message-actions {
        width: 100%;
        margin-top: 10px;
    }

    .message-actions .btn {
        flex: 1;
    }

    .navbar-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .navbar-menu {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .message-card {
        padding: 10px;
    }

    .message-card h4 {
        font-size: 14px;
    }

    .message-preview {
        font-size: 12px;
        max-height: 50px;
    }

    .message-actions .btn {
        padding: 4px 8px;
        font-size: 11px;
    }
}

/* Bot Status Styles */
.bot-status-summary {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.bot-status-summary h4 {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 16px;
}

.status-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.status-badge-online {
    background: #4CAF50;
    color: white;
}

.status-badge-offline {
    background: #f44336;
    color: white;
}

.status-badge-error {
    background: #ff9800;
    color: white;
}

.status-badge-idle {
    background: #2196F3;
    color: white;
}

.status-detail-link {
    display: inline-block;
    color: #667eea;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.status-detail-link:hover {
    text-decoration: underline;
}

.bot-status-unavailable {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px 15px;
    color: #666;
    font-size: 13px;
    text-align: center;
}

/* Login page bot status */
.login-page .bot-status-summary {
    margin-bottom: 30px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .status-badges {
        gap: 6px;
    }

    .status-badge {
        padding: 3px 10px;
        font-size: 11px;
    }
}
