/* ==========================================================================
   Employee Calling CRM Portal CSS
   Material Design Inspired, Responsive, Light & Dark Theme
   ========================================================================== */

/* Theme Variables */
:root {
    --primary: #6200ee;
    --primary-variant: #3700b3;
    --secondary: #03dac6;
    --background: #f5f5f5;
    --surface: #ffffff;
    --error: #b00020;
    
    --on-primary: #ffffff;
    --on-secondary: #000000;
    --on-background: #121212;
    --on-surface: #121212;
    --on-error: #ffffff;

    --border: #e0e0e0;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-hover: rgba(0, 0, 0, 0.15);
    
    /* Status Colors */
    --status-done: #2e7d32;
    --status-done-bg: #e8f5e9;
    --status-pending: #fbc02d;
    --status-pending-bg: #fffde7;
    --status-scheduled: #f57c00;
    --status-scheduled-bg: #fff3e0;
    --status-rejected: #d32f2f;
    --status-rejected-bg: #ffebee;
    --status-notconnected: #757575;
    --status-notconnected-bg: #f5f5f5;
    --status-unassigned: #9e9e9e;
    --status-unassigned-bg: #eceff1;
    
    --transition-speed: 0.3s;
    --font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Dark Theme Variables */
body.dark-mode {
    --background: #121212;
    --surface: #1e1e1e;
    --on-background: #e0e0e0;
    --on-surface: #ffffff;
    --border: #333333;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-hover: rgba(0, 0, 0, 0.4);
    
    --status-done-bg: rgba(46, 125, 50, 0.2);
    --status-pending-bg: rgba(251, 192, 45, 0.2);
    --status-scheduled-bg: rgba(245, 124, 0, 0.2);
    --status-rejected-bg: rgba(211, 47, 47, 0.2);
    --status-notconnected-bg: rgba(117, 117, 117, 0.2);
    --status-unassigned-bg: rgba(158, 158, 158, 0.2);
}

/* Reset and Globals */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--background);
    color: var(--on-background);
    line-height: 1.5;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* Navigation Layout */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px var(--shadow);
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-nav {
    display: flex;
    list-style: none;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    color: var(--on-background);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

.nav-link:hover, .nav-link.active {
    background-color: rgba(98, 0, 238, 0.08);
    color: var(--primary);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    border-left: 1px solid var(--border);
    padding-left: 1rem;
}

/* Mobile Menu Button */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--on-background);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Cards & Layout */
.card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 6px var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

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

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background-color: var(--surface);
    color: var(--on-background);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color var(--transition-speed);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-row > .form-group {
    flex: 1;
    min-width: 200px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background-color var(--transition-speed), transform 0.1s;
    font-family: inherit;
}

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

.btn-primary {
    background-color: var(--primary);
    color: var(--on-primary);
}

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

.btn-secondary {
    background-color: var(--secondary);
    color: var(--on-secondary);
}

.btn-secondary:hover {
    background-color: #02c3b0;
}

.btn-danger {
    background-color: var(--error);
    color: var(--on-error);
}

.btn-danger:hover {
    background-color: #900018;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--on-background);
}

.btn-outline:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

body.dark-mode .btn-outline:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Stats Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 2px 4px var(--shadow);
    text-align: center;
    border-top: 4px solid var(--primary);
}

.stat-card.stat-done { border-top-color: var(--status-done); }
.stat-card.stat-pending { border-top-color: var(--status-pending); }
.stat-card.stat-scheduled { border-top-color: var(--status-scheduled); }
.stat-card.stat-rejected { border-top-color: var(--status-rejected); }
.stat-card.stat-notconnected { border-top-color: var(--status-notconnected); }

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--on-background);
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
}

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

th, td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

th {
    background-color: rgba(0, 0, 0, 0.02);
    font-weight: 600;
    color: var(--primary);
}

body.dark-mode th {
    background-color: rgba(255, 255, 255, 0.02);
}

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

tr:hover td {
    background-color: rgba(0, 0, 0, 0.01);
}

body.dark-mode tr:hover td {
    background-color: rgba(255, 255, 255, 0.01);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 4px;
    text-transform: uppercase;
}

.badge-done { background-color: var(--status-done-bg); color: var(--status-done); }
.badge-pending { background-color: var(--status-pending-bg); color: var(--status-pending); }
.badge-scheduled { background-color: var(--status-scheduled-bg); color: var(--status-scheduled); }
.badge-rejected { background-color: var(--status-rejected-bg); color: var(--status-rejected); }
.badge-notconnected { background-color: var(--status-notconnected-bg); color: var(--status-notconnected); }
.badge-unassigned { background-color: var(--status-unassigned-bg); color: var(--status-unassigned); }

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--on-background);
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    border-radius: 50%;
    transition: background-color var(--transition-speed);
}

.theme-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

body.dark-mode .theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Employee Portal Call Interface */
.calling-container {
    max-width: 500px;
    margin: 3rem auto;
}

.calling-card {
    text-align: center;
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
}

.lead-name {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.lead-phone {
    font-size: 1.3rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
}

.lead-working {
    display: inline-block;
    background-color: var(--border);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.85rem;
    margin-bottom: 2rem;
}

/* Big Call Button */
.btn-call {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background-color: var(--status-done);
    color: white;
    font-size: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
    box-shadow: 0 8px 16px rgba(46, 125, 50, 0.3);
    text-decoration: none;
    transition: background-color var(--transition-speed), transform 0.2s, box-shadow var(--transition-speed);
}

.btn-call:hover {
    background-color: #256228;
    box-shadow: 0 12px 20px rgba(46, 125, 50, 0.4);
    transform: translateY(-2px);
}

.btn-call:active {
    transform: translateY(1px);
}

/* Calling Layout Status Panel */
.status-grid-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.status-option {
    position: relative;
}

.status-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.status-label-card {
    display: block;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition-speed);
}

.status-option input[type="radio"]:checked + .status-label-card {
    border-color: var(--primary);
    background-color: rgba(98, 0, 238, 0.05);
    color: var(--primary);
}

/* Dynamic Schedule & Recording panel */
.sliding-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-speed) ease-out;
}

.sliding-panel.open {
    max-height: 300px;
    transition: max-height var(--transition-speed) ease-in;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal.open {
    display: flex;
}

.modal-content {
    background-color: var(--surface);
    border-radius: 8px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--on-background);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.alert-success {
    background-color: rgba(46, 125, 50, 0.15);
    color: #2e7d32;
    border: 1px solid rgba(46, 125, 50, 0.3);
}

.alert-error {
    background-color: rgba(211, 47, 47, 0.15);
    color: #d32f2f;
    border: 1px solid rgba(211, 47, 47, 0.3);
}

/* Tab Layout */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition-speed);
}

.tab.active {
    border-bottom-color: var(--primary);
    color: var(--primary);
}

.tab-content {
    display: none;
}

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

/* Utilities */
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.d-flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }

/* Responsive adjustments */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .navbar-nav {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 100%;
        left: 0;
        background-color: var(--surface);
        border-bottom: 1px solid var(--border);
        padding: 1rem;
        box-shadow: 0 4px 6px var(--shadow);
    }
    
    .navbar-nav.open {
        display: flex;
    }
    
    .nav-user {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid var(--border);
        padding-top: 1rem;
        width: 100%;
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .container {
        margin: 1rem auto;
    }
    
    .form-row > .form-group {
        flex: 100%;
    }
}
