/* 
 * Aegis Voice IVR - Master Stylesheet
 * Custom Dark Glassmorphism Styling
 */

:root {
    --bg-dark: #0f1016;
    --bg-card: rgba(30, 32, 50, 0.45);
    --bg-card-hover: rgba(30, 32, 50, 0.65);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    
    /* Neon accents */
    --primary: #6366f1; /* Electric Purple/Indigo */
    --primary-glow: rgba(99, 102, 241, 0.3);
    --primary-hover: #4f46e5;
    
    --success: #10b981; /* Emerald */
    --success-glow: rgba(16, 185, 129, 0.2);
    
    --warning: #f59e0b; /* Amber */
    --warning-glow: rgba(245, 158, 11, 0.2);
    
    --danger: #ef4444; /* Rose Red */
    --danger-glow: rgba(239, 68, 68, 0.2);
    
    --info: #06b6d4; /* Cyan */
    --info-glow: rgba(6, 182, 212, 0.2);
}

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

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 10% 20%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(6, 182, 212, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scrollbars */
::-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.25);
}

/* Typography & Layouts */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
}

/* Glass Card */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}
.glass-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 40px 0 rgba(0, 0, 0, 0.4);
}

/* Login Page Styling */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-wrapper {
    width: 100%;
    max-width: 440px;
    padding: 20px;
}

.login-card {
    background: rgba(20, 22, 37, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px 32px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo-icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), var(--info));
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 16px;
    font-size: 28px;
    color: white;
    box-shadow: 0 0 20px var(--primary-glow);
}

.login-header h1 {
    font-size: 24px;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 14px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

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

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

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

.input-wrapper input, 
.input-wrapper select, 
.input-wrapper textarea,
textarea.form-control,
input.form-control {
    width: 100%;
    padding: 12px 16px 12px 48px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 15px;
    transition: all 0.3s ease;
}

input.form-control-no-icon {
    padding-left: 16px;
}

.input-wrapper input:focus,
.input-wrapper select:focus,
.input-wrapper textarea:focus,
textarea.form-control:focus,
input.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #5046e6);
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    box-shadow: 0 4px 15px var(--success-glow);
}
.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
    box-shadow: 0 4px 15px var(--danger-glow);
}
.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

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

.btn-block {
    width: 100%;
}

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 24px;
    border: 1px solid transparent;
}
.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}
.alert-success {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.25);
    color: #a7f3d0;
}

/* Demo Shortcuts */
.demo-login-shortcuts {
    margin-top: 32px;
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
}

.demo-login-shortcuts h3 {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    text-align: center;
}

.shortcut-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* 🏢 Admin Dashboard Layout */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: rgba(15, 16, 22, 0.8);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.sidebar-logo i {
    font-size: 24px;
    color: var(--primary);
}

.sidebar-logo span {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-menu li a:hover,
.sidebar-menu li.active a {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-menu li.active a {
    background: var(--primary-glow);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: white;
}

.sidebar-user {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.user-info-brief {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.user-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--info));
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: white;
}

.user-details h4 {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.user-details span {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: capitalize;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 40px;
}

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.header-title h1 {
    font-size: 28px;
    margin-bottom: 6px;
}

.header-title p {
    color: var(--text-muted);
    font-size: 14px;
}

.header-buttons {
    display: flex;
    gap: 12px;
}

/* Dashboard Grid widgets */
.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.metric-widget {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.metric-info h3 {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.metric-info .number {
    font-size: 28px;
    font-weight: 700;
}

.metric-icon-box {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
}

.metric-primary {
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.2);
}
.metric-success {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.metric-warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}
.metric-info-box {
    background: rgba(6, 182, 212, 0.12);
    color: var(--info);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

/* Charts & Details Grid */
.dashboard-grid-2x1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.grid-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Section Card Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h2 {
    font-size: 18px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

table.table th {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

table.table td {
    padding: 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
}

table.table tbody tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}
.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}
.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}
.badge-info {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
}
.badge-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

/* Status Indicator Dot */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}
.status-online { background-color: var(--success); box-shadow: 0 0 8px var(--success); }
.status-busy { background-color: var(--warning); box-shadow: 0 0 8px var(--warning); }
.status-offline { background-color: var(--text-muted); }

/* Employee Dashboard status widget */
.agent-status-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px;
    text-align: center;
}

.agent-status-panel .status-shield {
    font-size: 64px;
    margin-bottom: 20px;
    transition: color 0.3s ease;
}

.shield-online { color: var(--success); filter: drop-shadow(0 0 15px var(--success-glow)); }
.shield-busy { color: var(--warning); filter: drop-shadow(0 0 15px var(--warning-glow)); }
.shield-offline { color: var(--text-muted); }

.agent-status-panel h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.agent-status-panel p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.status-controls {
    display: flex;
    gap: 12px;
}

/* 📞 Telephony Call Simulator UI */
.simulator-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 32px;
}

