/* Dark VS Code Theme Variables */
:root {
  --bg-primary: #1e1e1e;
  --bg-secondary: #2d2d30;
  --bg-tertiary: #252526;
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --text-muted: #969696;
  --accent-blue: #007acc;
  --accent-green: #00d084;
  --accent-red: #f14c4c;
  --accent-yellow: #ffcc02;
  --border: #3e3e42;
  --shadow: rgba(0, 0, 0, 0.5);
  --success: #00d084;
  --warning: #ffcc02;
  --error: #f14c4c;
  --info: #007acc;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  background: var(--bg-secondary);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.header h1 {
  color: var(--accent-blue);
  margin-bottom: 10px;
  font-size: 1.8rem;
}

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

.status.connected {
  color: var(--success);
}

.status.disconnected {
  color: var(--error);
}

/* Form Styles */
.form-group {
  margin-bottom: 20px;
}

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

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 16px;
  transition: border-color 0.3s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.2);
}

input[type="file"].form-control {
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  display: block !important;
  visibility: visible !important;
}

select.form-control {
  cursor: pointer;
}

textarea.form-control {
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
}

/* Tag Buttons */
.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.tag-btn {
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
  touch-action: manipulation;
}

.tag-btn:hover {
  background: var(--accent-blue);
  color: var(--text-primary);
  border-color: var(--accent-blue);
}

.tag-btn.active {
  background: var(--accent-blue);
  color: var(--text-primary);
  border-color: var(--accent-blue);
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  touch-action: manipulation;
  min-height: 48px;
}

.btn-primary {
  background: var(--accent-blue);
  color: var(--text-primary);
}

.btn-primary:hover {
  background: #005a9e;
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

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

.btn-success {
  background: var(--success);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--error);
  color: var(--text-primary);
}

.btn-group {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.btn-full {
  width: 100%;
}

/* Messages */
.message {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-weight: 500;
}

.message.success {
  background: rgba(0, 208, 132, 0.2);
  color: var(--success);
  border: 1px solid var(--success);
}

.message.error {
  background: rgba(241, 76, 76, 0.2);
  color: var(--error);
  border: 1px solid var(--error);
}

.message.info {
  background: rgba(0, 122, 204, 0.2);
  color: var(--info);
  border: 1px solid var(--info);
}

/* Login Form */
.login-container {
  max-width: 400px;
  margin: 50px auto;
  padding: 40px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px var(--shadow);
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-header h1 {
  color: var(--accent-blue);
  margin-bottom: 10px;
}

.login-header p {
  color: var(--text-muted);
}

/* Statistics */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin: 20px 0;
}

.stat-card {
  background: var(--bg-secondary);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
  color: var(--accent-blue);
  margin-bottom: 5px;
}

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

/* Recent Entries */
.recent-entries {
  margin-top: 30px;
}

.entry {
  background: var(--bg-secondary);
  padding: 15px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 15px;
}

.entry-header {
  font-weight: 500;
  color: var(--accent-blue);
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.entry-description {
  color: var(--text-secondary);
  line-height: 1.5;
}

.entry-time {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-right: 10px;
}

.entry-client {
  color: var(--accent-blue);
  font-weight: 500;
  margin-right: 10px;
}

.entry-tags {
  display: inline-block;
}

.entry-tags .tag {
  display: inline-block;
  background: var(--accent-blue);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  margin-left: 5px;
}

.entry-metadata {
  margin-top: 10px;
}

.entry-metadata .badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  margin-right: 5px;
}

.badge-primary {
  background: var(--accent-blue);
  color: white;
}

.badge-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.badge-success {
  background: var(--success);
  color: white;
}

/* File Preview Styles */
.file-preview {
  margin-top: 10px;
}

.file-preview-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-preview-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
}

.file-preview-item .file-icon {
  margin-right: 8px;
  font-size: 1.2rem;
}

.file-preview-item .file-name {
  flex: 1;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-preview-item .file-size {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-left: 10px;
}

/* Loading States */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.spinner {
  border: 2px solid var(--border);
  border-top: 2px solid var(--accent-blue);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
  display: inline-block;
  margin-right: 8px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Navigation */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.nav-links {
  display: flex;
  gap: 15px;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 4px;
  transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  .header {
    padding: 15px;
  }

  .header h1 {
    font-size: 1.5rem;
  }

  .btn-group {
    flex-direction: column;
  }

  .tag-group {
    justify-content: center;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .login-container {
    margin: 20px auto;
    padding: 30px 20px;
  }

  .nav {
    flex-direction: column;
    gap: 15px;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 10px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .tag-btn {
    padding: 10px 16px;
    font-size: 16px;
  }

  .form-control {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* PWA Styles */
.install-prompt {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
  display: none;
}

.install-prompt.show {
  display: block;
}

.install-prompt button {
  margin-top: 10px;
}

/* Dark scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Focus styles for accessibility */
.btn:focus,
.form-control:focus,
.tag-btn:focus {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* Hidden class */
.hidden {
  display: none !important;
}

/* Flex utilities */
.flex {
  display: flex;
}

.flex-column {
  flex-direction: column;
}

.flex-1 {
  flex: 1;
}

.justify-between {
  justify-content: space-between;
}

.items-center {
  align-items: center;
}

/* Text utilities */
.text-center {
  text-align: center;
}

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

.text-success {
  color: var(--success);
}

.text-error {
  color: var(--error);
}
/* Toast Notifications */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 20px;
  border-radius: 8px;
  font-weight: 500;
  box-shadow: 0 4px 12px var(--shadow);
  z-index: 1000;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
  max-width: 300px;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast.success {
  background: var(--success);
  color: white;
}

.toast.error {
  background: var(--error);
  color: white;
}

.toast.info {
  background: var(--info);
  color: white;
}

/* Offline Support Styles */
.online-indicator {
    color: #28a745;
    font-size: 0.8em;
    margin-left: 10px;
}

.offline-indicator {
    color: #dc3545;
    font-size: 0.8em;
    margin-left: 10px;
    animation: pulse 2s infinite;
}

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

.pending-counter {
    background: #ffc107;
    color: #000;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    margin-left: 10px;
}

.offline-banner {
    background: #dc3545;
    color: white;
    padding: 10px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.syncing-banner {
    background: #28a745;
    color: white;
    padding: 10px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.pending-badge {
    background: white;
    color: #dc3545;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 10px;
    font-weight: bold;
}

.offline-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 5px;
    color: white;
    z-index: 10000;
    animation: slideIn 0.3s ease;
}

.offline-notification.success {
    background: #28a745;
}

.offline-notification.error {
    background: #dc3545;
}

.offline-notification.info {
    background: #17a2b8;
}

.offline-notification.warning {
    background: #ffc107;
    color: #000;
}

.offline-notification.fade-out {
    animation: slideOut 0.3s ease;
}

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

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}
