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

:root {
    --bg-main: #f8fafc;
    /* Lighter cool gray */
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --primary: #2563eb;
    /* Royal Blue */
    --primary-light: #eff6ff;
    --primary-dark: #1d4ed8;
    --text-dark: #0f172a;
    /* Slate 900 */
    --text-main: #334155;
    /* Slate 700 */
    --text-muted: #64748b;
    /* Slate 500 */
    --text-light: #94a3b8;
    /* Slate 400 */
    --border: #e2e8f0;
    /* Slate 200 */
    --success: #10b981;
    --success-bg: #ecfdf5;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --radius: 16px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline-color: var(--primary);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    border-right: 1px solid var(--border);
    z-index: 50;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 0.75rem;
    margin-bottom: 2.5rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 1.2rem;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

.logo-text {
    color: var(--text-dark);
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1.2;
}

.logo-text span {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    border-left: none;
}

.nav-item:hover {
    background: var(--bg-main);
    color: var(--text-dark);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    opacity: 0.8;
}

.nav-item.active svg {
    opacity: 1;
    stroke-width: 2.5px;
}

.user-section {
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: white;
    font-weight: 600;
}

.user-name {
    color: var(--text-dark);
    font-size: 0.9rem;
    font-weight: 600;
}

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

.sign-out {
    color: var(--text-muted);
    font-size: 1.25rem;
    text-decoration: none;
    padding: 0.25rem;
    border-radius: 4px;
    transition: 0.2s;
}

.sign-out:hover {
    color: var(--text-dark);
    background: var(--bg-main);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem 2.5rem;
    max-width: 1600px;
}

/* Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: -0.025em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--success-bg);
    color: var(--success);
    padding: 0.5rem 1rem;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.notification-btn {
    background: white;
    border: 1px solid var(--border);
    cursor: pointer;
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.notification-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
}

.btn {
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 1px 2px 0 rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

.btn-outline {
    background: white;
    border-color: var(--border);
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* Agent Row */
.agent-row {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--bg-main);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
}

.agent-avatar {
    width: 40px;
    height: 40px;
    background: #e0e7ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    color: #4f46e5;
}

.agent-details {
    flex: 1;
}

.agent-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.15rem;
}

.agent-ext {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.agent-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #ecfdf5;
    color: var(--success);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-right: 0.75rem;
}

.agent-status::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
}

.agent-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    background: none;
    border: 1px solid var(--border);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
}

.icon-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Live Calls / System Status */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    font-size: 0.9rem;
}

.status-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.status-item:last-child {
    border-bottom: none;
}

.status-label {
    font-size: 0.9rem;
    font-weight: 500;
}

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

.status-value {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--success);
}

.status-value::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
}

/* Table */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 0.85rem 1rem;
    font-size: 0.85rem;
}

th {
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
}

td {
    border-bottom: 1px solid var(--border);
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Agent Card Styles */
.agent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
}

.agent-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.agent-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.agent-card-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.ac-avatar {
    width: 48px;
    height: 48px;
    background: #e0e7ff;
    color: #4f46e5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-right: 1rem;
}

.ac-info {
    flex: 1;
}

.ac-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-dark);
}

.ac-ext {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.ac-actions {
    display: flex;
    gap: 0.5rem;
}

.ac-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--text-muted);
    transition: 0.2s;
}

.ac-btn:hover {
    color: var(--primary);
}

.agent-stats-list {
    margin-bottom: 1.5rem;
}

.as-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    font-size: 0.9rem;
}

.as-label {
    color: var(--text-muted);
}

.as-value {
    font-weight: 500;
    color: var(--text-dark);
    text-align: right;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e5e7eb;
    transition: .4s;
    border-radius: 24px;
}

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

input:checked+.slider {
    background-color: #3b82f6;
    /* Blue for 'Available' */
}

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

.agent-desc {
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.5;
}

/* Active Calls / Empty States */
.empty-state-large {
    text-align: center;
    padding: 5rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.es-icon {
    width: 64px;
    height: 64px;
    background: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.es-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.es-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 400px;
    line-height: 1.5;
}

/* Call Logs Filters */
.filters-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.search-input {
    flex: 1;
    position: relative;
}

.search-input input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
}

.search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.filter-select {
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 150px;
}

/* Transcripts Layout */
.transcript-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 1.5rem;
    height: calc(100vh - 140px);
    /* Adjust based on header height */
}

.transcript-list-card,
.transcript-view-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.list-header,
.view-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.t-search {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

/* Settings Forms */
.settings-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.settings-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

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

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-dark);
    transition: 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 191, 165, 0.1);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    width: 90%;
    max-width: 800px;
    border-radius: var(--radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

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

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Step Navigation */
.step-nav {
    display: flex;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    padding: 0.25rem;
    margin-bottom: 2rem;
}

.step-item {
    flex: 1;
    text-align: center;
    padding: 0.6rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.step-item.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    font-weight: 600;
    border: 1px solid var(--border);
}

/* Info Boxes */
.info-box {
    background: #eff6ff;
    border: 1px solid #dbeafe;
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-top: 1rem;
}

.info-box h4 {
    color: #1e40af;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.info-box p {
    color: #1e3a8a;
    font-size: 0.85rem;
}

.info-box.tips {
    background: #f0fdf4;
    border-color: #dcfce7;
}

.info-box.tips h4 {
    color: #166534;
}

.info-box.tips ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.info-box.tips li {
    position: relative;
    padding-left: 1rem;
    font-size: 0.85rem;
    color: #14532d;
    margin-bottom: 0.25rem;
}

.info-box.tips li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #16a34a;
}

.info-box.warning {
    background: #fffbeb;
    border-color: #fef3c7;
    text-align: center;
    padding: 2rem;
}

.info-box.warning p {
    color: #92400e;
    font-size: 0.95rem;
}

/* Custom Form Elements */
textarea.form-input {
    min-height: 120px;
    resize: vertical;
}

.step-content {
    display: none;
}

.step-content.active {
    display: block;
}