/* SES Bounce Monitor - Dark Theme (HDS) */

/* --- Variables --- */
:root {
    --bg: #1A1612;
    --bg-soft: #231D17;
    --surface: #2A231C;
    --text: #FAF6EE;
    --text-muted: #5C5247;
    --accent: #EE7623;
    --accent-hover: #D4681F;
    --border: #3E352C;
    --success: #22C55E;
    --danger: #EF4444;
    --warning: #F59E0B;
    --info: #3B82F6;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
}

/* --- Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

/* --- Login Page --- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    box-shadow: var(--shadow);
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.logo-img {
    height: 48px;
    width: auto;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 4px;
}

.login-subtitle {
    color: var(--text-muted);
    text-align: center;
    font-size: 0.875rem;
    margin-bottom: 24px;
}

/* --- Header --- */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo {
    height: 32px;
    width: auto;
}

.header-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* --- Main --- */
.main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

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

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
}

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

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 4px;
}

.stat-permanent .stat-value { color: var(--danger); }
.stat-transient .stat-value { color: var(--warning); }
.stat-complaint .stat-value { color: var(--info); }

/* --- Cards --- */
.card, .filters-card, .table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

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

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
}

/* --- Filters --- */
.filters-form {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

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

.filter-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Forms --- */
.form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 8px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
select {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    color: var(--text);
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent);
}

input::placeholder {
    color: var(--text-muted);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

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

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

.btn-outline:hover {
    background: var(--bg-soft);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
}

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

.btn-block {
    width: 100%;
}

/* --- Table --- */
.table-card {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.header-hint {
    text-transform: none;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0;
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:hover {
    background: var(--bg-soft);
}

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

.actions-cell {
    white-space: nowrap;
    display: flex;
    gap: 6px;
}

/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg);
    border: 1px solid var(--border);
}

.badge.type-permanent {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.badge.type-transient {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.3);
}

.badge.type-complaint {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
    border-color: rgba(59, 130, 246, 0.3);
}

/* --- Alerts --- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.875rem;
}

.alert-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.page-info {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

/* --- Admin Tabs --- */
.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}

.admin-tab {
    padding: 10px 20px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.admin-tab:hover {
    color: var(--text-secondary);
}

.admin-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.admin-tab .badge {
    font-size: 0.7rem;
    padding: 2px 6px;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    max-width: 700px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s;
}

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

.modal-body {
    padding: 24px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-full {
    grid-column: 1 / -1;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-value {
    font-size: 0.875rem;
    color: var(--text);
    word-break: break-word;
}

.detail-mono {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    background: var(--bg);
    padding: 6px 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.detail-explanation {
    background: var(--bg);
    padding: 12px 16px;
    border-radius: var(--radius);
    border-left: 3px solid var(--accent);
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

/* --- Table row double-click hint --- */
.bounce-row {
    cursor: pointer;
    transition: background 0.15s;
}

.bounce-row:hover {
    background: var(--bg-soft);
}

.bounce-row:active {
    background: var(--border);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .filters-form {
        flex-direction: column;
        align-items: stretch;
    }

    .header-content {
        flex-direction: column;
        height: auto;
        padding: 12px 0;
        gap: 8px;
    }

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