/* ===== Omni Portal - Bootstrap Overrides & Custom Styles ===== */

/* CSS Variables */
:root {
    --omni-primary: #4f46e5;
    --omni-primary-hover: #4338ca;
    --omni-primary-light: #e0e7ff;
    --omni-success: #10b981;
    --omni-danger: #ef4444;
    --omni-warning: #f59e0b;
    --omni-secondary: #6b7280;
    --omni-bg: #f8f9fc;
    --omni-surface: #ffffff;
    --omni-text: #1e293b;
    --omni-text-muted: #64748b;
    --omni-border: #e2e8f0;
    --omni-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --omni-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --omni-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --omni-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --omni-radius: 0.75rem;
    --omni-radius-sm: 0.5rem;

    /* Bootstrap overrides */
    --bs-primary: #4f46e5;
    --bs-primary-rgb: 79, 70, 229;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--omni-bg);
    color: var(--omni-text);
}

/* ===== Bootstrap Component Overrides ===== */

/* Buttons */
.btn-primary {
    background-color: var(--omni-primary);
    border-color: var(--omni-primary);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--omni-primary-hover);
    border-color: var(--omni-primary-hover);
}
.btn-primary:active {
    background-color: #3730a3;
    border-color: #3730a3;
}
.btn-outline-primary {
    color: var(--omni-primary);
    border-color: var(--omni-primary);
}
.btn-outline-primary:hover {
    background-color: var(--omni-primary);
    border-color: var(--omni-primary);
}
.btn {
    border-radius: var(--omni-radius-sm);
    font-weight: 500;
}

/* Cards */
.card {
    border: none;
    border-radius: var(--omni-radius);
    box-shadow: var(--omni-shadow);
    transition: box-shadow 0.2s ease;
}
.card:hover {
    box-shadow: var(--omni-shadow-md);
}
.card-header {
    background-color: transparent;
    border-bottom: 1px solid var(--omni-border);
    font-weight: 600;
}

/* Tables */
.table > thead {
    background-color: var(--omni-bg);
}
.table > thead > tr > th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--omni-text-muted);
    border-bottom-width: 1px;
}

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

/* Forms */
.form-control:focus, .form-select:focus {
    border-color: var(--omni-primary);
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.15);
}
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
    color: var(--omni-primary);
}

/* Badges */
.badge {
    font-weight: 500;
    border-radius: 0.375rem;
}

/* Toast */
.toast {
    border-radius: var(--omni-radius-sm);
}

/* ===== Login Page ===== */
.login-wrapper {
    min-height: 100vh;
}
.login-brand-panel {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    color: white;
}
.login-brand-panel h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}
.login-brand-panel p {
    font-size: 1.125rem;
    opacity: 0.85;
}
.login-brand-icon {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    font-size: 2.5rem;
}
.login-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.login-card {
    max-width: 420px;
    width: 100%;
    animation: fadeInUp 0.4s ease;
}

/* ===== Admin Sidebar ===== */
.admin-sidebar {
    width: 260px;
    min-height: 100vh;
    background: #1e1b4b;
    color: white;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
}
.sidebar-brand {
    padding: 1.25rem 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.sidebar-nav {
    padding: 1rem 0;
    flex-grow: 1;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: all 0.15s ease;
}
.sidebar-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.08);
}
.sidebar-link.active {
    color: white;
    background: rgba(79, 70, 229, 0.4);
    border-right: 3px solid #a5b4fc;
}
.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Admin main content offset for sidebar */
.admin-main {
    margin-left: 260px;
    min-height: 100vh;
}

/* Admin top bar */
.admin-topbar {
    background: white;
    border-bottom: 1px solid var(--omni-border);
    padding: 0.75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

/* Stat cards */
.stat-card {
    border-left: 4px solid transparent;
}
.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--omni-text);
}
.stat-card .stat-label {
    font-size: 0.8125rem;
    color: var(--omni-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===== Tenant Dashboard ===== */
.tenant-topbar {
    background: white;
    border-bottom: 1px solid var(--omni-border);
    box-shadow: var(--omni-shadow-sm);
}
.tenant-topbar .navbar-brand {
    color: var(--omni-primary);
    font-weight: 700;
    font-size: 1.25rem;
}
.avatar-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 600;
}

/* ===== Integration Status ===== */
.integration-status-card {
    border-radius: var(--omni-radius-sm);
    padding: 1rem;
}
.integration-status-card.connected {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
}
.integration-status-card.disconnected {
    background-color: #fffbeb;
    border: 1px solid #fde68a;
}

/* ===== Log Styles ===== */
.log-item {
    border: 1px solid var(--omni-border);
    border-radius: var(--omni-radius-sm);
    margin-bottom: 0.75rem;
    overflow: hidden;
}
.log-header {
    padding: 0.75rem 1rem;
    background: var(--omni-bg);
    cursor: pointer;
    transition: background 0.15s ease;
}
.log-header:hover {
    background: #e2e8f0;
}
.log-transcript {
    display: none;
    padding: 1rem;
    border-top: 1px solid var(--omni-border);
    max-height: 300px;
    overflow-y: auto;
    background: #fafbfc;
}
.log-transcript.open {
    display: block;
}
.transcript-message {
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--omni-radius-sm);
}
.transcript-message.agent {
    background: var(--omni-primary-light);
    margin-right: 20%;
}
.transcript-message.user {
    background: #d1fae5;
    margin-left: 20%;
}
.transcript-role {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--omni-text-muted);
    margin-bottom: 0.25rem;
}
.audio-player {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--omni-border);
}

/* ===== Empty States ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}
.empty-state .empty-icon {
    font-size: 3rem;
    color: var(--omni-text-muted);
    opacity: 0.5;
}
.empty-state h5 {
    margin-top: 1rem;
    color: var(--omni-text-muted);
}
.empty-state p {
    color: var(--omni-text-muted);
    font-size: 0.875rem;
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.animate-fade-in {
    animation: fadeIn 0.3s ease;
}

/* ===== Responsive ===== */
@media (max-width: 991.98px) {
    .admin-sidebar {
        display: none;
    }
    .admin-main {
        margin-left: 0;
    }
    /* Mobile offcanvas sidebar styles */
    .offcanvas.admin-offcanvas {
        background: #1e1b4b;
        color: white;
        max-width: 280px;
    }
}

@media (max-width: 767.98px) {
    .login-brand-panel {
        display: none !important;
    }
    .stat-card .stat-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 575.98px) {
    .btn-action-text {
        display: none;
    }
}