.phone-device {
    background: #141522;
    border: 6px solid #2d3142;
    border-radius: 40px;
    padding: 30px 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    height: 640px;
    position: relative;
    overflow: hidden;
}

/* Notch & Ear speaker */
.phone-notch {
    width: 140px;
    height: 24px;
    background: #2d3142;
    border-radius: 0 0 16px 16px;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.phone-screen {
    flex: 1;
    background: #0f1016;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    padding: 20px 10px;
    margin-top: 10px;
    overflow: hidden;
}

.phone-header {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 30px;
}

.phone-header h2 {
    font-size: 18px;
    color: var(--text-main);
}
.phone-header p {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 4px;
}

.phone-call-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
}

.phone-call-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--info), var(--primary));
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32px;
    color: white;
    margin-bottom: 16px;
}

.ringing-animation {
    animation: ringPhone 1.5s ease-in-out infinite alternate;
}

@keyframes ringPhone {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    100% { transform: scale(1.05); box-shadow: 0 0 20px 10px rgba(99, 102, 241, 0); }
}

.phone-dialer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    justify-items: center;
    margin-bottom: 24px;
}

.dial-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
}

.dial-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.dial-btn:active {
    transform: scale(0.9);
}

.dial-btn span.digit {
    font-size: 20px;
    font-weight: 600;
}
.dial-btn span.letters {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.phone-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: auto;
}

.phone-action-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    color: white;
    cursor: pointer;
    border: none;
    transition: transform 0.2s ease;
}
.phone-action-btn:hover {
    transform: scale(1.08);
}
.phone-action-btn:active {
    transform: scale(0.92);
}

.btn-call { background: var(--success); }
.btn-hangup { background: var(--danger); }

/* Speaker box in phone */
.audio-output-log {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 12px;
    font-size: 13px;
    margin-bottom: 16px;
    max-height: 120px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.speech-bubble {
    padding: 6px 10px;
    border-radius: 8px;
    max-width: 85%;
}
.bubble-bot {
    background: var(--primary-glow);
    color: var(--text-main);
    align-self: flex-start;
    border-left: 2px solid var(--primary);
}
.bubble-user {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    align-self: flex-end;
}

/* ESP32 Command Terminal Console */
.esp-terminal {
    background: #05050a;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    color: #38bdf8; /* sky blue */
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 400px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
}

.terminal-header {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
}

.terminal-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 500px;
}

.log-line { display: flex; gap: 8px; }
.log-time { color: var(--text-muted); min-width: 80px; }
.log-info { color: #10b981; } /* green */
.log-warn { color: #f59e0b; } /* orange */
.log-err { color: #ef4444; } /* red */
.log-at { color: #a78bfa; } /* purple for AT commands */

/* 🛎️ Employee transfer floating incoming call alert */
.incoming-transfer-overlay {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 360px;
    background: rgba(20, 22, 37, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid var(--primary);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.4);
    z-index: 1000;
    animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRight {
    0% { transform: translateX(120%); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

.transfer-alert-header {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary);
    margin-bottom: 16px;
}

.transfer-alert-header i {
    animation: ringbell 1s ease infinite;
}

@keyframes ringbell {
    0%, 100% { transform: rotate(0); }
    10%, 30%, 50%, 70%, 90% { transform: rotate(10deg); }
    20%, 40%, 60%, 80% { transform: rotate(-10deg); }
}

.transfer-caller-info {
    margin-bottom: 20px;
}

.transfer-caller-info h3 {
    font-size: 20px;
    margin-bottom: 4px;
}

.transfer-caller-info p {
    color: var(--text-muted);
    font-size: 14px;
}

.transfer-actions {
    display: flex;
    gap: 12px;
}

/* Tabs & General utilities */
.tabs-container {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    gap: 16px;
    margin-bottom: 24px;
}

.tab-nav {
    padding: 10px 16px;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}
.tab-nav:hover {
    color: var(--text-main);
}
.tab-nav.active {
    color: var(--primary);
    border-color: var(--primary);
}

.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

/* Campaign Upload Box */
.file-upload-box {
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease;
    margin-bottom: 16px;
}
.file-upload-box:hover {
    border-color: var(--primary);
}
.file-upload-box i {
    font-size: 32px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.file-upload-box input {
    display: none;
}

.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.w-full { width: 100%; }

/* Grid systems */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }

/* Responsive adjustments */
@media (max-width: 1024px) {
    .dashboard-grid-2x1 {
        grid-template-columns: 1fr;
    }
    .simulator-layout {
        grid-template-columns: 1fr;
    }
    .phone-device {
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none; /* In a real app we'd build a hamburger menu */
    }
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
}
