/**
 * MaaS Admin Dashboard - CSS Styles
 * Omnichannel Gateway Administration Interface
 */

/* ==================== CSS Variables ==================== */
:root {
    --admin-sidebar-width: 260px;
    --admin-topnav-height: 60px;
    --admin-bg: #f5f7fa;
    --admin-sidebar-bg: #1e2937;
    --admin-sidebar-text: #94a3b8;
    --admin-sidebar-active: #3b82f6;
    --admin-card-bg: #ffffff;
    --admin-border: #e2e8f0;
    --admin-text: #1e293b;
    --admin-text-muted: #64748b;
    --admin-primary: #3b82f6;
    --admin-success: #22c55e;
    --admin-warning: #f59e0b;
    --admin-danger: #ef4444;
}

.dark-theme {
    --admin-bg: #0f172a;
    --admin-sidebar-bg: #1e293b;
    --admin-card-bg: #1e293b;
    --admin-border: #334155;
    --admin-text: #f1f5f9;
    --admin-text-muted: #94a3b8;
}

/* ==================== Base Layout ==================== */
.admin-body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--admin-bg);
    color: var(--admin-text);
    min-height: 100vh;
}

.admin-layout {
    display: flex;
    min-height: calc(100vh - var(--admin-topnav-height));
    margin-top: var(--admin-topnav-height);
}

/* ==================== Top Navigation ==================== */
.admin-topnav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--admin-topnav-height);
    background: var(--admin-card-bg);
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
}

.topnav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 600;
}

.brand-icon {
    font-size: 24px;
}

.topnav-links {
    display: flex;
    gap: 20px;
}

.topnav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    color: var(--admin-text);
    transition: background 0.2s;
}

.topnav-link:hover {
    background: var(--admin-bg);
}

.topnav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ==================== Sidebar ==================== */
.admin-sidebar {
    width: var(--admin-sidebar-width);
    min-width: var(--admin-sidebar-width);
    background: var(--admin-sidebar-bg);
    padding: 20px 0;
    overflow-y: auto;
    height: calc(100vh - var(--admin-topnav-height));
    position: fixed;
    left: 0;
}

.sidebar-nav {
    padding: 0 12px;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--admin-sidebar-text);
    padding: 8px 12px;
    margin: 0;
    opacity: 0.7;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--admin-sidebar-text);
    transition: all 0.2s;
    margin-bottom: 4px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.nav-item.active {
    background: var(--admin-sidebar-active);
    color: #fff;
}

.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-text {
    flex: 1;
    font-size: 14px;
}

.nav-badge {
    background: var(--admin-danger);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* ==================== Main Content ==================== */
.admin-main {
    flex: 1;
    margin-left: var(--admin-sidebar-width);
    padding: 24px;
    min-height: calc(100vh - var(--admin-topnav-height));
}

.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
}

.section-header {
    margin-bottom: 24px;
}

.section-header h1 {
    margin: 0 0 8px 0;
    font-size: 28px;
    font-weight: 600;
}

.section-subtitle {
    color: var(--admin-text-muted);
    margin: 0;
}

.section-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

/* ==================== KPI Cards ==================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--admin-card-bg);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.kpi-icon {
    font-size: 36px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--admin-bg);
    border-radius: 12px;
}

.kpi-content {
    flex: 1;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
}

.kpi-label {
    color: var(--admin-text-muted);
    font-size: 14px;
}

.kpi-trend {
    font-size: 14px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 6px;
}

.kpi-trend.up { color: var(--admin-success); background: rgba(34, 197, 94, 0.1); }
.kpi-trend.down { color: var(--admin-danger); background: rgba(239, 68, 68, 0.1); }

.kpi-status {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
}

.kpi-status.online { background: var(--admin-success); color: #fff; }

/* ==================== Charts ==================== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: var(--admin-card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.chart-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chart-select {
    padding: 6px 12px;
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    background: var(--admin-card-bg);
    color: var(--admin-text);
    font-size: 13px;
}

.chart-container {
    min-height: 200px;
}

.chart-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--admin-text-muted);
}

/* Simple Chart Styles */
.simple-chart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chart-bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart-label {
    width: 100px;
    font-size: 13px;
    color: var(--admin-text-muted);
    text-transform: capitalize;
}

.chart-bar-container {
    flex: 1;
    height: 24px;
    background: var(--admin-bg);
    border-radius: 4px;
    overflow: hidden;
}

