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

:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: #ccfbf1;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #059669;
  --success-light: #d1fae5;
  --error: #dc2626;
  --error-light: #fee2e2;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 240px;
  background: var(--bg-card);
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--primary);
}

.nav-links {
  list-style: none;
  padding: 20px 0;
  flex: 1;
}

.nav-links a {
  display: block;
  padding: 12px 20px;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-links a:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-links a.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-left-color: var(--primary);
  font-weight: 500;
}

.nav-footer {
  padding: 20px;
  border-top: 1px solid var(--border);
}

.logout-btn {
  display: block;
  padding: 10px 16px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  text-align: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.logout-btn:hover {
  background: var(--error-light);
  border-color: var(--error);
  color: var(--error);
}

/* Main content */
.content {
  flex: 1;
  padding: 30px;
  overflow-x: auto;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 30px;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text);
}

.count {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.stat-card {
  background: var(--bg-card);
  padding: 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Tables */
.table-container {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background: var(--bg-hover);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.data-table tr:hover td {
  background: var(--bg-hover);
}

.url-cell {
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: monospace;
  font-size: 0.9rem;
}

.uuid-cell {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px !important;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-top: 20px;
}

.page-info {
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

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

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

/* Login page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0fdfa 0%, #f8fafc 100%);
}

.login-box {
  background: var(--bg-card);
  padding: 40px;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 400px;
}

.login-box h1 {
  text-align: center;
  margin-bottom: 30px;
  color: var(--primary);
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  transition: all 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.login-box .btn {
  width: 100%;
  padding: 14px;
  font-size: 1rem;
}

.error-message {
  background: var(--error-light);
  border: 1px solid var(--error);
  color: var(--error);
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  text-align: center;
}

/* Error page */
.error-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.error-container h1 {
  font-size: 2rem;
  color: var(--error);
  margin-bottom: 15px;
}

.error-container p {
  color: var(--text-muted);
  margin-bottom: 25px;
}

/* Copy button */
.copy-btn {
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.copy-btn.copied {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

/* Page header with button */
.page-header .btn {
  margin-left: auto;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.75rem;
  border-radius: 4px;
  margin-left: 8px;
}

.badge-image {
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* Status badges */
.status {
  display: inline-block;
  padding: 4px 10px;
  font-size: 0.8rem;
  border-radius: 6px;
  font-weight: 500;
}

.status-draft {
  background: var(--bg-hover);
  color: var(--text-muted);
}

.status-sent {
  background: var(--success-light);
  color: var(--success);
}

/* Locales display */
.locales {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Action buttons */
.actions {
  white-space: nowrap;
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.8rem;
}

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

.btn-danger:hover {
  background: var(--error);
  border-color: var(--error);
  color: white;
}

/* Push form styles */
.push-form {
  max-width: 800px;
}

.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.form-section h2 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--text);
}

.section-hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.form-hint {
  display: block;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 6px;
}

.push-form .form-group {
  margin-bottom: 16px;
}

.push-form .form-group:last-child {
  margin-bottom: 0;
}

.push-form input,
.push-form textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.2s;
}

.push-form textarea {
  resize: vertical;
  min-height: 80px;
}

.push-form input:focus,
.push-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Locale tabs */
.locales-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.locale-tab {
  padding: 8px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.locale-tab:hover {
  border-color: var(--primary);
  color: var(--text);
}

.locale-tab.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 500;
}

.locale-check {
  margin-left: 4px;
  color: var(--success);
}

/* Locale panels */
.locale-panel {
  display: none;
}

.locale-panel.active {
  display: block;
}

/* Form actions */
.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.form-actions .btn {
  min-width: 100px;
}

/* Devices page - Country styles */
.country-flag {
  font-size: 1.5rem;
  margin-right: 10px;
  vertical-align: middle;
}

.country-name {
  font-weight: 500;
}

.country-code {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-left: 8px;
}

.percentage-bar {
  position: relative;
  background: var(--bg);
  border-radius: 6px;
  height: 24px;
  min-width: 150px;
  overflow: hidden;
}

.percentage-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--primary);
  opacity: 0.2;
  border-radius: 6px;
}

.percentage-text {
  position: relative;
  z-index: 1;
  display: block;
  padding: 0 10px;
  line-height: 24px;
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 500;
}

/* Push notification preview */
.preview-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.push-thumb {
  width: 60px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.preview-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.preview-text strong {
  font-size: 0.9rem;
  color: var(--text);
}

.preview-text small {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Current image in edit form */
.current-image {
  margin-bottom: 16px;
}

.current-image img {
  max-width: 300px;
  max-height: 150px;
  border-radius: 8px;
  display: block;
  margin-bottom: 8px;
  border: 1px solid var(--border);
}

.remove-image-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
}

.remove-image-label input[type="checkbox"] {
  width: auto;
}

/* File input styling */
.push-form input[type="file"] {
  padding: 10px;
  background: var(--bg);
  cursor: pointer;
}

.push-form input[type="file"]::file-selector-button {
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  margin-right: 12px;
  font-weight: 500;
  transition: all 0.2s;
}

.push-form input[type="file"]::file-selector-button:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Translate button */
.translate-actions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.btn-translate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-translate:hover {
  background: var(--primary-light);
}

.translate-icon {
  font-size: 1.1rem;
}

/* Translate overlay */
.translate-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;
}

.translate-modal {
  background: var(--bg-card);
  padding: 40px;
  border-radius: 16px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.translate-modal p {
  margin-top: 16px;
  color: var(--text);
  font-weight: 500;
}

.translate-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 1s linear infinite;
}

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

/* Submenu styles */
.nav-links .has-submenu {
  position: relative;
}

.nav-links .menu-label {
  display: block;
  padding: 12px 20px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  user-select: none;
}

.nav-links .menu-label:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-links .has-submenu.open .menu-label {
  color: var(--text);
  font-weight: 500;
}

.nav-links .submenu {
  list-style: none;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: var(--bg);
}

.nav-links .has-submenu.open .submenu {
  max-height: 200px;
}

.nav-links .submenu a {
  padding: 10px 20px 10px 32px;
  font-size: 0.9rem;
}

.nav-links .submenu a.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-left-color: var(--primary);
  font-weight: 500;
}
