:root {
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --border: rgba(148, 163, 184, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --success: #22c55e;
    --danger: #ef4444;
}

body {
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.1) 0, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.1) 0, transparent 50%);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Glass Card */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin-bottom: 2rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 0 20px var(--accent-glow);
}

h1,
h2,
h3 {
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-top: 0;
}

h1 {
    font-size: 2.5rem;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 2rem;
    text-align: center;
}

input {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    margin-bottom: 1rem;
    box-sizing: border-box;
    transition: all 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

button {
    width: 100%;
    background: var(--accent);
    color: white;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Navbar */
.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding: 1rem;
    background: rgba(30, 41, 59, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 1.5rem;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--text-main);
}

/* Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
}


th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.mt-4 {
    margin-top: 1rem;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

/* --- APPENDED STYLES --- */

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-body {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--border);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row .label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.stat-row .value {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
}

/* Header Section */
.header-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-section .actions {
    display: flex;
    gap: 1rem;
}

/* New Buttons */
.btn-primary {
    background: var(--accent);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary:hover {
    box-shadow: 0 0 15px var(--accent-glow);
    transform: translateY(-2px);
}

.btn-secondary {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.2s;
    font-weight: 600;
    background: transparent;
}

.btn-secondary:hover {
    border-color: var(--text-main);
    color: var(--text-main);
    transform: translateY(-2px);
}

.btn-danger-sm {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger-sm:hover {
    background: rgba(239, 68, 68, 0.2);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

/* Product Info in Table */
.product-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.product-item {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.product-item .qty {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: monospace;
    font-weight: bold;
    color: var(--accent);
}

.product-info {
    display: flex;
    flex-direction: column;
}

.product-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-main);
}

.product-variant {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.text-nowrap {
    white-space: nowrap;
}

.empty-state {
    text-align: center;
    padding: 4rem;
    color: var(--text-muted);
    font-style: italic;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    margin: 1rem;
}

.order-id {
    font-family: monospace;
    font-weight: 600;
    color: var(--accent);
}

/* --- ADVANCED PREMIUM UI & ANIMATIONS --- */

@keyframes pulse-green {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 15px rgba(34, 197, 94, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

@keyframes flow-border {
    0% {
        border-color: var(--border);
    }

    50% {
        border-color: var(--accent);
    }

    100% {
        border-color: var(--border);
    }
}

.calling-active #mic-icon {
    background: var(--success) !important;
    animation: pulse-green 2s infinite;
}

.calling-active #mic-icon svg {
    color: white !important;
}

.simulator-panel {
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border);
    position: relative;
    overflow: hidden;
}

.calling-active.simulator-panel {
    border: 1px solid var(--success);
    background: rgba(34, 197, 94, 0.05);
    box-shadow: inset 0 0 20px rgba(34, 197, 94, 0.1);
}

/* Premium Tabs */
.tabs {
    gap: 0.5rem;
    padding: 0.25rem;
    background: rgba(15, 23, 42, 0.3);
    border-radius: 12px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

/* Glass Inputs */
textarea,
select,
.card input {
    background: rgba(15, 23, 42, 0.4) !important;
    backdrop-filter: blur(4px);
    border: 1px solid var(--border) !important;
    padding: 0.75rem 1rem !important;
    border-radius: 10px !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

textarea:focus,
select:focus,
.card input:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Global Transition */
* {
    transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

/* --- MOBILE RESPONSIVENESS (Max Width 768px) --- */
@media screen and (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .nav-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1rem;
        margin-bottom: 2rem;
    }
    
    .nav-brand {
        justify-content: center;
    }
    
    .nav-link {
        margin: 0 0.5rem;
        font-size: 0.9rem;
    }
    
    .nav-header > div {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    h1 {
        font-size: 1.8rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr; /* Stack stats vertically */
    }
    
    .header-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .header-section .actions {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    
    .header-section .actions button, 
    .header-section .actions a {
        flex: 1;
        justify-content: center;
        font-size: 0.9rem;
        padding: 0.6rem;
    }

    /* Make Tables Horizontal Scrollable */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
        border-radius: 8px;
        border: 1px solid var(--border);
    }
    
    table {
        min-width: 600px; /* Ensure table doesn't squash too much */
    }
    
    th, td {
        padding: 0.8rem;
        font-size: 0.85rem;
    }

    /* Adjust Card Padding */
    .card {
        padding: 1.25rem;
    }

    /* Modal Adjustments */
    .modal-content {
        width: 95%;
        padding: 1.5rem;
        max-height: 90vh;
        overflow-y: auto;
    }

    .stat-card {
        padding: 1rem;
    }
}