/* OxLogic WhatsApp Gateway Style Sheet
   Designed with premium glassmorphism, dark mode, and smooth micro-animations. */

:root {
    --bg-base: hsl(222, 47%, 7%);
    --bg-surface: rgba(22, 28, 45, 0.65);
    --bg-surface-hover: rgba(30, 37, 58, 0.8);
    --border-color: rgba(255, 255, 255, 0.07);
    --border-color-focus: rgba(37, 99, 235, 0.5);
    
    --color-primary: hsl(217, 91%, 60%);
    --color-primary-hover: hsl(217, 91%, 65%);
    --color-success: hsl(142, 76%, 45%);
    --color-success-hover: hsl(142, 76%, 50%);
    --color-error: hsl(350, 89%, 60%);
    --color-warn: hsl(38, 92%, 50%);
    
    --text-main: hsl(210, 40%, 98%);
    --text-muted: hsl(215, 20%, 70%);
    --text-dark: hsl(215, 25%, 15%);
    
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.25);
    --shadow-success-glow: 0 0 20px rgba(16, 185, 129, 0.25);
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background animated glow orbs */
.glass-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glass-bg::before,
.glass-bg::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
}

.glass-bg::before {
    top: -10%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--color-primary) 0%, transparent 70%);
}

.glass-bg::after {
    bottom: -10%;
    left: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--color-success) 0%, transparent 70%);
}

/* App Container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    background: linear-gradient(135deg, var(--color-primary), var(--color-success));
    color: var(--text-dark);
    font-weight: 800;
    font-size: 1.25rem;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, #fff, #93c5fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.server-badge {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 0.375rem 0.875rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.server-badge::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    flex-grow: 1;
}

.col-span-2 {
    grid-column: span 2;
}

/* Glass Card */
.glass-card {
    background-color: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                border-color 0.3s ease, 
                box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.glass-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

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

.card-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-main);
}

.card-body {
    padding: 1.5rem;
    flex-grow: 1;
}

/* Status Indicator */
.status-indicator {
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.status-indicator.disconnected {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--color-error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-indicator.connected {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

/* QR Code Section */
.status-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 380px;
}

.qr-container-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
}

.qr-instruction {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    max-width: 320px;
}

.qr-border {
    background: #fff;
    padding: 1.25rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    position: relative;
    width: 256px;
    height: 256px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qrcode-element img {
    display: block;
    width: 216px !important;
    height: 216px !important;
}

.qr-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #121824;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--color-primary);
    animation: spin 1s ease-in-out infinite;
}

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

/* Connected State View */
.connected-state-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem;
    animation: fadeIn 0.5s ease-out forwards;
}

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

.success-icon-container {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--color-success);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    border: 2px solid rgba(16, 185, 129, 0.2);
    box-shadow: var(--shadow-success-glow);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.success-svg {
    width: 44px;
    height: 44px;
}

.connected-state-wrapper h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: #fff;
}

.success-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 320px;
}

/* Forms & Inputs */
form {
    display: grid;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
}

input {
    background-color: rgba(10, 15, 30, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    background-color: rgba(10, 15, 30, 0.8);
}

.input-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), hsl(217, 91%, 50%));
    color: #fff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

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

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

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Console Logs Area */
.logs-body {
    padding: 0;
    min-height: 250px;
    display: flex;
    flex-direction: column;
}

.console-log-area {
    background-color: #090e18;
    color: #cbd5e1;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    padding: 1.25rem;
    overflow-y: auto;
    max-height: 350px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-radius: 0 0 16px 16px;
    scroll-behavior: smooth;
}

.log-row {
    display: flex;
    gap: 0.75rem;
    line-height: 1.6;
    border-left: 2.5px solid transparent;
    padding-left: 0.5rem;
    animation: slideInLog 0.2s ease-out forwards;
}

@keyframes slideInLog {
    from { opacity: 0; transform: translateX(-5px); }
    to { opacity: 1; transform: translateX(0); }
}

.log-time {
    color: #64748b;
    user-select: none;
    flex-shrink: 0;
}

.log-tag {
    font-weight: 500;
    flex-shrink: 0;
    user-select: none;
}

.log-msg {
    word-break: break-all;
}

/* Log row types styling */
.log-row.info {
    border-left-color: var(--color-primary);
}
.log-row.info .log-tag {
    color: var(--color-primary);
}

.log-row.success {
    border-left-color: var(--color-success);
    color: #a7f3d0;
}
.log-row.success .log-tag {
    color: var(--color-success);
}

.log-row.warn {
    border-left-color: var(--color-warn);
    color: #fde047;
}
.log-row.warn .log-tag {
    color: var(--color-warn);
}

.log-row.error {
    border-left-color: var(--color-error);
    color: #fca5a5;
    background-color: rgba(239, 68, 68, 0.05);
}
.log-row.error .log-tag {
    color: var(--color-error);
}

/* Footer */
.app-footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Helper Utilities */
.hidden {
    display: none !important;
}

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

    .col-span-2 {
        grid-column: span 1;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .server-badge {
        align-self: flex-start;
    }
}

/* Phones */
@media (max-width: 600px) {
    .app-container {
        padding: 1.25rem 1rem;
    }

    .logo-icon {
        width: 40px;
        height: 40px;
    }

    .logo-text h1 {
        font-size: 1.25rem;
    }

    .card-header,
    .card-body {
        padding: 1rem;
    }

    /* QR keeps a margin from the screen edge on small phones */
    .qr-border {
        width: 220px;
        height: 220px;
    }

    .qrcode-element img {
        width: 184px !important;
        height: 184px !important;
    }

    /* Queue table scrolls horizontally instead of wrapping into an unreadable mess */
    th, td {
        white-space: nowrap;
    }
}

/* Toast Notification System */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 380px;
    width: calc(100% - 48px);
    pointer-events: none;
}

.toast {
    background: rgba(22, 28, 45, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 4px solid var(--color-primary);
    border-radius: 12px;
    padding: 16px 20px;
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    pointer-events: auto;
    animation: toast-slide-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.toast-error {
    border-left-color: var(--color-error);
}

.toast.toast-success {
    border-left-color: var(--color-success);
}

.toast.toast-warning {
    border-left-color: var(--color-warn);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

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

@keyframes toast-slide-in {
    from {
        transform: translateX(120%) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

.toast.toast-fade-out {
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
}

/* Landing Page & Pricing Elements */
.landing-price-card {
    background: rgba(22, 28, 45, 0.45);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
    backdrop-filter: blur(12px);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.landing-price-card:hover {
    border-color: var(--border-color-focus);
    transform: translateY(-5px);
    box-shadow: var(--shadow-glow);
}

.landing-price-card.popular {
    border: 2px solid var(--color-primary);
    box-shadow: var(--shadow-glow);
    background: rgba(22, 28, 45, 0.7);
}

.badge-cycle {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    margin-bottom: 12px;
    width: fit-content;
}

.badge-cycle.default-badge {
    background: rgba(37, 99, 235, 0.15);
    color: var(--color-primary);
    border: 1px solid rgba(37, 99, 235, 0.3);
}

/* Mobile Responsive Overrides for Landing Page */
@media (max-width: 768px) {
    #landing-section {
        margin: 20px auto !important;
        padding: 0 15px !important;
    }
    #landing-section h2 {
        font-size: 2rem !important;
    }
    #landing-section p {
        font-size: 0.95rem !important;
    }
    .landing-price-card {
        padding: 20px !important;
    }
}
