:root {
    --bg-color: #0d1117;
    --text-color: #e6edf3;
    --primary-color: #58a6ff;
    --secondary-color: #8b949e;
    --glass-bg: rgba(22, 27, 34, 0.7);
    --glass-border: rgba(240, 246, 252, 0.1);
    --card-bg: rgba(13, 17, 23, 0.8);
    --gradient-1: linear-gradient(135deg, #1f6feb 0%, #a371f7 100%);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
    background-attachment: fixed;
    color: var(--text-color);
    min-height: 100vh;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 1rem;
    /* Added padding for mobile */
}

.login-card {
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h2 {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.login-card p {
    color: var(--secondary-color);
    margin-bottom: 2rem;
}

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

.input-field {
    width: 100%;
    padding: 0.75rem;
    background: rgba(1, 4, 9, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--text-color);
    font-size: 1rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-primary {
    width: 100%;
    padding: 0.75rem;
    background: var(--gradient-1);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-primary:active {
    transform: scale(0.98);
}

/* Dashboard Layout */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-1);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logout-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--secondary-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    border-color: var(--text-color);
    color: var(--text-color);
}

/* Call List */
.call-list {
    margin-top: 1rem;
}

.call-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: transform 0.2s, background 0.2s;
    cursor: pointer;
}

.call-item:hover {
    transform: translateY(-2px);
    background: rgba(22, 27, 34, 0.9);
}

.call-info h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
}

.call-meta {
    font-size: 0.85rem;
    color: var(--secondary-color);
    display: flex;
    gap: 1rem;
}

.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-ended {
    background: rgba(46, 160, 67, 0.15);
    color: #3fb950;
    border: 1px solid rgba(46, 160, 67, 0.4);
}

/* Call Detail View */
.detail-view {
    margin-top: 2rem;
}

.back-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.call-summary-card {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.summary-item label {
    display: block;
    color: var(--secondary-color);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.summary-item span {
    font-size: 1.1rem;
    font-weight: 500;
    word-break: break-all;
    /* Fix for long Call IDs overlapping */
}

.transcript-section {
    padding: 1.5rem;
}

.transcript-section h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

.message-bubble {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 8px;
    max-width: 80%;
    line-height: 1.5;
}

.message-agent {
    background: rgba(31, 111, 235, 0.1);
    border: 1px solid rgba(31, 111, 235, 0.2);
    margin-right: auto;
    border-bottom-left-radius: 0;
}

.message-user {
    background: rgba(163, 113, 247, 0.1);
    border: 1px solid rgba(163, 113, 247, 0.2);
    margin-left: auto;
    border-bottom-right-radius: 0;
}

.role-label {
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    display: block;
    opacity: 0.8;
}

/* Loading & Empty States */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--secondary-color);
}

.hidden {
    display: none !important;
}

/* --- Responsive Media Queries --- */

/* Mobile & Tablets (< 768px) */
@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }

    /* Header Stack */
    .header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .header nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px !important;
    }

    /* Filters: Full width inputs */
    .filters-container {
        flex-direction: column;
        align-items: stretch;
    }

    .filters-container input,
    .filters-container select,
    .filters-container button {
        width: 100%;
        min-width: 0 !important;
        /* Override inline styles */
        box-sizing: border-box;
    }

    .filters-container>div {
        /* Wrapper for "From/To" inputs */
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .filters-container>div input {
        width: 100%;
        flex-grow: 1;
        margin-left: 10px;
    }

    /* Call List Item Stack */
    .call-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        position: relative;
    }

    .call-info {
        width: 100%;
    }

    .call-meta {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* Move Status Badge to top right or keep inline */
    .call-item>div:last-child {
        align-self: flex-start;
        /* Stack below info */
    }

    /* Adjust status badge positioning if needed */
    .status-badge {
        font-size: 0.7rem;
    }
}

/* Very Small Screens (< 480px) */
@media (max-width: 480px) {
    .login-card {
        padding: 1.5rem;
    }

    .message-bubble {
        max-width: 90%;
        padding: 0.75rem;
    }

    .header .logo {
        font-size: 1.25rem;
    }
}