/* =========================================
   COMPANY OWNERSHIP - Styly
   =========================================
   Přiřazování firem, konflikty, admin dashboard
   ========================================= */

/* Tlačítko ownership u firmy */
.btn-company-ownership {
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
}

.btn-company-ownership svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

.btn-company-ownership:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
  border-color: var(--color-accent);
  opacity: 1;
}

.btn-company-ownership.assigned {
  background: linear-gradient(135deg, #4CAF50, #66BB6A);
  border-color: #4CAF50;
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.4);
  opacity: 1;
  animation: pulseGreen 2s ease-in-out infinite;
}

@keyframes pulseGreen {
  0%, 100% {
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.4);
  }
  50% {
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.6);
  }
}

.btn-company-ownership.assigned:hover {
  background: linear-gradient(135deg, #43A047, #4CAF50);
  transform: scale(1.15);
}

/* Tlačítko "Moje firmy" v hlavním menu */
.btn-my-companies {
  width: 100%;
  padding: 12px 16px;
  background: linear-gradient(135deg, #2196F3, #42A5F5);
  color: white;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  text-align: center;
}

.btn-my-companies svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
}

.btn-my-companies:hover {
  background: linear-gradient(135deg, #1976D2, #2196F3);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

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

#my-companies-count {
  background: rgba(255, 255, 255, 0.25);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  min-width: 20px;
  display: inline-block;
}

/* User info badge */
.user-info-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--color-surface);
  border-radius: 8px;
  border: 1px solid var(--color-border);
}

/* Green company name for my companies */
.company-item-name.is-my-company {
  color: #4CAF50 !important;
  font-weight: 600 !important;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #2196F3, #42A5F5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.user-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.user-company {
  font-size: 12px;
  color: var(--color-text-muted);
}

.admin-badge {
  background: linear-gradient(135deg, #FF9800, #FFB74D);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 8px;
}

/* Conflict Dialog */
.conflict-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.2s;
}

.conflict-dialog {
  background: white;
  border-radius: 12px;
  padding: 32px;
  max-width: 450px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
  animation: slideUp 0.3s;
}

.conflict-dialog-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

.conflict-dialog-title {
  font-size: 24px;
  font-weight: 600;
  color: #D32F2F;
  margin-bottom: 16px;
}

.conflict-dialog-message {
  font-size: 15px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 20px;
}

.conflict-dialog-message strong {
  color: #333;
  font-weight: 600;
}

.conflict-dialog-user {
  background: #FFF3E0;
  border: 2px solid #FF9800;
  border-radius: 8px;
  padding: 16px;
  font-size: 18px;
  font-weight: 600;
  color: #E65100;
  margin-bottom: 20px;
}

.conflict-dialog-hint {
  font-size: 13px;
  color: #999;
  margin-bottom: 24px;
  font-style: italic;
}

