:root {
    --bg-primary: #080b11;
    --bg-secondary: #0f1420;
    --card-bg: rgba(21, 28, 44, 0.65);
    --border-color: rgba(255, 255, 255, 0.06);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Harmonious Brand Colors */
    --primary-start: #10b981;
    --primary-end: #06b6d4;
    --primary-gradient: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    
    --font-sans: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'Fira Code', monospace;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    justify-content: center;
}

/* Background Glowing Orbs */
.glass-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 50%, rgba(15, 20, 32, 0.5) 0%, var(--bg-primary) 100%);
    z-index: -3;
}

.glow-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.12;
    z-index: -2;
    pointer-events: none;
    animation: pulse-orb 15s infinite alternate ease-in-out;
}

.orb-1 {
    top: -10%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: var(--primary-start);
}

.orb-2 {
    bottom: -10%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: var(--primary-end);
    animation-delay: 3s;
}

@keyframes pulse-orb {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.15) translate(5%, 5%); }
}

/* Layout Container */
.app-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    width: 100%;
    max-width: 1600px;
    min-height: 100vh;
    position: relative;
    backdrop-filter: blur(10px);
}

/* Sidebar Styling */
.sidebar {
    background-color: rgba(15, 20, 32, 0.85);
    border-right: 1px solid var(--border-color);
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 50px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    background: var(--primary-gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.2);
}

.brand-icon i {
    font-size: 22px;
    color: white;
}

.brand h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.brand h2 span {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 15px;
    transition: var(--transition);
    border: 1px solid transparent;
}

.nav-item i {
    font-size: 18px;
    transition: var(--transition);
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.02);
}

.nav-item.active {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.15);
    color: var(--primary-start);
}

.nav-item.active i {
    color: var(--primary-start);
    transform: scale(1.05);
}

.sidebar-footer {
    margin-top: auto;
}

.api-info-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: var(--radius-md);
}

.info-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.info-val {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Main Content Styling */
.main-content {
    display: flex;
    flex-direction: column;
    padding: 40px;
    overflow-y: auto;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.page-title h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

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

/* Status Badges */
.gateway-status-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 14px;
    border: 1px solid transparent;
    transition: var(--transition);
}

.status-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.gateway-status-badge.disconnected {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}
.gateway-status-badge.disconnected .status-pulse {
    background: var(--danger);
    box-shadow: 0 0 10px var(--danger);
}

.gateway-status-badge.connecting {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    color: var(--info);
}
.gateway-status-badge.connecting .status-pulse {
    background: var(--info);
    animation: pulse-glow-info 1.5s infinite;
}

.gateway-status-badge.qr {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
    color: var(--warning);
}
.gateway-status-badge.qr .status-pulse {
    background: var(--warning);
    animation: pulse-glow-warn 1.5s infinite;
}

.gateway-status-badge.connected {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--success);
}
.gateway-status-badge.connected .status-pulse {
    background: var(--success);
    animation: pulse-glow-success 1.5s infinite;
}

@keyframes pulse-glow-info {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}
@keyframes pulse-glow-warn {
    0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
    100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}
