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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.5;
}

/* Header */
.header {
  background: #1a1a2e;
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.home-link {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 0.25rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  transition: all 0.2s;
}

.home-link:hover {
  color: white;
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.1);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

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

/* Cards */
.card {
  background: white;
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card.center {
  text-align: center;
}

.card h2 {
  margin-bottom: 0.5rem;
}

.card p {
  color: #666;
  margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  background: #e0e0e0;
  color: #333;
}

.btn:hover {
  background: #d0d0d0;
}

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

.btn-primary {
  background: #0052cc;
  color: white;
}

.btn-primary:hover {
  background: #0047b3;
}

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

.btn-danger:hover {
  background: #c62f0a;
}

.btn-small {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0 0.5rem;
}

/* Loading */
.loading {
  text-align: center;
  padding: 3rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e0e0e0;
  border-top-color: #0052cc;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

.spinner-small {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid #e0e0e0;
  border-top-color: #0052cc;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Active Timer Banner */
.active-timer-banner {
  background: #0052cc;
  color: white;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.timer-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.timer-ticket {
  font-weight: 600;
}

.timer-display {
  font-family: monospace;
  font-size: 1.25rem;
}

/* Error Banner */
.error-banner {
  background: #ffebe6;
  color: #de350b;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Tickets Section */
.tickets-section {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

.section-header h2 {
  font-size: 1.125rem;
}

.empty-state {
  text-align: center;
  padding: 2rem;
  color: #666;
}

/* Ticket List */
.ticket-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ticket-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
  transition: background 0.15s;
}

.ticket-row:hover {
  background: #f5f5f5;
}

.ticket-row.running {
  background: #e6f0ff;
}

.btn-sm {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  min-width: 44px;
}

.ticket-key {
  font-weight: 600;
  color: #0052cc;
  white-space: nowrap;
  font-size: 0.875rem;
}

.ticket-summary {
  color: #333;
  font-size: 0.875rem;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.ticket-org {
  color: #888;
  font-size: 0.75rem;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timer-time {
  font-family: monospace;
  font-size: 0.875rem;
  color: #0052cc;
  white-space: nowrap;
}

.timer-input {
  font-family: monospace;
  font-size: 0.875rem;
  color: #0052cc;
  width: 85px;
  padding: 0.2rem 0.5rem;
  border: 1px solid #ccc;
  border-radius: 3px;
  text-align: center;
  background: white;
  flex-shrink: 0;
}

.timer-input:focus {
  outline: none;
  border-color: #0052cc;
  background: #fff;
}

.timer-input.timer-inactive {
  color: #ccc;
  background: #f9f9f9;
  border-color: #e0e0e0;
  cursor: default;
}

/* Status indicators */
.status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.status-pending,
.status-success,
.status-failed,
.status-idle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
}

.status-idle {
  color: #ccc;
  font-size: 0.5rem;
}

.status-success {
  color: #00875a;
  font-weight: bold;
}

.status-failed {
  color: #de350b;
  font-weight: bold;
  cursor: pointer;
}

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

.modal {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 400px;
  width: 90%;
}

.modal h3 {
  margin-bottom: 0.5rem;
}

.modal p {
  color: #666;
  margin-bottom: 0.5rem;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* Responsive */
@media (max-width: 600px) {
  .header {
    padding: 1rem;
  }

  .container {
    padding: 1rem 0.5rem;
  }

  .ticket-footer {
    flex-wrap: wrap;
  }
}
