@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-dark: #080c14;
    --bg-card: rgba(255, 255, 255, 0.03);
    --border-card: rgba(255, 255, 255, 0.08);
    --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Neon Accents */
    --accent-cyan: #00f2fe;
    --accent-cyan-glow: rgba(0, 242, 254, 0.2);
    --accent-green: #00f5a0;
    --accent-green-glow: rgba(0, 245, 160, 0.2);
    --accent-purple: #a18cd1;
    --accent-purple-glow: rgba(161, 140, 209, 0.2);
    --accent-magenta: #f35588;
    --accent-magenta-glow: rgba(243, 85, 136, 0.2);
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dark: #1f2937;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-primary);
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(127, 0, 255, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 242, 254, 0.08) 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

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

@keyframes pulseGlow {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; filter: drop-shadow(0 0 8px var(--accent-cyan)); }
}

@keyframes pulseGlowRed {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; filter: drop-shadow(0 0 8px var(--accent-magenta)); }
}

@keyframes rotateSync {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Global Glass Card */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Layout Utilities */
.container-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-height: 100vh;
}

@media (min-width: 1024px) {
    .container-layout {
        grid-template-columns: minmax(0, 1fr) 360px; /* Sidebar for simulated SMS phone */
    }
}

main {
    min-width: 0;
    width: 100%;
}

/* Header & Roles Navigation */
header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-card);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    background: rgba(8, 12, 20, 0.8);
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 50;
}

@media (min-width: 768px) {
    header {
        flex-direction: row;
        flex-wrap: wrap; /* Enable wrapping when children exceed width */
        justify-content: space-between;
    }
}

@media (max-width: 580px) {
    header {
        padding: 0.75rem 1rem;
        text-align: center;
    }
    .brand-section {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    .user-meta-bar {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    .user-badge, .btn-logout {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-cyan), #7f00ff);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.3);
}

.brand-title h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.brand-title p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.user-meta-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-badge {
    padding: 0.5rem 1rem;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge-super {
    background: var(--accent-purple-glow);
    border-color: var(--accent-purple);
    color: #c3b4fc;
}

.badge-manager {
    background: var(--accent-green-glow);
    border-color: var(--accent-green);
    color: #8effd0;
}

.badge-seller {
    background: var(--accent-cyan-glow);
    border-color: var(--accent-cyan);
    color: #a5f3fc;
}

.btn-logout {
    background: rgba(243, 85, 136, 0.1);
    border: 1px solid var(--accent-magenta);
    color: var(--accent-magenta);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: var(--accent-magenta);
    color: #fff;
    box-shadow: 0 0 10px var(--accent-magenta-glow);
}

/* Offline Banner */
.network-status-banner {
    background: rgba(243, 85, 136, 0.9);
    color: white;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    position: relative;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.network-status-banner.online {
    background: rgba(0, 245, 160, 0.95);
    color: var(--bg-dark);
}

.network-status-banner i {
    font-size: 1rem;
}

/* Auth / Login Page */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem 2rem;
    text-align: center;
}

.auth-header {
    margin-bottom: 2rem;
}

.auth-header .logo-large {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--accent-cyan), #7f00ff);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.4);
}

.auth-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.input-field {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: #fff;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    outline: none;
}

.input-field:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px var(--accent-cyan-glow);
    background: rgba(255, 255, 255, 0.08);
}

.input-field::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.btn-primary {
    width: 100%;
    background: linear-gradient(90deg, var(--accent-cyan), #00d2ff);
    border: none;
    padding: 0.85rem;
    border-radius: 8px;
    color: var(--bg-dark);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px var(--accent-cyan-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 242, 254, 0.4);
}

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

.auth-help {
    margin-top: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.75rem;
}

.auth-help p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.auth-help ul {
    list-style: none;
    font-size: 0.75rem;
    text-align: left;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}

.auth-help li {
    background: rgba(255, 255, 255, 0.03);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.auth-help li:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

/* Main Dashboard Area */
.dashboard-wrapper {
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Grid Dashboards */
.dash-grid-4 {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
    .dash-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    .dash-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.stat-card {
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent-cyan);
}

.stat-card.purple::after { background: var(--accent-purple); }
.stat-card.green::after { background: var(--accent-green); }
.stat-card.magenta::after { background: var(--accent-magenta); }

.stat-info h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-info p {
    font-size: 1.65rem;
    font-weight: 700;
}

.stat-info span {
    font-size: 0.75rem;
    color: var(--accent-green);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    font-size: 1.25rem;
}

/* Seller Mobile Simulator Screen */
.mobile-view-simulator {
    width: 100%;
    max-width: 450px;
    margin: 0 auto 2rem;
    border: 8px solid rgba(255, 255, 255, 0.15);
    border-radius: 36px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.7);
    background: #0d121f;
}

@media (max-width: 480px) {
    .mobile-view-simulator {
        border: none;
        border-radius: 0;
    }
}

.mobile-simulator-header {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-card);
    padding: 1rem;
    text-align: center;
    position: relative;
}

.mobile-simulator-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.mobile-simulator-header p {
    font-size: 0.75rem;
    color: var(--accent-cyan);
}

.mobile-simulator-content {
    padding: 1.5rem;
}

/* Custom Selling Widgets */
.pricing-preview-widget {
    background: rgba(0, 242, 254, 0.03);
    border: 1px solid rgba(0, 242, 254, 0.15);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pricing-preview-widget div {
    display: flex;
    flex-direction: column;
}

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

.pricing-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
}

.pricing-value.total {
    color: var(--accent-cyan);
    text-shadow: 0 0 10px var(--accent-cyan-glow);
}

/* SMS Received Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    overflow-y: auto; /* Enable scroll on overlay for tall content */
}

.modal-card {
    width: 100%;
    max-width: 440px;
    padding: 2rem;
    position: relative;
    animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    margin: auto; /* Prevents overflow clipping on flex container child */
    background: rgba(13, 18, 31, 0.98) !important; /* Premium solid dark background */
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

.modal-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.modal-header i {
    font-size: 2.5rem;
    color: var(--accent-cyan);
    margin-bottom: 0.75rem;
    display: inline-block;
}

.modal-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
}

.modal-body {
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 1rem;
    font-family: monospace;
    font-size: 0.85rem;
    border: 1px solid var(--border-card);
    margin-bottom: 1.5rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.modal-footer {
    display: flex;
    gap: 1rem;
}

.modal-footer button {
    flex: 1;
    padding: 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.btn-yes {
    background: var(--accent-green);
    color: var(--bg-dark);
    border: none;
}

.btn-no {
    background: rgba(243, 85, 136, 0.1);
    color: var(--accent-magenta);
    border: 1px solid var(--accent-magenta);
}

.btn-no:hover {
    background: var(--accent-magenta);
    color: white;
}

/* Sidebar SMS terminal simulator */
.sms-terminal-sidebar {
    background: rgba(5, 8, 15, 0.95);
    border-top: 1px solid var(--border-card);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    height: auto; /* Natural flow on mobile screens */
    overflow-y: visible;
}

@media (min-width: 1024px) {
    .sms-terminal-sidebar {
        border-top: none;
        border-left: 1px solid var(--border-card);
        height: 100vh; /* Sidebar mode on desktop screens */
        position: sticky;
        top: 0;
        overflow-y: auto;
    }
}

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

.sms-terminal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sms-terminal-header span {
    font-size: 0.75rem;
    background: var(--accent-cyan-glow);
    color: var(--accent-cyan);
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
}

.sms-feed {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex-grow: 1;
}

.sms-bubble {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-size: 0.825rem;
    position: relative;
    animation: fadeIn 0.3s ease;
}

.sms-bubble-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.4rem;
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--accent-cyan);
}

.sms-bubble-body {
    line-height: 1.4;
    white-space: pre-wrap;
}

.sms-bubble-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    padding-top: 0.4rem;
}

