* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: Arial, sans-serif; background: #f5f5f5; }

/* Login */
.login-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 20px; }
.login-box { background: white; padding: 40px; border-radius: 10px; box-shadow: 0 10px 25px rgba(0,0,0,0.2); width: 100%; max-width: 400px; }
.login-box h1 { margin-bottom: 30px; color: #333; text-align: center; font-size: 24px; }
.login-box .form-group { margin-bottom: 20px; }
.login-box input { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 16px; }
.login-box button { width: 100%; padding: 12px; background: #667eea; color: white; border: none; border-radius: 4px; font-size: 16px; cursor: pointer; }
.login-box button:hover { background: #5568d3; }
.error-msg { color: #e74c3c; margin-top: 10px; text-align: center; }

/* Header */
.header { background: #2c3e50; color: white; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.header-top { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; flex-wrap: wrap; gap: 10px; }
.header-top h1 { font-size: 20px; }
.user-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-name { font-size: 14px; }
.logout-btn { background: #e74c3c; color: white; padding: 8px 15px; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; white-space: nowrap; }
.logout-btn:hover { background: #c0392b; }

/* Navigation */
.nav-menu { background: #34495e; overflow-x: auto; }
.nav-menu ul { list-style: none; display: flex; padding: 0; margin: 0; }
.nav-menu li { margin: 0; flex-shrink: 0; }
.nav-menu a { display: block; padding: 15px 20px; color: white; text-decoration: none; transition: background 0.3s; cursor: pointer; white-space: nowrap; }
.nav-menu a:hover { background: #2c3e50; }
.nav-menu a.active { background: #3498db; }

/* Main Container */
.app-container { display: none; }
.container { max-width: 1400px; margin: 0 auto; padding: 15px; }
.content { display: none; }
.content.active { display: block; }

/* Cards */
.card { background: white; padding: 15px; border-radius: 8px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.card-header h2 { margin: 0; font-size: 20px; }

/* Buttons */
button { background: #3498db; color: white; padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; }
button:hover { background: #2980b9; }
.btn-add { background: #27ae60; }
.btn-add:hover { background: #229954; }
.btn-secondary { background: #95a5a6; margin-left: 10px; }
.btn-secondary:hover { background: #7f8c8d; }
.btn-danger { background: #e74c3c; }
.btn-danger:hover { background: #c0392b; }
.btn-small { padding: 5px 10px; font-size: 12px; }

/* Search */
.search-box { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; margin-bottom: 20px; }

/* Form */
.form-group { margin-bottom: 15px; }
label { display: block; margin-bottom: 5px; font-weight: bold; color: #555; font-size: 14px; }
input, select, textarea { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; }
input[type="checkbox"] { width: auto; margin-right: 5px; }
textarea { min-height: 80px; resize: vertical; font-family: Arial, sans-serif; }

/* Client List - Tile Layout */
#clients-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 15px; }
.client-tile { background: white; padding: 20px; border-radius: 8px; cursor: pointer; transition: all 0.3s; box-shadow: 0 2px 4px rgba(0,0,0,0.08); border-top: 4px solid #3498db; }
.client-tile:hover { box-shadow: 0 6px 12px rgba(0,0,0,0.15); transform: translateY(-2px); }
.tile-name { font-size: 18px; font-weight: bold; margin-bottom: 8px; color: #2c3e50; word-break: break-word; }
.tile-company { color: #7f8c8d; font-size: 14px; margin-bottom: 12px; word-break: break-word; }
.tile-info { color: #555; font-size: 13px; line-height: 1.8; word-break: break-word; }
.primary-badge { background: #3498db; color: white; padding: 2px 6px; border-radius: 3px; font-size: 11px; margin-left: 5px; }

/* Full Page Client View */
.client-page { display: none; }
.client-page.active { display: block; }
.client-header { background: white; padding: 15px; border-radius: 8px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.client-header-top { display: flex; justify-content: space-between; align-items: start; margin-bottom: 15px; flex-wrap: wrap; gap: 15px; }
.client-title { font-size: 24px; color: #2c3e50; margin-bottom: 10px; word-break: break-word; }
.client-subtitle { color: #666; font-size: 16px; word-break: break-word; }
.client-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.client-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.info-section { background: white; padding: 15px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.info-section h3 { margin-bottom: 15px; color: #2c3e50; border-bottom: 2px solid #3498db; padding-bottom: 10px; font-size: 18px; }
.info-item { margin-bottom: 10px; padding: 8px; background: #f8f9fa; border-radius: 4px; word-break: break-word; }
.info-label { font-size: 12px; color: #666; margin-bottom: 2px; }
.info-value { color: #2c3e50; font-weight: 500; font-size: 14px; }

/* Dynamic Fields */
.dynamic-fields { margin-bottom: 15px; }
.dynamic-field-group { display: grid; grid-template-columns: 2fr 1fr auto auto; gap: 10px; margin-bottom: 10px; align-items: start; }
.dynamic-field-group.email-group { grid-template-columns: 1fr 1fr 1fr 1fr auto auto; }
.btn-remove { background: #e74c3c; padding: 10px; }
.checkbox-wrapper { display: flex; align-items: center; padding: 10px; white-space: nowrap; }
.checkbox-wrapper input { margin-right: 5px; }

/* Modal */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; padding: 20px; overflow-y: auto; }
.modal.show { display: flex; align-items: flex-start; justify-content: center; padding-top: 20px; }
.modal-content { background: white; padding: 20px; border-radius: 8px; max-width: 900px; width: 100%; max-height: calc(100vh - 40px); overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h2 { margin: 0; font-size: 20px; }
.close { font-size: 28px; cursor: pointer; color: #999; line-height: 1; }
.close:hover { color: #333; }

.placeholder { text-align: center; padding: 40px; color: #999; }
.back-link { color: #3498db; text-decoration: none; font-size: 14px; margin-bottom: 10px; display: inline-block; }
.back-link:hover { text-decoration: underline; }

/* Mobile Responsive */
@media (max-width: 768px) {
  .login-box { padding: 30px 20px; }
  .header-top { padding: 10px 15px; }
  .header-top h1 { font-size: 18px; }
  .nav-menu a { padding: 12px 15px; font-size: 14px; }
  .container { padding: 10px; }
  .card { padding: 15px; }
  .card-header h2 { font-size: 18px; }
  #clients-list { grid-template-columns: 1fr; }
  .tile-name { font-size: 16px; }
  .tile-company { font-size: 13px; }
  .tile-info { font-size: 12px; }
  .client-title { font-size: 22px; }
  .client-subtitle { font-size: 14px; }
  .client-grid { grid-template-columns: 1fr; }
  .info-section h3 { font-size: 16px; }
  .modal-content { padding: 15px; }
  .modal-header h2 { font-size: 18px; }
  
  .dynamic-field-group { grid-template-columns: 1fr; gap: 8px; }
  .dynamic-field-group.email-group { grid-template-columns: 1fr; }
  .checkbox-wrapper { justify-content: flex-start; padding: 5px 10px; }
  .btn-remove { width: 100%; }
  
  .client-actions { width: 100%; }
  .client-actions button { flex: 1; }
  .card-header { flex-direction: column; align-items: stretch; }
  .card-header button { width: 100%; }
  
  button { padding: 12px 16px; }
  .btn-secondary { margin-left: 0; margin-top: 10px; width: 100%; }
}

@media (max-width: 480px) {
  .header-top h1 { font-size: 16px; }
  .user-name { font-size: 12px; }
  .logout-btn { padding: 6px 12px; font-size: 12px; }
  .nav-menu a { padding: 10px 12px; font-size: 13px; }
  .client-title { font-size: 20px; }
  input, select, textarea, button { font-size: 16px; }
}

/* Section Headers with Action Buttons */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.section-header h3 {
  margin: 0;
  color: #2c3e50;
  font-size: 18px;
}

.btn-manage {
  background: #3498db;
  color: white;
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

.btn-manage:hover {
  background: #2980b9;
}

/* Modal specific styles */
.modal-body {
  max-height: 60vh;
  overflow-y: auto;
}

.item-list {
  margin-bottom: 20px;
}

.item-card {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 10px;
  border-left: 3px solid #3498db;
  position: relative;
}

.item-card.primary {
  border-left-color: #27ae60;
  background: #e8f5e9;
}

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

.item-card-title {
  font-weight: bold;
  color: #2c3e50;
  font-size: 16px;
}

.item-card-actions {
  display: flex;
  gap: 5px;
}

.item-card-actions button {
  padding: 5px 10px;
  font-size: 12px;
}

.item-card-body {
  color: #666;
  font-size: 14px;
  line-height: 1.6;
}

.item-card-body strong {
  color: #2c3e50;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.form-row-full {
  grid-column: 1 / -1;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 4px;
}

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

.empty-state {
  text-align: center;
  padding: 30px;
  color: #999;
  font-style: italic;
}

/* Mobile adjustments for new modals */
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .item-card-actions {
    flex-direction: column;
  }
  
  .item-card-actions button {
    width: 100%;
  }
}

/* Time Tracker Styles */
.timer-container { background: #f8f9fa; padding: 20px; border-radius: 8px; margin-bottom: 20px; }
.timer-inactive { text-align: center; padding: 40px 20px; color: #7f8c8d; }
.timer-inactive p { margin: 5px 0; }
.timer-hint { font-size: 14px; color: #95a5a6; }

.timer-active { }
.timer-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.timer-info h3 { margin: 0; font-size: 24px; color: #2c3e50; }
.timer-category-badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: bold; color: white; text-transform: uppercase; margin-left: 10px; }
.category-client { background: #3498db; }
.category-personal { background: #9b59b6; }
.category-research { background: #e67e22; }
.category-break { background: #16a085; }
.category-timeout { background: #95a5a6; }

.timer-clock { font-size: 64px; font-weight: bold; text-align: center; color: #2c3e50; font-family: 'Courier New', monospace; margin: 20px 0; letter-spacing: 4px; }
.timer-controls { display: flex; gap: 10px; justify-content: center; margin: 20px 0; flex-wrap: wrap; }
.timer-controls button { padding: 8px 16px; font-size: 14px; }
.timer-notes { margin-top: 20px; }
.timer-notes label { display: block; margin-bottom: 8px; font-weight: bold; color: #2c3e50; }
.timer-notes textarea { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px; font-family: Arial, sans-serif; }

.quick-start { margin: 30px 0; }
.quick-start h3 { margin-bottom: 15px; color: #2c3e50; }
.quick-start-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.category-btn { background: white; border: 2px solid #ddd; padding: 20px; border-radius: 8px; cursor: pointer; transition: all 0.3s; text-align: center; font-size: 16px; font-weight: 500; color: #2c3e50; }
.category-btn:hover { border-color: #3498db; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.category-icon { display: block; font-size: 32px; margin-bottom: 8px; }

.client-selection { margin: 30px 0; }
.client-selection h3 { margin-bottom: 15px; color: #2c3e50; }
.search-wrapper { margin-bottom: 15px; }
.timer-clients-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; max-height: 400px; overflow-y: auto; }
.timer-client-card { background: white; padding: 15px; border-radius: 6px; cursor: pointer; transition: all 0.3s; border: 2px solid #ecf0f1; }
.timer-client-card:hover { border-color: #3498db; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.1); }
.timer-client-name { font-weight: bold; color: #2c3e50; margin-bottom: 4px; }
.timer-client-company { font-size: 14px; color: #7f8c8d; }

.time-entries { margin: 30px 0; }
.time-entries h3 { margin-bottom: 15px; color: #2c3e50; }
.time-entry { background: white; padding: 15px; border-radius: 6px; margin-bottom: 10px; border-left: 4px solid #3498db; }
.time-entry-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; flex-wrap: wrap; gap: 10px; }
.time-entry-label { display: flex; align-items: center; gap: 10px; }
.time-entry-category { padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: bold; color: white; text-transform: uppercase; }
.time-entry-times { color: #7f8c8d; font-size: 14px; margin-bottom: 5px; }
.time-entry-duration { font-weight: bold; color: #27ae60; }
.time-entry-notes { color: #555; font-size: 14px; font-style: italic; padding: 8px; background: #f8f9fa; border-radius: 4px; margin-top: 8px; }
.btn-small { padding: 6px 12px; font-size: 12px; }

@media (max-width: 768px) {
  .timer-clock { font-size: 48px; }
  .quick-start-grid { grid-template-columns: repeat(2, 1fr); }
  .timer-clients-grid { grid-template-columns: 1fr; }
  .timer-controls { flex-direction: column; }
  .timer-controls button { width: 100%; }
}
