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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

/* Screen Management */
.screen {
  display: none;
}

.screen.active {
  display: block;
}

/* Login Screen */
.login-container {
  max-width: 400px;
  margin: 100px auto;
  background: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-container h1 {
  text-align: center;
  color: #667eea;
  margin-bottom: 10px;
  font-size: 32px;
}

.login-container h2 {
  text-align: center;
  color: #666;
  margin-bottom: 30px;
  font-size: 20px;
  font-weight: 400;
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #555;
  font-weight: 500;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #667eea;
}

.error {
  color: #e74c3c;
  margin-top: 10px;
  text-align: center;
  font-size: 14px;
}

.register-link {
  text-align: center;
  margin-top: 20px;
}

.register-link a {
  color: #667eea;
  text-decoration: none;
  font-weight: 500;
}

.register-link a:hover {
  text-decoration: underline;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  width: 100%;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #6c757d;
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: #5a6268;
}

.btn-danger {
  background: #e74c3c;
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #c0392b;
}

.btn-control {
  background: #3498db;
  color: white;
  margin: 5px;
}

.btn-control:hover:not(:disabled) {
  background: #2980b9;
}

.btn-control.active {
  background: #f39c12;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
}

/* Dashboard */
.header {
  background: white;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  color: #667eea;
  font-size: 24px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 20px;
}

.status-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-control label {
  font-weight: 600;
  color: #555;
}

.status-control select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-info span {
  font-weight: 600;
  color: #333;
}

/* Dashboard Container */
.dashboard-container {
  max-width: 1400px;
  margin: 30px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
}

/* Panel */
.panel {
  background: white;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.panel h2 {
  color: #667eea;
  margin-bottom: 20px;
  font-size: 20px;
  border-bottom: 2px solid #f0f0f0;
  padding-bottom: 10px;
}

.panel h3 {
  color: #555;
  margin-top: 20px;
  margin-bottom: 10px;
  font-size: 16px;
}

.panel h4 {
  color: #666;
  margin-top: 10px;
  margin-bottom: 8px;
  font-size: 14px;
}

/* Status Indicator */
.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-weight: 600;
}

.status-indicator.online {
  background: #d4edda;
  color: #155724;
}

.status-indicator.offline {
  background: #f8d7da;
  color: #721c24;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Call Controls */
.control-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.control-buttons .btn {
  flex: 1;
  min-width: 120px;
}

.outbound-call {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid #f0f0f0;
}

.outbound-call h3 {
  color: #667eea;
  margin-bottom: 15px;
  font-size: 18px;
}

.outbound-call .form-group {
  margin-bottom: 15px;
}

.outbound-call label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #555;
  font-size: 14px;
}

.outbound-call .form-control {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.3s;
}

.outbound-call .form-control:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.outbound-call .outbound-number-input {
  font-size: 18px;
  padding: 16px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.outbound-call .btn-large {
  width: 100%;
  padding: 16px;
  font-size: 16px;
  margin-top: 10px;
}

/* Active Call */
.call-info {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}

.call-details {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.call-detail-item {
  margin-bottom: 10px;
  font-size: 14px;
}

.call-detail-item strong {
  color: #555;
  margin-right: 8px;
}

.transfer-controls {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid #f0f0f0;
}

.transfer-controls select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  margin-bottom: 10px;
  font-size: 14px;
}

/* Queue */
.queue-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-label {
  font-weight: 600;
  color: #555;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #667eea;
}

.queue-list {
  max-height: 400px;
  overflow-y: auto;
}

.queue-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  margin-bottom: 10px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #667eea;
  transition: transform 0.2s;
}

.queue-item:hover {
  transform: translateX(5px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.queue-item-info {
  flex: 1;
}

.queue-item-info strong {
  display: block;
  color: #333;
  margin-bottom: 5px;
}

.queue-item-info div {
  font-size: 13px;
  color: #666;
  margin-top: 3px;
}

.no-calls {
  text-align: center;
  padding: 40px 20px;
  color: #999;
  font-style: italic;
}

/* Calls List */
.calls-list {
  max-height: 400px;
  overflow-y: auto;
}

.call-item {
  padding: 15px;
  margin-bottom: 10px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #3498db;
}

.call-item.completed {
  border-left-color: #27ae60;
}

.call-item.failed {
  border-left-color: #e74c3c;
}

.call-item.on-hold {
  border-left-color: #f39c12;
}

.call-item-info strong {
  display: block;
  color: #333;
  margin-bottom: 5px;
}

.call-item-info div {
  font-size: 13px;
  color: #666;
  margin-top: 3px;
}

/* Admin Panel */
.admin-panel {
  max-width: 1400px;
  margin: 30px auto;
  padding: 0 20px;
}

.admin-panel h2 {
  color: white;
  margin-bottom: 20px;
  font-size: 24px;
}

.admin-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
}

.admin-section {
  background: white;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.admin-section h3 {
  color: #667eea;
  margin-bottom: 20px;
  font-size: 18px;
  border-bottom: 2px solid #f0f0f0;
  padding-bottom: 10px;
}

.queue-card {
  padding: 15px;
  margin-bottom: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #667eea;
}

.queue-card h4 {
  color: #333;
  margin-bottom: 8px;
}

.queue-card p {
  color: #666;
  margin-bottom: 8px;
  font-size: 14px;
}

.queue-card div {
  font-size: 13px;
  color: #777;
  margin-top: 5px;
}

/* Agent List */
.agent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  margin-bottom: 10px;
  background: #f8f9fa;
  border-radius: 8px;
}

.agent-info strong {
  display: block;
  color: #333;
  margin-bottom: 3px;
}

.agent-status {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.agent-status.online {
  background: #d4edda;
  color: #155724;
}

.agent-status.offline {
  background: #f8d7da;
  color: #721c24;
}

.agent-status.busy {
  background: #fff3cd;
  color: #856404;
}

.agent-status.away {
  background: #d1ecf1;
  color: #0c5460;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #764ba2;
}

/* Responsive */
@media (max-width: 768px) {
  .dashboard-container {
    grid-template-columns: 1fr;
  }
  
  .admin-controls {
    grid-template-columns: 1fr;
  }
  
  .header {
    flex-direction: column;
    gap: 15px;
  }
  
  .header-controls {
    flex-direction: column;
    width: 100%;
  }
  
  .control-buttons {
    flex-direction: column;
  }
  
  .control-buttons .btn {
    width: 100%;
  }
}

/* Admin Tabs */
.admin-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  background: white;
  padding: 10px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.admin-tab {
  flex: 1;
  padding: 12px 24px;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-tab:hover {
  background: #f8f9fa;
  color: #667eea;
}

.admin-tab.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.admin-tab-content {
  display: none;
}

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

/* Checkbox Group */
.checkbox-group {
  max-height: 300px;
  overflow-y: auto;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-top: 10px;
}

.checkbox-group label {
  display: block;
  padding: 10px;
  margin-bottom: 8px;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.checkbox-group label:hover {
  border-color: #667eea;
  transform: translateX(5px);
}

.checkbox-group input[type="checkbox"] {
  margin-right: 10px;
  cursor: pointer;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease-out;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 700px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  position: relative;
  animation: slideUp 0.3s ease-out;
}

.modal-content h3 {
  color: #667eea;
  margin-bottom: 20px;
  font-size: 24px;
  border-bottom: 2px solid #f0f0f0;
  padding-bottom: 15px;
}

.close-modal {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  color: #999;
  cursor: pointer;
  line-height: 1;
  transition: color 0.3s;
}

.close-modal:hover {
  color: #e74c3c;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.form-actions .btn {
  flex: 1;
}

.help-text {
  font-size: 13px;
  color: #777;
  margin-top: 8px;
  line-height: 1.5;
  font-style: italic;
}

/* Queue Actions */
.queue-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.queue-actions .btn {
  flex: 1;
  min-width: 80px;
}

/* Agent Card */
.agent-card {
  padding: 15px;
  margin-bottom: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #3498db;
}

.agent-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.agent-card-header h4 {
  color: #333;
  margin: 0;
}

.agent-card-info {
  font-size: 13px;
  color: #666;
  margin-bottom: 5px;
}

.agent-card-queues {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e0e0e0;
}

.agent-card-queues strong {
  font-size: 12px;
  color: #555;
  display: block;
  margin-bottom: 5px;
}

.agent-card-queues span {
  display: inline-block;
  padding: 4px 8px;
  background: #667eea;
  color: white;
  border-radius: 12px;
  font-size: 11px;
  margin-right: 5px;
  margin-bottom: 5px;
}

.agent-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.agent-actions .btn {
  flex: 1;
}

/* Forwarding Status Badge */
.forwarding-badge {
  display: inline-block;
  padding: 4px 12px;
  background: #f39c12;
  color: white;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  margin-left: 10px;
}

.forwarding-badge.active {
  background: #27ae60;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel {
  animation: slideIn 0.3s ease-out;
}

/* Loading */
.loading {
  text-align: center;
  padding: 20px;
  color: #999;
}

.loading::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% {
    content: '.';
  }
  40% {
    content: '..';
  }
  60%, 100% {
    content: '...';
  }
}

/* Phone Number Form */
.phone-number-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #555;
  font-size: 14px;
}

.phone-number-form input[type="tel"] {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.3s;
  margin-bottom: 12px;
}

.phone-number-form input[type="tel"]:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.phone-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

.primary-checkbox {
  display: flex;
  align-items: center;
  margin: 0;
  cursor: pointer;
  user-select: none;
}

.primary-checkbox input[type="checkbox"] {
  margin-right: 8px;
  cursor: pointer;
  width: 18px;
  height: 18px;
}

.primary-checkbox span {
  font-weight: 500;
  color: #555;
  font-size: 14px;
}

.phone-actions-row .btn {
  padding: 12px 32px;
  min-width: 100px;
}

/* Phone Numbers List */
.phone-numbers-list {
  min-height: 60px;
  max-height: 300px;
  overflow-y: auto;
}

/* Responsive Modal */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    padding: 20px;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .queue-actions,
  .agent-actions {
    flex-direction: column;
  }
  
  .phone-number-input-container {
    flex-direction: column;
    align-items: stretch;
  }
  
  .primary-checkbox-wrapper {
    padding-bottom: 0;
    padding-top: 8px;
  }
  
  .add-phone-btn {
    width: 100%;
    margin-top: 12px;
  }
}
