/* ============================================
   SMPP Dashboard - Modern Dark Theme
   ============================================ */

:root {
    /* Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);

    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #606070;

    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --border-color: rgba(255, 255, 255, 0.08);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

    /* Sizes */
    --sidebar-width: 260px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============ UTILITIES ============ */
.hidden {
    display: none !important;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-full {
    width: 100%;
}

/* ============ LOGIN SCREEN ============ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at top, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at bottom, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        var(--bg-primary);
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    font-size: 48px;
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.error-message {
    color: var(--danger);
    font-size: 13px;
    margin-top: 12px;
    text-align: center;
}

/* ============ DASHBOARD LAYOUT ============ */
#dashboard-screen {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header .logo {
    font-size: 28px;
    margin: 0;
}

.sidebar-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.nav-menu {
    list-style: none;
    padding: 16px 12px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    margin-bottom: 4px;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-gradient);
    color: white;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.sidebar-footer p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px;
    background: var(--bg-primary);
    min-height: 100vh;
}

.section {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 24px;
}

.section h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 32px 0 16px;
    color: var(--text-secondary);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-header h1 {
    margin: 0;
}

/* Filter Group */
.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-group label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.filter-group select {
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    min-width: 140px;
    transition: border-color 0.2s ease;
}

.filter-group select:hover {
    border-color: var(--accent-primary);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Debug Banner */
.debug-banner {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #000;
    padding: 12px 24px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    margin-bottom: 24px;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

/* ============ STATS GRID ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.2s ease;
}

.stat-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 36px;
}

.stat-info h3 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ============ DATA TABLES ============ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* Pagination Controls */
.pagination-controls {
    padding: 16px 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
}

.result-count {
    font-size: 14px;
    color: var(--text-muted);
}

.data-table th,
.data-table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-delivered {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success);
}

.status-failed {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.status-pending {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}

.status-debug {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

.status-no_session {
    background: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
}

.status-no_match {
    background: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
}

.active-badge {
    color: var(--success);
}

.inactive-badge {
    color: var(--danger);
}

.online-badge {
    color: var(--success);
    font-size: 12px;
}

.offline-badge {
    color: var(--text-muted);
    font-size: 12px;
}

.session-count {
    font-size: 12px;
    color: var(--accent-primary);
    margin-bottom: 8px !important;
}

.message-preview {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}

/* Smaller stats grid for incoming section */
.stats-small {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card.small {
    padding: 16px;
    flex-direction: column;
    text-align: center;
    gap: 4px;
}

.stat-card.small h3 {
    font-size: 24px;
}

.stat-card.small p {
    font-size: 12px;
}

/* Webhook URL styling */
.webhook-url {
    display: block;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 12px 16px;
    font-family: monospace;
    font-size: 14px;
    color: var(--accent-primary);
    margin: 12px 0;
}

.code-hint {
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
}

.method-title {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 16px 0 8px;
    font-weight: 600;
}

.method-title:first-of-type {
    margin-top: 12px;
}

.api-key-container {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 12px;
}

.api-key-input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--accent-primary);
    font-family: monospace;
    font-size: 13px;
}

/* ============ SETTINGS ============ */
.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    max-width: 500px;
    margin-bottom: 20px;
}

.settings-card h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

.settings-card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

.toggle {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    transition: 0.3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.toggle input:checked+.slider {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.toggle input:checked+.slider:before {
    transform: translateX(24px);
}

/* ============ MODAL ============ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 18px;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

#modal-body {
    padding: 24px;
}

#modal-body .form-group:last-of-type {
    margin-bottom: 24px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
        overflow: hidden;
    }

    .sidebar-header h2,
    .nav-item span,
    .sidebar-footer p {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 16px;
    }

    .main-content {
        margin-left: 70px;
        padding: 20px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}