/* Admin Dashboard Styles - Tailwind-inspired utility classes */

/* Reset and Base */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    color: #1f2937;
    background-color: #f3f4f6;
    margin: 0;
    padding: 0;
}

a {
    color: #5c6ac4;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Layout */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Sidebar Layout */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 256px;
    background-color: #1f2937;
    color: white;
    flex-shrink: 0;
}

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

.sidebar-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: #5c6ac4;
}

.sidebar-header p {
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
    color: #9ca3af;
}

.sidebar-nav {
    padding: 1rem 0;
}

.nav-item {
    display: block;
    padding: 0.75rem 1.5rem;
    color: #d1d5db;
    transition: background-color 0.2s, color 0.2s;
}

.nav-item:hover {
    background-color: #374151;
    color: white;
    text-decoration: none;
}

.nav-item.active {
    background-color: #5c6ac4;
    color: white;
}

.nav-item svg {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
    display: inline-block;
    vertical-align: middle;
}

.main-content {
    flex: 1;
    padding: 2rem;
    overflow-x: auto;
}

/* Cards */
.card {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
}

.stat-value.success {
    color: #10b981;
}

.stat-value.warning {
    color: #f59e0b;
}

.stat-value.danger {
    color: #ef4444;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

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

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

th {
    font-weight: 600;
    color: #6b7280;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: #f9fafb;
}

tr:hover {
    background-color: #f9fafb;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-gray {
    background-color: #f3f4f6;
    color: #4b5563;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.375rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.btn-primary {
    background-color: #5c6ac4;
    color: white;
}

.btn-primary:hover {
    background-color: #4c5ab4;
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

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

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

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

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

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

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: #5c6ac4;
    box-shadow: 0 0 0 3px rgba(92, 106, 196, 0.1);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    justify-content: center;
}

.page-link {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    color: #374151;
    background-color: white;
}

.page-link:hover {
    background-color: #f9fafb;
    text-decoration: none;
}

.page-link.active {
    background-color: #5c6ac4;
    border-color: #5c6ac4;
    color: white;
}

.page-link.disabled {
    color: #9ca3af;
    pointer-events: none;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f3f4f6;
}

.login-card {
    background-color: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #5c6ac4;
    margin: 0;
}

.login-logo p {
    color: #6b7280;
    margin: 0.5rem 0 0;
}

/* Alert Messages */
.alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* Health Status */
.health-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.health-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
}

.health-dot.healthy {
    background-color: #10b981;
}

.health-dot.unhealthy {
    background-color: #ef4444;
}

.health-dot.degraded {
    background-color: #f59e0b;
}

/* Message Thread */
.message-thread {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 500px;
    overflow-y: auto;
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.message {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
}

.message.from-merchant {
    background-color: white;
    border: 1px solid #e5e7eb;
    align-self: flex-start;
}

.message.from-admin {
    background-color: #5c6ac4;
    color: white;
    align-self: flex-end;
}

.message-meta {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

.message.from-admin .message-meta {
    color: rgba(255, 255, 255, 0.7);
}

/* User info */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #374151;
    margin-top: auto;
}

.user-email {
    font-size: 0.875rem;
    color: #d1d5db;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
}

.page-description {
    color: #6b7280;
    margin: 0;
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    color: #6b7280;
}

.filter-group select {
    padding: 0.375rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

/* HTMX Loading Indicator */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

.htmx-request.htmx-indicator {
    display: inline-block;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: fixed;
        top: 0;
        left: -100%;
        z-index: 50;
        transition: left 0.3s;
    }

    .sidebar.open {
        left: 0;
    }

    .main-content {
        padding: 1rem;
    }

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

    .filters {
        flex-direction: column;
    }
}