.conflict-dialog-btn {
  background: linear-gradient(135deg, #2196F3, #42A5F5);
  color: white;
  border: none;
  padding: 12px 32px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.conflict-dialog-btn:hover {
  background: linear-gradient(135deg, #1976D2, #2196F3);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

/* Admin Dashboard */
#admin-panel {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: 600px;
  height: 100vh;
  background: #1a1d23;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
  overflow-y: auto;
  z-index: 9000;
  animation: slideInRight 0.3s;
  color: #e4e4e7;
  font-size: 13px;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

.admin-dashboard {
  padding: 24px;
}

.admin-header {
  margin-bottom: 32px;
}

.admin-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.admin-title h2 {
  margin: 0;
  font-size: 20px;
  color: #e4e4e7;
  font-weight: 600;
}

.admin-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s;
  color: #a1a1aa;
}

.admin-close-btn:hover {
  background: #F44336;
  color: white;
  transform: rotate(90deg);
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 16px;
  border-radius: 8px;
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 11px;
  color: #a1a1aa;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  display: block;
  font-size: 24px;
  font-weight: 600;
  color: #e4e4e7;
}

.stat-value.stat-warning {
  color: #F44336;
}

.admin-conflicts-alert {
  background: rgba(244, 67, 54, 0.1);
  border: 2px solid #F44336;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
  display: flex;
  gap: 16px;
  align-items: start;
  font-size: 13px;
}

.alert-icon {
  font-size: 28px;
}

.alert-content strong {
  color: #F44336;
  font-size: 14px;
  display: block;
  margin-bottom: 8px;
}

.alert-content p {
  margin: 0;
  color: #a1a1aa;
  font-size: 13px;
}

.admin-ok-badge {
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid #4CAF50;
  color: #4CAF50;
  padding: 12px 20px;
  border-radius: 6px;
  font-weight: 500;
  font-size: 13px;
  display: inline-block;
  margin-bottom: 20px;
}

.admin-actions {
  display: flex;
  gap: 12px;
}

.btn-export {
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-export-csv {
  background: linear-gradient(135deg, #4CAF50, #66BB6A);
  color: white;
}

.btn-export-csv:hover {
  background: linear-gradient(135deg, #43A047, #4CAF50);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.btn-export-json {
  background: linear-gradient(135deg, #2196F3, #42A5F5);
  color: white;
}

.btn-export-json:hover {
  background: linear-gradient(135deg, #1976D2, #2196F3);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

/* Conflicts section */
.admin-conflicts-section {
  margin-bottom: 32px;
}

.admin-conflicts-section h3 {
  font-size: 11px;
  margin-bottom: 16px;
  color: #a1a1aa;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.conflict-card {
  background: rgba(255, 152, 0, 0.1);
  border: 2px solid #FF9800;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  font-size: 13px;
}

.conflict-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.conflict-company {
  font-size: 14px;
  font-weight: 600;
  color: #FFB74D;
}

.conflict-badge {
  background: #FF5722;
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.conflict-user-company {
  margin-bottom: 8px;
  color: #a1a1aa;
  font-size: 13px;
}

.conflict-users ul {
  margin: 8px 0 0 20px;
  color: #e4e4e7;
  font-size: 13px;
}

.conflict-users li {
  margin-bottom: 4px;
}

/* Users section */
.admin-users-section h3 {
  font-size: 11px;
  margin-bottom: 16px;
  color: #a1a1aa;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-user-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  font-size: 13px;
}

.admin-user-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-user-name {
  font-size: 14px;
  font-weight: 600;
  color: #e4e4e7;
  margin-bottom: 4px;
}

.admin-user-company {
  font-size: 12px;
  color: #a1a1aa;
}

.admin-user-count {
  background: rgba(33, 150, 243, 0.2);
  color: #42A5F5;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.admin-user-companies {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-company-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  font-size: 12px;
}

.admin-company-item .company-name {
  flex: 1;
  font-weight: 500;
  color: #e4e4e7;
  font-size: 13px;
}

.admin-company-item .company-regno {
  color: #a1a1aa;
  font-size: 12px;
  flex-shrink: 0;
}

.admin-company-item .company-status {
  flex-shrink: 0;
}

.admin-company-item .company-date {
  color: #71717a;
  font-size: 11px;
  flex-shrink: 0;
}

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

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

/* Loading & Error states */
.loading, .error {
  padding: 40px;
  text-align: center;
  font-size: 16px;
  color: var(--color-text-muted);
}

.error {
  color: #F44336;
}

/* =========================================
   STATUS BADGY V ADMIN DASHBOARDU
   ========================================= */

.company-status {
  display: inline-block;
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 4px;
  text-transform: lowercase;
  letter-spacing: 0.3px;
}

.company-status.status-not_contacted {
  background: rgba(161, 161, 170, 0.2);
  color: #a1a1aa;
}

.company-status.status-called {
  background: rgba(76, 175, 80, 0.2);
  color: #66BB6A;
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.company-status.status-not_called {
  background: rgba(244, 67, 54, 0.2);
  color: #EF5350;
  border: 1px solid rgba(244, 67, 54, 0.3);
}

.company-status.status-scheduled {
  background: rgba(33, 150, 243, 0.2);
  color: #42A5F5;
  border: 1px solid rgba(33, 150, 243, 0.3);
}

.company-status.status-follow_up {
  background: rgba(255, 152, 0, 0.2);
  color: #FFB74D;
  border: 1px solid rgba(255, 152, 0, 0.3);
}

.company-status.status-rescheduled {
  background: rgba(156, 39, 176, 0.2);
  color: #BA68C8;
  border: 1px solid rgba(156, 39, 176, 0.3);
}

/* =========================================
   STATUS DROPDOWN V SEZNAMU FIREM
   ========================================= */

.company-item-status {
  display: flex;
  align-items: center;
  margin: 0 8px;
}

.company-status-select {
  padding: 4px 8px;
  font-size: 11px;
  font-family: inherit;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: #e4e4e7;
  cursor: pointer;
  min-width: 110px;
  transition: all 0.2s;
}

.company-status-select:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.company-status-select:focus {
  outline: none;
  border-color: #42A5F5;
  box-shadow: 0 0 0 2px rgba(66, 165, 245, 0.2);
}

.company-status-select option {
  background: #1a1d23;
  color: #e4e4e7;
}

/* =========================================
   ADMIN - ZÁLOHA KONTAKTŮ
   ========================================= */

.admin-contacts-backup-section {
  margin-bottom: 32px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 20px;
}

.admin-contacts-backup-section h3 {
  font-size: 11px;
  margin-bottom: 16px;
  color: #a1a1aa;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.contacts-backup-stats {
  margin-bottom: 16px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
}

.stat-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 12px;
  border-radius: 6px;
  text-align: center;
}

.stat-item .stat-label {
  display: block;
  font-size: 10px;
  color: #a1a1aa;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.stat-item .stat-value {
  display: block;
  font-size: 20px;
  font-weight: 600;
  color: #e4e4e7;
}

.admin-contacts-actions {
  display: flex;
  gap: 12px;
}

.btn-sync-now {
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  background: linear-gradient(135deg, #FF9800, #FFB74D);
  color: white;
}

.btn-sync-now:hover {
  background: linear-gradient(135deg, #F57C00, #FF9800);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}
