/* Amanda Dashboard Styles */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    margin-bottom: 30px;
}

header h1 {
    font-size: 2rem;
    color: var(--gray-900);
}

.subtitle {
    color: var(--gray-500);
    font-size: 1rem;
}

.back-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.875rem;
    display: inline-block;
    margin-bottom: 10px;
}

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

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.metric-card.small {
    padding: 15px;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.metric-card.small .metric-value {
    font-size: 1.5rem;
}

.metric-label {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-top: 5px;
}

/* Tickets Table */
.tickets-section {
    margin-bottom: 30px;
}

.tickets-section h2 {
    font-size: 1.25rem;
    margin-bottom: 15px;
}

.tickets-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-collapse: collapse;
    overflow: hidden;
}

.tickets-table th,
.tickets-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.tickets-table th {
    background: var(--gray-100);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.tickets-table tbody tr:hover {
    background: var(--gray-50);
}

.tickets-table tbody tr:last-child td {
    border-bottom: none;
}

.tickets-table a {
    color: var(--primary);
    text-decoration: none;
}

.tickets-table a:hover {
    text-decoration: underline;
}

.loading {
    color: var(--gray-500);
    text-align: center;
    padding: 20px;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-new { background: var(--gray-200); color: var(--gray-700); }
.status-acknowledged { background: #dbeafe; color: #1e40af; }
.status-in_progress { background: #fef3c7; color: #92400e; }
.status-staging_complete { background: #d1fae5; color: #065f46; }
.status-approved { background: #dcfce7; color: #166534; }
.status-live_complete { background: #bbf7d0; color: #15803d; }
.status-closed { background: var(--gray-200); color: var(--gray-500); }

/* Urgency Badges */
.urgency-normal { }
.urgency-high { color: var(--warning); font-weight: 600; }
.urgency-critical { color: var(--danger); font-weight: 700; }

/* Timeline */
.timeline-section {
    margin-bottom: 30px;
}

.timeline {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.timeline-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--gray-200);
}

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

.timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    margin-top: 5px;
}

.timeline-dot.customer { background: var(--success); }
.timeline-dot.agent { background: var(--primary); }
.timeline-dot.amanda { background: #8b5cf6; }
.timeline-dot.system { background: var(--gray-400); }

.timeline-content {
    flex: 1;
}

.timeline-time {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.timeline-message {
    color: var(--gray-700);
}

.timeline-actor {
    font-weight: 600;
    color: var(--gray-900);
}

.timeline-duration {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: var(--gray-500);
    padding: 10px 0 10px 27px;
}

.timeline-duration::before {
    content: '↓';
}

/* Ticket Info */
.ticket-info {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.ticket-info h3 {
    font-size: 1.25rem;
    margin-bottom: 15px;
}

.ticket-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.ticket-info-item {
    padding: 10px 0;
}

.ticket-info-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.ticket-info-value {
    color: var(--gray-900);
}

/* Manual Entry Form */
.manual-entry {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.manual-entry h2 {
    font-size: 1.25rem;
    margin-bottom: 15px;
}

.form-row {
    margin-bottom: 15px;
}

.form-row label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 5px;
    color: var(--gray-700);
}

.form-row input,
.form-row select {
    width: 100%;
    max-width: 300px;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 1rem;
}

.form-row input:focus,
.form-row select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn:hover {
    background: var(--primary-dark);
}

#form-message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
}

#form-message.success {
    background: #dcfce7;
    color: #166534;
}

#form-message.error {
    background: #fef2f2;
    color: #dc2626;
}

/* Charts */
.charts-section {
    margin-bottom: 30px;
}

.charts-section h2 {
    font-size: 1.25rem;
    margin-bottom: 15px;
}

.chart-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    min-height: 200px;
}

.chart-bar {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.chart-bar-label {
    width: 150px;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.chart-bar-track {
    flex: 1;
    height: 24px;
    background: var(--gray-100);
    border-radius: 4px;
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    min-width: 30px;
}

/* Footer */
footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
    text-align: center;
    color: var(--gray-500);
    font-size: 0.875rem;
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tickets-table {
        font-size: 0.875rem;
    }
    
    .tickets-table th,
    .tickets-table td {
        padding: 8px 10px;
    }
}