@keyframes pulse-glow-success {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Card Styling */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(12px);
    transition: var(--transition);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

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

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

.card-body {
    padding: 24px;
    flex-grow: 1;
}

/* Content Navigation / Tabs Pane */
.tab-pane {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Grid Layouts */
.grid-layout {
    display: grid;
    grid-template-columns: 460px 1fr;
    gap: 24px;
    align-items: start;
}

.grid-layout-half {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.left-panel, .right-panel {
    display: flex;
    flex-direction: column;
}

@media (max-width: 1100px) {
    .grid-layout, .grid-layout-half {
        grid-template-columns: 1fr;
    }
    .app-container {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none;
    }
}

/* Utility Layout Spacing */
.margin-bottom-20 {
    margin-bottom: 20px;
}

.scroll-y {
    overflow-y: auto;
}

/* Session Creator Row Form */
.row-form {
    display: flex;
    gap: 12px;
    width: 100%;
}

.flex-grow {
    flex-grow: 1;
}

/* Sessions List Card */
.list-sessions-card {
    height: 480px;
}

/* Session List Items styling */
.session-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.session-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

.session-item.active {
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.08);
}

.session-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.session-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.session-status-text {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.session-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.session-status-dot.connected { background: var(--success); }
.session-status-dot.connecting { background: var(--info); }
.session-status-dot.qr { background: var(--warning); }
.session-status-dot.disconnected { background: var(--danger); }

.session-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-delete-session {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

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

/* No data states */
.no-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    height: 100%;
    min-height: 250px;
    gap: 16px;
}

.no-data i {
    font-size: 40px;
}

.no-data p {
    font-size: 14px;
}

/* Selected Details details state */
.icon-large {
    font-size: 50px;
    margin-bottom: 10px;
}

/* Connection States in Card */
.connection-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    text-align: center;
}

.qr-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.qr-code-frame {
    background: white;
    padding: 16px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-code-frame img {
    width: 200px;
    height: 200px;
    display: block;
}

.qr-instructions {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
    max-width: 300px;
}

/* Connected state CSS */
.state-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.success-icon-wrapper {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.1);
    border: 2px solid rgba(16, 185, 129, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--success);
    font-size: 40px;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.2);
}

.state-wrapper h4 {
    font-size: 18px;
    font-weight: 600;
}

.state-wrapper p {
    color: var(--text-secondary);
    font-size: 13px;
    max-width: 280px;
    line-height: 1.5;
}

.badge-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.badge {
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Spinner */
.loading-spinner {
    font-size: 40px;
    color: var(--primary-start);
    margin-bottom: 10px;
}

/* Log Terminal */
.log-card {
    height: 320px;
}

.log-body {
    padding: 16px;
    background: #05070a;
    position: relative;
}

.terminal-view {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    color: #38bdf8;
    overflow-y: auto;
    height: 100%;
    width: 100%;
    white-space: pre-wrap;
    word-break: break-all;
    background: transparent;
    border: none;
    outline: none;
    scroll-behavior: smooth;
}

/* Customize scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Forms controls styling */
.form-group {
    margin-bottom: 24px;
}

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

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 16px;
    transition: var(--transition);
}

.input-with-icon input, 
.input-with-icon select {
    padding-left: 48px;
}

input, select, textarea {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 15px;
    transition: var(--transition);
    outline: none;
}

select {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg fill='%239ca3af' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

input:focus, select:focus, textarea:focus {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--primary-start);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.1);
}

.input-with-icon input:focus ~ i,
.input-with-icon select:focus ~ i {
    color: var(--primary-start);
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    font-family: var(--font-sans);
    text-decoration: none;
    outline: none;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.15);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(16, 185, 129, 0.25);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.25);
}

.btn-block {
    width: 100%;
}

.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 30px 0;
}

.code-snippet {
    padding: 20px;
    background: #05070a;
    border-radius: var(--radius-md);
    margin-top: 10px;
    color: #e2e8f0;
}

.response-body {
    padding: 20px;
    background: #05070a;
    height: 400px;
}

.response-body pre {
    color: #34d399;
}

/* History Logs Tab Custom Styles */
.history-filters-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    align-items: end;
}

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

.filter-group label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.filter-search {
    grid-column: span 2;
}

@media (max-width: 1024px) {
    .filter-search {
        grid-column: span 1;
    }
}

.history-logs-card {
    min-height: 450px;
}

.history-table-container {
    width: 100%;
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13.5px;
}

.history-table th {
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.25);
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.history-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.history-table tbody tr {
    transition: var(--transition);
}

.history-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.direction-icon {
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
}

.direction-icon.outgoing {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

.direction-icon.incoming {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-status {
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 10.5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
}

.badge-status.queued {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.2);
}

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

.badge-status.failed {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

.badge-status.received {
    background: rgba(6, 182, 212, 0.1);
    color: var(--primary-end);
    border-color: rgba(6, 182, 212, 0.2);
}

.pagination-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.15);
}

.page-number-display {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.pagination-info {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.text-error-desc {
    font-size: 11px;
    color: var(--danger);
    display: block;
    margin-top: 4px;
    font-family: var(--font-mono);
}

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

.py-4 {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.font-mono-small {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--text-secondary);
}

.scroll-x {
    overflow-x: auto;
}
