/* ===== WhatsApp Middleware - Beautiful Dark Mode Design ===== */

/* CSS Custom Properties */
:root {
    /* Colors - Dark Theme with WhatsApp Green */
    --bg-primary: #0a0f1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.8);
    --bg-card-hover: rgba(31, 41, 55, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.03);

    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --accent-primary: #25D366;
    /* WhatsApp Green */
    --accent-secondary: #128C7E;
    --accent-tertiary: #075E54;

    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    --border-color: rgba(255, 255, 255, 0.1);
    --border-glass: rgba(255, 255, 255, 0.05);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(37, 211, 102, 0.2);

    /* Spacing */
    --sidebar-width: 260px;
    --header-height: 70px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background Gradient */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(37, 211, 102, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(18, 140, 126, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(7, 94, 84, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

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

.logo-icon {
    font-size: 28px;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    font-weight: 500;
}

.nav-item:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.15), rgba(18, 140, 126, 0.1));
    color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

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

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border-color);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-header {
    height: var(--header-height);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
}

.content-area {
    flex: 1;
    padding: 32px;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

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

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

.card-description {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.card-body {
    padding: 24px;
}

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

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: linear-gradient(135deg, rgba(37, 211, 102, 0.2), rgba(18, 140, 126, 0.1));
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

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

.status-card {
    grid-column: span 2;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 20px var(--success);
}

.status-dot.disconnected {
    background: var(--warning);
    box-shadow: 0 0 20px var(--warning);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ===== Dashboard Panels ===== */
.dashboard-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.panel-card {
    min-height: 400px;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.activity-item:hover {
    background: var(--bg-card-hover);
}

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

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

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

.activity-status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.status-sent,
.status-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status-delivered {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

.status-read {
    background: rgba(37, 211, 102, 0.2);
    color: var(--accent-primary);
}

.status-failed,
.status-error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.status-pending {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.status-received {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

/* ===== Quick Actions ===== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 16px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.action-btn:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.action-icon {
    font-size: 28px;
}

.action-text {
    font-size: 14px;
    font-weight: 500;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

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

.btn-ghost:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

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

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

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

.btn-block {
    width: 100%;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.form-actions {
    padding-top: 16px;
}

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

.input-wrapper {
    position: relative;
}

.input-wrapper input {
    padding-right: 48px;
}

.btn-toggle-password,
.btn-copy {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.btn-toggle-password:hover,
.btn-copy:hover {
    opacity: 1;
}

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

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

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

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

.data-table tbody tr {
    transition: background var(--transition-fast);
}

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

.data-table tbody tr.inactive {
    opacity: 0.5;
}

.data-table tbody tr.error-row {
    background: rgba(239, 68, 68, 0.05);
}

code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
    padding: 2px 6px;
    background: var(--bg-glass);
    border-radius: 4px;
}

.key-partial {
    font-size: 11px;
}

.key-name {
    display: flex;
    flex-direction: column;
}

.key-description {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== Badges ===== */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status-badge.inactive {
    background: rgba(107, 114, 128, 0.2);
    color: var(--text-muted);
}

.method-badge {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.method-badge.get {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

.method-badge.post {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.method-badge.put {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.method-badge.delete {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.direction-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
}

.status-code {
    font-weight: 600;
}

.status-code.success {
    color: var(--success);
}

.status-code.error {
    color: var(--error);
}

/* ===== Alerts ===== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

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

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

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

.key-reveal {
    flex-direction: column;
}

.key-reveal .alert-content {
    width: 100%;
}

.key-display {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    margin-top: 12px;
}

.key-display code {
    flex: 1;
    background: none;
    font-size: 12px;
}

/* ===== Modals ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease;
}

.modal-sm {
    max-width: 400px;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition-fast);
}

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

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* ===== Filter Bar ===== */
.filter-bar {
    margin-bottom: 24px;
}

.filter-form {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.filter-form.inline {
    margin-bottom: 16px;
}

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

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

.filter-group select {
    padding: 8px 12px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
}

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

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

/* ===== Empty State ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.empty-state.small {
    padding: 32px 16px;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h4 {
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* ===== Settings Page ===== */
.settings-container {
    display: grid;
    gap: 24px;
    max-width: 800px;
}

.webhook-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.info-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-row label {
    font-size: 13px;
    color: var(--text-muted);
}

.copy-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.copy-field code {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
}

/* ===== CDR Detail ===== */
.cdr-detail .detail-grid {
    display: grid;
    gap: 24px;
}

.detail-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-glass);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row label {
    min-width: 140px;
    font-size: 13px;
    color: var(--text-muted);
}

.detail-row.error {
    color: var(--error);
}

.code-block {
    background: var(--bg-glass);
    padding: 16px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ===== Messages Page ===== */
.messages-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 24px;
}

.send-panel {
    position: sticky;
    top: calc(var(--header-height) + 32px);
    height: fit-content;
}

.message-form .dynamic-fields {
    margin-top: 16px;
}

.warning-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 20px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-md);
}

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

.warning-content strong {
    display: block;
    margin-bottom: 8px;
}

.warning-content p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.message-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.message-item:hover {
    background: var(--bg-card-hover);
}

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

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.message-type {
    font-weight: 500;
    font-size: 14px;
}

.message-direction {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

.message-direction.sent {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.message-direction.received {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

.message-phone {
    font-size: 13px;
    color: var(--text-secondary);
}

.message-preview {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

.message-time {
    font-size: 12px;
    color: var(--text-muted);
}

.message-status {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

/* ===== Toast Notifications ===== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    z-index: 2000;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

/* ===== Error Page ===== */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.error-content {
    text-align: center;
}

.error-content .error-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.error-content h2 {
    margin-bottom: 12px;
}

.error-content p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
    .messages-layout {
        grid-template-columns: 1fr;
    }

    .send-panel {
        position: static;
    }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
    }

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

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

    .dashboard-panels {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .content-area {
        padding: 16px;
    }

    .status-card {
        grid-column: span 1;
    }

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

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== Utility Classes ===== */
.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-error {
    color: var(--error);
}

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

.record-count {
    font-size: 13px;
    color: var(--text-muted);
}

.endpoint {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== API Status Check ===== */
.api-status-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.api-status-indicator {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
}

.api-status-indicator.checking {
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(59, 130, 246, 0.05);
}

.api-status-indicator.active {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.05);
}

.api-status-indicator.expired {
    border-color: rgba(245, 158, 11, 0.5);
    background: rgba(245, 158, 11, 0.05);
}

.api-status-indicator.error {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.05);
}

.api-status-indicator .status-icon {
    font-size: 32px;
}

.api-status-indicator .status-details {
    flex: 1;
}

.api-status-indicator .status-label {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.api-status-indicator.active .status-label {
    color: var(--success);
}

.api-status-indicator.expired .status-label {
    color: var(--warning);
}

.api-status-indicator.error .status-label {
    color: var(--error);
}

.api-status-indicator .status-message {
    font-size: 14px;
    color: var(--text-secondary);
}

.api-status-info {
    padding: 16px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
}

.api-status-info .info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.api-status-info .info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.api-status-info .info-label {
    font-size: 12px;
    color: var(--text-muted);
}

.api-status-info .info-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

/* ===== Webhook Subscriptions ===== */
.webhook-subscriptions-card .subscription-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.subscription-notice .notice-icon {
    font-size: 24px;
}

.subscription-notice .notice-content {
    font-size: 14px;
    color: var(--text-secondary);
}

.subscription-notice .notice-content strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
}

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

.subscription-section:last-child {
    margin-bottom: 0;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-glass);
}

.section-title.required {
    color: var(--success);
}

.section-title.recommended {
    color: var(--warning);
}

.section-title.optional {
    color: var(--text-muted);
}

.section-icon {
    font-size: 16px;
}

.subscription-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.subscription-list.collapsible {
    max-height: 200px;
    overflow: hidden;
    transition: max-height var(--transition-slow);
}

.subscription-list.collapsible.expanded {
    max-height: 2000px;
}

.subscription-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    transition: all var(--transition-fast);
}

.subscription-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color);
}

.subscription-item.required {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.05);
}

.subscription-item.recommended {
    border-color: rgba(245, 158, 11, 0.2);
}

.sub-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sub-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-primary);
    background: rgba(37, 211, 102, 0.1) !important;
    padding: 4px 8px !important;
}

.sub-description {
    font-size: 12px;
    color: var(--text-muted);
}

.sub-badge {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.sub-badge.required {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.sub-badge.recommended {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.sub-badge.optional {
    background: rgba(107, 114, 128, 0.2);
    color: var(--text-muted);
}

.toggle-optional {
    margin-top: 12px;
}

/* ===== WhatsApp-Style Chat UI ===== */
.chat-container {
    display: grid;
    grid-template-columns: 320px 1fr;
    /* Fill available space in content-area */
    flex: 1;
    min-height: 0;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

/* Conversations Sidebar */
.chat-sidebar {
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
}

.chat-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-sidebar-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.chat-search {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.chat-search input {
    width: 100%;
    padding: 10px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 14px;
}

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

.conversation-list {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border-glass);
}

.conversation-item:hover {
    background: var(--bg-glass);
}

.conversation-item.active {
    background: rgba(37, 211, 102, 0.1);
    border-left: 3px solid var(--accent-primary);
}

.conversation-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.conversation-info {
    flex: 1;
    min-width: 0;
}

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

.conversation-name {
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-time {
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.conversation-preview {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 4px;
}

.conversation-preview .tick {
    color: var(--accent-primary);
}

.unread-badge {
    background: var(--accent-primary);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* Chat Main Area */
.chat-main {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
    min-height: 0;
    height: 100%;
    /* Fill the grid cell */
}

/* Chat Background Pattern */
.chat-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.02;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

.chat-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    z-index: 1;
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: white;
}

.chat-header-info {
    flex: 1;
}

.chat-header-name {
    font-weight: 600;
    font-size: 15px;
}

.chat-header-status {
    font-size: 12px;
    color: var(--text-muted);
}

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

.chat-header-actions button {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.chat-header-actions button:hover {
    background: var(--bg-glass);
}

/* Message Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1;
}

.message-bubble {
    max-width: 65%;
    padding: 10px 14px;
    border-radius: 12px;
    position: relative;
    animation: messageIn 0.2s ease;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-bubble.sent {
    align-self: flex-end;
    background: linear-gradient(135deg, #075E54, #128C7E);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-bubble.received {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.message-bubble .message-text {
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message-bubble .message-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 6px;
}

.message-bubble .message-time {
    font-size: 11px;
    opacity: 0.7;
}

.message-bubble.sent .message-time {
    color: rgba(255, 255, 255, 0.7);
}

.message-bubble .message-ticks {
    font-size: 14px;
}

.message-ticks.pending {
    color: rgba(255, 255, 255, 0.5);
}

.message-ticks.sent {
    color: rgba(255, 255, 255, 0.7);
}

.message-ticks.delivered {
    color: rgba(255, 255, 255, 0.9);
}

.message-ticks.read {
    color: #53bdeb;
}

/* Message Types */
.message-bubble.image-message,
.message-bubble.video-message {
    padding: 4px;
    max-width: 300px;
}

.message-bubble.image-message .message-media,
.message-bubble.video-message .message-media {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 4px;
}

.message-bubble .message-media img,
.message-bubble .message-media video {
    width: 100%;
    display: block;
}

.message-bubble.document-message {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.message-bubble.document-message .document-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    background: var(--bg-glass);
    border-radius: 8px;
    margin-bottom: 8px;
}

.document-preview .doc-icon {
    font-size: 32px;
}

.document-preview .doc-info {
    flex: 1;
}

.document-preview .doc-name {
    font-weight: 500;
    font-size: 13px;
}

.document-preview .doc-size {
    font-size: 11px;
    color: var(--text-muted);
}

.message-bubble.location-message .location-preview {
    background: var(--bg-glass);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
}

.location-preview .location-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.location-preview .location-name {
    font-weight: 500;
    font-size: 13px;
}

.location-preview .location-address {
    font-size: 12px;
    color: var(--text-muted);
}

/* Date Separator */
.date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px 0;
}

.date-separator span {
    background: var(--bg-card);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-muted);
    box-shadow: var(--shadow-sm);
}

/* Chat Input */
.chat-input-area {
    padding: 12px 20px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: flex-end;
    gap: 12px;
    z-index: 1;
}

.chat-input-actions {
    display: flex;
    gap: 4px;
}

.chat-input-actions button {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.chat-input-actions button:hover {
    background: var(--bg-glass);
}

.chat-input-wrapper {
    flex: 1;
    display: flex;
    align-items: flex-end;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 8px 16px;
}

.chat-input-wrapper textarea {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    resize: none;
    max-height: 120px;
    line-height: 1.5;
}

.chat-input-wrapper textarea::placeholder {
    color: var(--text-muted);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.chat-send-btn span {
    font-size: 20px;
}

/* Empty Chat State */
.chat-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    z-index: 1;
}

.chat-empty-state .empty-icon {
    font-size: 80px;
    margin-bottom: 24px;
    opacity: 0.8;
}

.chat-empty-state h3 {
    font-size: 22px;
    margin-bottom: 12px;
}

.chat-empty-state p {
    color: var(--text-muted);
    max-width: 400px;
}

/* Responsive Chat */
@media (max-width: 900px) {
    .chat-container {
        grid-template-columns: 1fr;
    }

    .chat-sidebar {
        display: none;
    }

    .chat-sidebar.mobile-show {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        z-index: 200;
    }
}

/* ===== Emoji Picker ===== */
.emoji-picker {
    position: absolute;
    bottom: 80px;
    left: 20px;
    width: 320px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    animation: slideUp 0.2s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.emoji-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.emoji-picker-header button {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-muted);
}

.emoji-picker-header button:hover {
    color: var(--text-primary);
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    padding: 12px;
    max-height: 250px;
    overflow-y: auto;
}

.emoji-grid span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 20px;
    cursor: pointer;
    border-radius: 6px;
    transition: background var(--transition-fast);
}

.emoji-grid span:hover {
    background: var(--bg-glass);
}

/* ===== Attach Menu ===== */
.attach-menu {
    position: absolute;
    bottom: 80px;
    left: 60px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    animation: slideUp 0.2s ease;
}

.attach-menu-content {
    display: flex;
    gap: 8px;
    padding: 16px;
}

.attach-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
    min-width: 70px;
}

.attach-option:hover {
    background: var(--bg-glass);
}

.attach-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.attach-option span:last-child {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ===== Message Detail Page ===== */
.message-detail-container {
    max-width: 900px;
}

.message-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.message-detail-header .back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.message-detail-header .back-btn:hover {
    color: var(--text-primary);
}

.message-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.overview-item {
    background: var(--bg-glass);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
}

.overview-item label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.overview-item .value {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.overview-item .value.success {
    color: var(--success);
}

.overview-item .value.error {
    color: var(--error);
}

.overview-item .value.warning {
    color: var(--warning);
}

.message-content-preview {
    background: var(--bg-glass);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    margin-bottom: 24px;
}

.message-content-preview h4 {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.content-box {
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.json-viewer {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
}

.json-key {
    color: #7dd3fc;
}

.json-string {
    color: #86efac;
}

.json-number {
    color: #fbbf24;
}

.json-boolean {
    color: #c084fc;
}

.json-null {
    color: #94a3b8;
}

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

.detail-section h4 {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-left: 20px;
    border-left: 2px solid var(--border-color);
}

.timeline-item {
    position: relative;
    padding-left: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -26px;
    top: 8px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-primary);
    border: 2px solid var(--bg-primary);
}

.timeline-item.pending::before {
    background: var(--warning);
}

.timeline-item.failed::before {
    background: var(--error);
}

.timeline-item .time {
    font-size: 12px;
    color: var(--text-muted);
}

.timeline-item .status {
    font-weight: 500;
    margin-top: 2px;
}

/* Clickable message items */
.message-item.clickable {
    cursor: pointer;
}

.message-item.clickable:hover {
    background: var(--bg-card-hover);
    border-left: 3px solid var(--accent-primary);
}

/* ===== Loading State ===== */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 16px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== Account Management Table ===== */
.account-table {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.account-table-header {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr 1.5fr 150px;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-glass);
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.account-table-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr 1.5fr 150px;
    gap: 16px;
    padding: 16px;
    border-bottom: 1px solid var(--border-glass);
    align-items: center;
    transition: background var(--transition-fast);
}

.account-table-row:last-child {
    border-bottom: none;
}

.account-table-row:hover {
    background: var(--bg-glass);
}

.account-name {
    display: flex;
    align-items: center;
    gap: 8px;
}

.account-phone {
    font-family: monospace;
    font-size: 13px;
}

.account-last-check {
    font-size: 12px;
    color: var(--text-muted);
}

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

.btn-icon {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

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

/* ===== Status Badges ===== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.status-expired {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

.status-error {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.status-unknown {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-muted);
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.badge-inactive {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-muted);
}

/* ===== Modal Sizes ===== */
.modal-lg .modal-content {
    max-width: 700px;
}

/* ===== Alert System ===== */
#alert-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border-left: 4px solid;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    color: var(--text-primary);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--error);
    color: var(--text-primary);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--warning);
    color: var(--text-primary);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--info);
    color: var(--text-primary);
    border-left: none;
    border: 1px solid var(--border-color);
}

.alert-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.alert-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
}

.alert-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-muted);
    flex-shrink: 0;
    padding: 0 4px;
}

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

/* ===== Subscription List ===== */
.subscription-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.subscription-category {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.subscription-category h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.subscription-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.subscription-item {
    padding: 12px;
    background: var(--bg-glass);
    border-radius: var(--radius-md);
    border-left: 3px solid;
}

.subscription-item.required {
    border-color: var(--error);
}

.subscription-item.recommended {
    border-color: var(--warning);
}

.subscription-item.optional {
    border-color: var(--border-color);
}

.subscription-item strong {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.subscription-item p {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

/* ===== Responsive Account Table ===== */
@media (max-width: 900px) {
    .account-table-header {
        display: none;
    }

    .account-table-row {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 16px;
    }

    .account-name {
        font-size: 16px;
    }

    .account-status,
    .account-phone,
    .account-last-check {
        font-size: 13px;
    }

    #alert-container {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* ===== Account Selector in Headers ===== */
.account-select-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.account-select-wrapper label {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

.account-select-wrapper select {
    padding: 6px 12px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    min-width: 200px;
}

.account-select-wrapper select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

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