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

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --info-color: #16a085;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --white: #ffffff;
    --gray: #95a5a6;
    --border-radius: 4px;
    --box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f7fa;
    color: var(--dark-color);
    line-height: 1.6;
}

/* Login Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.login-box {
    background: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--gray);
    font-size: 0.9rem;
}

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

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

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--secondary-color);
}

.form-group.checkbox {
    display: flex;
    align-items: center;
}

.form-group.checkbox label {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    cursor: pointer;
}

.form-group.checkbox input {
    width: auto;
    margin-right: 0.5rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

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

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.form-footer {
    text-align: center;
    margin-top: 1rem;
}

.form-footer a {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.9rem;
}

.form-footer a:hover {
    text-decoration: underline;
}

.error-message,
.success-message {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    display: none;
}

.error-message {
    background-color: #fee;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.success-message {
    background-color: #efe;
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

/* Main Application Styles */
.main-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.navbar {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--box-shadow);
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: bold;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar {
    background-color: var(--white);
    width: 250px;
    min-height: calc(100vh - 60px);
    box-shadow: 2px 0 4px rgba(0,0,0,0.05);
    position: fixed;
    left: 0;
    top: 60px;
    overflow-y: auto;
}

.menu {
    list-style: none;
    padding: 1rem 0;
}

.menu-item {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--dark-color);
    text-decoration: none;
    transition: all 0.3s;
}

.menu-item:hover {
    background-color: #f8f9fa;
    color: var(--secondary-color);
}

.menu-item.active {
    background-color: var(--secondary-color);
    color: var(--white);
}

.content {
    margin-left: 250px;
    padding: 2rem;
    min-height: calc(100vh - 60px);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: var(--white);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
}

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

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

.card-body {
    color: var(--dark-color);
}

/* Status Indicators */
.status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
}

.status.online {
    background-color: #d4edda;
    color: var(--success-color);
}

.status.offline {
    background-color: #f8d7da;
    color: var(--danger-color);
}

.status.busy {
    background-color: #fff3cd;
    color: var(--warning-color);
}

.status.away {
    background-color: #d1ecf1;
    color: var(--info-color);
}

/* Extension/Queue Cards */
.extension-card,
.queue-card {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.extension-card:hover,
.queue-card:hover {
    border-color: var(--secondary-color);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.extension-card.active-call {
    border-color: var(--success-color);
    background-color: #f0fff4;
}

.extension-card.ringing {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(52, 152, 219, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0);
    }
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: var(--dark-color);
}

.table tr:hover {
    background-color: #f8f9fa;
}

/* Admin-only menu items */
.admin-only {
    display: none !important;
}

.user-admin .admin-only {
    display: block !important;
}

/* Dashboard specific styles */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.dashboard-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-indicator.online {
    background-color: var(--success-color);
}

.status-indicator.warning {
    background-color: var(--warning-color);
}

.status-indicator.offline {
    background-color: var(--danger-color);
}

.statistics-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: var(--box-shadow);
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray);
}

.dashboard-tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 2rem;
}

.tab-btn {
    padding: 1rem 2rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--gray);
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

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

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

.tab-content {
    min-height: 400px;
}

.tab-pane {
    display: none;
}

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

.extensions-grid,
.queues-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.extension-card.drag-over {
    border-color: var(--secondary-color);
    background-color: #f0f8ff;
}

.queue-card {
    background: var(--white);
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s;
}

.queue-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat {
    display: flex;
    justify-content: space-between;
}

.stat-value {
    font-weight: 600;
}

.stat-value.success {
    color: var(--success-color);
}

.stat-value.warning {
    color: var(--warning-color);
}

.card-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.btn-icon {
    background: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.btn-icon:hover {
    background-color: var(--light-color);
    border-color: var(--secondary-color);
}

.call-actions {
    display: flex;
    gap: 0.25rem;
}

.channel-name {
    font-family: monospace;
    font-size: 0.875rem;
}

.notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.notification {
    background: var(--white);
    border-left: 4px solid var(--info-color);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--box-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-width: 300px;
}

.notification.error {
    border-left-color: var(--danger-color);
}

.notification.success {
    border-left-color: var(--success-color);
}

.notification.warning {
    border-left-color: var(--warning-color);
}

.notification button {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--gray);
    margin-left: 1rem;
}

.no-data {
    text-align: center;
    color: var(--gray);
    font-style: italic;
    padding: 2rem;
}

/* Context Menu */
.context-menu {
    background: var(--white);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 1000;
    min-width: 180px;
    border: 1px solid #e0e0e0;
}

.context-menu .menu-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.context-menu .menu-item:hover {
    background-color: #f8f9fa;
}

.context-menu .menu-item:first-child {
    border-radius: 4px 4px 0 0;
}

.context-menu .menu-item:last-child {
    border-radius: 0 0 4px 4px;
}

.context-menu .menu-icon {
    margin-right: 0.75rem;
    font-size: 1rem;
}

.context-menu .menu-text {
    font-size: 0.875rem;
    color: var(--dark-color);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal {
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
}

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

.modal-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    background-color: #f0f0f0;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: 60vh;
}

.reason-btn {
    display: block;
    width: 100%;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: var(--white);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.reason-btn:hover {
    background-color: #f8f9fa;
    border-color: var(--secondary-color);
}

.reason-btn:last-child {
    margin-bottom: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .content {
        margin-left: 0;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .statistics-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .dashboard-tabs {
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .extensions-grid,
    .queues-grid {
        grid-template-columns: 1fr;
    }
}