.chart-bar {
    height: 100%;
    background: var(--admin-primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.chart-value {
    width: 50px;
    text-align: right;
    font-size: 14px;
    font-weight: 600;
}

/* ==================== SLA Section ==================== */
.card {
    background: var(--admin-card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.sla-metrics {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.sla-metric {
    text-align: center;
}

.sla-ring {
    position: relative;
    width: 100px;
    height: 100px;
}

.sla-ring svg {
    transform: rotate(-90deg);
}

.sla-ring-bg {
    fill: none;
    stroke: var(--admin-bg);
    stroke-width: 3;
}

.sla-ring-fill {
    fill: none;
    stroke: var(--admin-success);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease;
}

.sla-percent {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    font-weight: 700;
}

.sla-label {
    margin-top: 8px;
    font-size: 14px;
    color: var(--admin-text-muted);
}

.sla-warnings {
    flex: 1;
}

.sla-warnings h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
}

.sla-warnings-list {
    max-height: 150px;
    overflow-y: auto;
}

/* ==================== Activity List ==================== */
.activity-list {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--admin-border);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item.unread {
    background: rgba(59, 130, 246, 0.05);
    margin: 0 -20px;
    padding: 12px 20px;
}

.activity-icon {
    font-size: 20px;
    width: 32px;
    text-align: center;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.activity-message {
    font-size: 13px;
    color: var(--admin-text-muted);
}

.activity-time {
    font-size: 12px;
    color: var(--admin-text-muted);
    white-space: nowrap;
}

/* ==================== Health Cards ==================== */
.health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.health-card {
    background: var(--admin-card-bg);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.health-status {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.health-status.checking { background: var(--admin-warning); animation: pulse 1s infinite; }
.health-status.healthy { background: var(--admin-success); }
.health-status.unhealthy { background: var(--admin-danger); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.health-info {
    flex: 1;
}

.health-info h3 {
    margin: 0 0 4px 0;
    font-size: 15px;
}

.health-details {
    font-size: 13px;
    color: var(--admin-text-muted);
    margin: 0;
}

.health-metrics {
    font-size: 13px;
    color: var(--admin-text-muted);
}

/* ==================== Filters Bar ==================== */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--admin-card-bg);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--admin-text-muted);
}

.filter-select,
.filter-input {
    padding: 8px 12px;
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    background: var(--admin-card-bg);
    color: var(--admin-text);
    font-size: 14px;
    min-width: 150px;
}

.search-group {
    flex: 1;
    min-width: 200px;
}

.search-group .filter-input {
    width: 100%;
}

/* ==================== Data Table ==================== */
.data-table-container {
    background: var(--admin-card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--admin-border);
}

.data-table th {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--admin-text-muted);
    background: var(--admin-bg);
}

.data-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

.data-table .empty-row td {
    text-align: center;
    padding: 40px;
    color: var(--admin-text-muted);
}

.ticket-subject {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-link {
    color: var(--admin-primary);
    text-decoration: none;
    font-weight: 500;
}

.ticket-link:hover {
    text-decoration: underline;
}

.actions-cell {
    display: flex;
    gap: 8px;
}

/* Status & Priority Badges */
.status-badge,
.priority-badge,
.sla-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.status-open { background: rgba(59, 130, 246, 0.1); color: var(--admin-primary); }
.status-in_progress { background: rgba(245, 158, 11, 0.1); color: var(--admin-warning); }
.status-waiting { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.status-resolved { background: rgba(34, 197, 94, 0.1); color: var(--admin-success); }
.status-closed { background: rgba(100, 116, 139, 0.1); color: var(--admin-text-muted); }

.priority-low { background: rgba(100, 116, 139, 0.1); color: var(--admin-text-muted); }
.priority-normal { background: rgba(59, 130, 246, 0.1); color: var(--admin-primary); }
.priority-high { background: rgba(245, 158, 11, 0.1); color: var(--admin-warning); }
.priority-urgent { background: rgba(239, 68, 68, 0.1); color: var(--admin-danger); }

.sla-ok { background: rgba(34, 197, 94, 0.1); color: var(--admin-success); }
.sla-breached { background: rgba(239, 68, 68, 0.1); color: var(--admin-danger); }
.sla-none { background: rgba(100, 116, 139, 0.1); color: var(--admin-text-muted); }

/* ==================== Pagination ==================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.pagination-info {
    font-size: 14px;
    color: var(--admin-text-muted);
}

/* ==================== Agent Cards ==================== */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.agent-card {
    background: var(--admin-card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.agent-avatar {
    position: relative;
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
}

.agent-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--admin-primary);
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    border-radius: 50%;
}

.agent-avatar .status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 3px solid var(--admin-card-bg);
}

.status-indicator.status-online { background: var(--admin-success); }
.status-indicator.status-busy { background: var(--admin-warning); }
.status-indicator.status-offline { background: var(--admin-text-muted); }

.agent-info {
    text-align: center;
    margin-bottom: 16px;
}

.agent-name {
    margin: 0 0 4px 0;
    font-size: 16px;
}

.agent-email {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: var(--admin-text-muted);
}

.agent-stats {
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 13px;
    color: var(--admin-text-muted);
}

.agent-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* ==================== Queue Cards ==================== */
.queues-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.queue-card {
    background: var(--admin-card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.queue-name {
    margin: 0;
    font-size: 18px;
}

.queue-priority {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.queue-description {
    color: var(--admin-text-muted);
    font-size: 14px;
    margin: 0 0 16px 0;
}

.queue-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    display: block;
}

.stat-label {
    font-size: 12px;
    color: var(--admin-text-muted);
}

.queue-actions {
    display: flex;
    gap: 8px;
}

/* ==================== Channel Cards ==================== */
.channel-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.channel-card {
    background: var(--admin-card-bg);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.channel-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.channel-card h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
}

.channel-card p {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: var(--admin-text-muted);
}

.channel-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.channel-status.status-healthy { background: rgba(34, 197, 94, 0.1); color: var(--admin-success); }
.channel-status.status-error { background: rgba(239, 68, 68, 0.1); color: var(--admin-danger); }

/* ==================== Notification List ==================== */
.notification-list {
    background: var(--admin-card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.notification-item {
    display: flex;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--admin-border);
    transition: background 0.2s;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item.unread {
    background: rgba(59, 130, 246, 0.05);
}

.notification-item:hover {
    background: rgba(59, 130, 246, 0.08);
}

.notification-icon {
    font-size: 24px;
    width: 40px;
    text-align: center;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.notification-message {
    font-size: 14px;
    color: var(--admin-text-muted);
    margin-bottom: 8px;
}

.notification-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
}

.notification-time {
    color: var(--admin-text-muted);
}

.notification-priority {
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: capitalize;
}

.notification-actions {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

/* ==================== Settings Form ==================== */
.settings-form-content {
    background: var(--admin-card-bg);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-section {
    margin-bottom: 32px;
}

.form-section h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--admin-border);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--admin-border);
    border-radius: 6px;
    background: var(--admin-card-bg);
    color: var(--admin-text);
    font-size: 14px;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--admin-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--admin-border);
}

/* ==================== Config Sections ==================== */
.config-section {
    background: var(--admin-card-bg);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.config-section h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
}

.status-banner {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-weight: 500;
}

.status-banner.status-healthy { background: rgba(34, 197, 94, 0.1); color: var(--admin-success); }
.status-banner.status-warning { background: rgba(245, 158, 11, 0.1); color: var(--admin-warning); }

.config-details {
    font-size: 14px;
    color: var(--admin-text-muted);
}

.config-details code {
    background: var(--admin-bg);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
}

/* AI Capabilities */
.ai-capabilities {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.capability-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--admin-bg);
    border-radius: 8px;
}

.capability-icon {
    font-size: 20px;
}

.capability-name {
    flex: 1;
    font-weight: 500;
}

.capability-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
}

.capability-status.enabled { background: rgba(34, 197, 94, 0.1); color: var(--admin-success); }

/* ==================== Analytics ==================== */
.analytics-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--admin-card-bg);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-card h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: var(--admin-text-muted);
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
}

.performance-table {
    background: var(--admin-card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.performance-table h3 {
    margin: 0 0 16px 0;
}

/* ==================== Buttons ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--admin-primary);
    color: #fff;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: var(--admin-bg);
    color: var(--admin-text);
}

.btn-secondary:hover {
    background: var(--admin-border);
}

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

.btn-icon {
    background: none;
    border: none;
    padding: 6px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: var(--admin-bg);
}

.btn-link {
    background: none;
    border: none;
    color: var(--admin-primary);
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== Modal ==================== */
.modal-overlay {
    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: 2000;
}

.modal-overlay.hidden {
    display: none;
}

.modal-container {
    background: var(--admin-card-bg);
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--admin-border);
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--admin-text-muted);
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--admin-text);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

/* ==================== Toast ==================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--admin-card-bg);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast-icon {
    font-size: 18px;
}

.toast-message {
    font-size: 14px;
}

.toast-success { border-left: 4px solid var(--admin-success); }
.toast-error { border-left: 4px solid var(--admin-danger); }
.toast-info { border-left: 4px solid var(--admin-primary); }

/* ==================== Utility Classes ==================== */
.loading-state,
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--admin-text-muted);
}

.empty-state.error {
    color: var(--admin-danger);
}

.text-muted {
    color: var(--admin-text-muted);
}

.hidden {
    display: none !important;
}

/* ==================== Ticket Details ==================== */
.ticket-details {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-row {
    display: flex;
    gap: 16px;
}

.detail-row.full-width {
    flex-direction: column;
}

.detail-label {
    font-weight: 500;
    color: var(--admin-text-muted);
    min-width: 100px;
}

.detail-value {
    flex: 1;
}

.detail-value.description {
    background: var(--admin-bg);
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    white-space: pre-wrap;
}

/* ==================== Responsive ==================== */
@media (max-width: 1024px) {
    .admin-sidebar {
        width: 200px;
        min-width: 200px;
    }

    .admin-main {
        margin-left: 200px;
    }

    .nav-text {
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        position: fixed;
        transform: translateX(-100%);
        z-index: 1100;
        width: 260px;
        transition: transform 0.3s ease;
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
    }

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

    .sla-metrics {
        flex-direction: column;
        align-items: center;
    }

    .filters-bar {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .data-table {
        font-size: 13px;
    }

    .data-table th,
    .data-table td {
        padding: 8px;
    }

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