.sms-badge {
    padding: 0.1rem 0.4rem;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
}

.sms-badge-sending { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.sms-badge-sent { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.sms-badge-delivered { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.sms-badge-failed { background: rgba(239, 68, 68, 0.2); color: #f87171; cursor: pointer; }

/* Grid Dashboard Columns */
.columns-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
}

@media (min-width: 1024px) {
    .columns-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.columns-container.full-width {
    grid-template-columns: minmax(0, 1fr);
}

/* Panel Design */
.panel-title {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-card);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title h2 {
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-body {
    padding: 1.5rem;
}

/* Table styling */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin-top: 0.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.875rem;
}

th {
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--border-card);
    font-size: 0.8rem;
    text-transform: uppercase;
}

td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: 0.2s;
}

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

/* Draw Modal and UI Components */
.draw-setup-box {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.winner-attribution-list {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.winner-row {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-card);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

@media (min-width: 480px) {
    .winner-row {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.winner-details h4 {
    font-weight: 600;
    font-size: 0.95rem;
}

.winner-details p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Digital Signature Canvas */
.signature-wrapper {
    border: 1px dashed rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    position: relative;
    height: 120px;
    overflow: hidden;
}

.signature-canvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
}

.signature-label {
    position: absolute;
    bottom: 5px;
    right: 10px;
    font-size: 0.65rem;
    color: var(--text-muted);
    pointer-events: none;
}

.media-capture-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-card);
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.media-capture-box .media-status {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.status-check { color: var(--accent-green); }
.status-missing { color: var(--text-muted); }

/* Quick role toggler under layout */
.inline-badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-weight: 600;
}

.inline-badge.cyan { background: var(--accent-cyan-glow); color: var(--accent-cyan); }
.inline-badge.purple { background: var(--accent-purple-glow); color: var(--accent-purple); }
.inline-badge.green { background: var(--accent-green-glow); color: var(--accent-green); }
.inline-badge.magenta { background: var(--accent-magenta-glow); color: var(--accent-magenta); }

/* Custom toggle switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 22px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-green);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* Alert Notification Banner */
.fraud-notification {
    background: rgba(243, 85, 136, 0.08);
    border: 1px solid rgba(243, 85, 136, 0.2);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    animation: fadeIn 0.3s ease;
}

.fraud-notification i {
    color: var(--accent-magenta);
    font-size: 1.2rem;
}

.fraud-details h5 {
    font-weight: 600;
    color: var(--accent-magenta);
    font-size: 0.85rem;
    margin-bottom: 0.15rem;
}

.fraud-details p {
    font-size: 0.75rem;
    color: var(--text-muted);
}
