/* Base Styling */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f8f9fa;
    color: #495057;
    line-height: 1.6;
}

/* Navigation */
.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.navbar {
    box-shadow: var(--shadow);
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%) !important;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 0.375rem;
}

/* Cards */
.card {
    box-shadow: var(--shadow);
    border: none;
    border-radius: 0.75rem;
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background-color: rgba(0, 123, 255, 0.03);
    border-bottom: 1px solid rgba(0, 123, 255, 0.1);
    font-weight: 600;
    padding: 1rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* Agent Type Cards */
.agent-type-card {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    margin-bottom: 1rem;
}

.agent-type-card:hover {
    border-color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.02);
}

.agent-type-card.border-primary {
    border-color: var(--primary-color) !important;
    background-color: rgba(0, 123, 255, 0.05) !important;
}

.agent-type-radio {
    position: absolute;
    top: 1rem;
    right: 1rem;
    transform: scale(1.2);
}

/* Status Badges */
.badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-weight: 500;
    letter-spacing: 0.025em;
}

/* Form Controls */
.form-control, .form-select {
    border: 1px solid #e3e6f0;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.1);
}

.form-label {
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

/* Buttons */
.btn {
    border-radius: 0.5rem;
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 123, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 123, 255, 0.4);
}

.btn-outline-primary {
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.btn-group .btn {
    margin: 0 2px;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

/* Tables */
.table {
    background-color: white;
    border-radius: 0.75rem;
    overflow: hidden;
}

.table thead th {
    background-color: #f8f9fa;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    padding: 1rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    border-top: 1px solid #f1f3f4;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.02);
}

/* Dashboard Stats Cards */
.stats-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
    color: white;
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stats-card h3 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stats-card p {
    font-size: 1rem;
    opacity: 0.9;
    margin: 0;
}

/* Status Indicators */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-indicator.active {
    background-color: var(--success-color);
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.3);
}

.status-indicator.paused {
    background-color: var(--warning-color);
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.3);
}

.status-indicator.disabled {
    background-color: var(--danger-color);
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.3);
}

/* Conversation UI */
.conversation-thread {
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 0.75rem;
}

.message-bubble {
    max-width: 70%;
    margin-bottom: 1rem;
    border-radius: 1rem;
    padding: 0.75rem 1rem;
    position: relative;
}

.message-bubble.incoming {
    background-color: white;
    border: 1px solid #e9ecef;
    margin-right: auto;
}

.message-bubble.outgoing {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
    color: white;
    margin-left: auto;
}

.message-time {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.25rem;
}

/* Loading States */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.spinner-border {
    width: 2rem;
    height: 2rem;
}

/* File Upload */
.file-upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-upload-area:hover {
    border-color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.02);
}

.file-upload-area.dragover {
    border-color: var(--primary-color);
    background-color: rgba(0, 123, 255, 0.05);
}

/* Modals */
.modal-content {
    border: none;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid #f1f3f4;
    padding: 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #f1f3f4;
    padding: 1.5rem;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 0.75rem;
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow);
}

.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    color: #0c5460;
}

/* Progress Bars */
.progress {
    height: 0.5rem;
    border-radius: 0.5rem;
    background-color: #e9ecef;
}

.progress-bar {
    border-radius: 0.5rem;
    transition: width 0.6s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }

    .btn-group .btn {
        margin: 2px 1px;
    }

    .table-responsive {
        border-radius: 0.75rem;
    }

    .stats-card {
        padding: 1.5rem;
    }

    .stats-card h3 {
        font-size: 2rem;
    }

    .message-bubble {
        max-width: 90%;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 0 0.75rem;
    }

    .navbar-brand {
        font-size: 1.25rem;
    }

    .card {
        margin-bottom: 1rem;
    }

    .btn {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
    }

    .form-control, .form-select {
        font-size: 0.85rem;
        padding: 0.625rem 0.875rem;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1a1a1a;
        --card-bg: #2d2d2d;
        --text-color: #e9ecef;
        --border-color: #404040;
    }

    body {
        background-color: var(--bg-color);
        color: var(--text-color);
    }

    .card {
        background-color: var(--card-bg);
        border: 1px solid var(--border-color);
    }

    .table {
        background-color: var(--card-bg);
        color: var(--text-color);
    }

    .form-control, .form-select {
        background-color: var(--card-bg);
        border-color: var(--border-color);
        color: var(--text-color);
    }

    .modal-content {
        background-color: var(--card-bg);
        color: var(--text-color);
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

.bounce-in {
    animation: bounceIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-sm {
    box-shadow: var(--shadow) !important;
}

.shadow-lg {
    box-shadow: var(--shadow-lg) !important;
}

.border-radius-lg {
    border-radius: 1rem !important;
}

.font-weight-bold {
    font-weight: 700 !important;
}

.font-weight-medium {
    font-weight: 500 !important;
}

.cursor-pointer {
    cursor: pointer;
}

.position-relative {
    position: relative;
}

.z-index-10 {
    z-index: 10;
}
