/* Dashboard Styles */
/* Mobile-first responsive design */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #f5f5f5;
  color: #333;
}

.cms-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar Navigation */
.cms-sidebar {
  width: 100%;
  max-width: 280px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  overflow-y: auto;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
  margin-bottom: 30px;
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-header h2 {
  font-size: 20px;
  margin-bottom: 4px;
}

.last-saved {
  font-size: 12px;
  opacity: 0.8;
}

.tab-list {
  list-style: none;
  margin-bottom: 30px;
}

.tab-list li {
  margin-bottom: 8px;
}

.tab-link {
  display: block;
  padding: 10px 12px;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  transition: background-color 0.3s;
  font-size: 14px;
  font-weight: 500;
}

.tab-link:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.tab-link.active {
  background-color: rgba(255, 255, 255, 0.3);
  border-left: 3px solid white;
  padding-left: 9px;
}

.sidebar-footer {
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-logout {
  width: 100%;
  padding: 10px 12px;
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.3s;
}

.btn-logout:hover {
  background-color: rgba(255, 255, 255, 0.3);
}

/* Main Content Area */
.cms-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tab-panel {
  flex: 1;
  overflow-y: auto;
  padding: 40px;
  display: none;
  animation: fadeIn 0.3s;
}

.tab-panel.active,
.tab-panel:first-of-type {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.tab-panel h1 {
  margin-bottom: 30px;
  color: #333;
  font-size: 28px;
}

/* Form Styles */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  max-width: 900px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 600;
  margin-bottom: 8px;
  color: #333;
  font-size: 14px;
}

.form-group input,
.form-group textarea {
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Containers for list items */
.services-container,
.expertise-container,
.testimonials-container,
.gallery-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.service-item,
.expertise-item,
.testimonial-item,
.gallery-item {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.service-item h3,
.expertise-item h3,
.testimonial-item h3 {
  margin-bottom: 12px;
  font-size: 16px;
  color: #333;
}

.service-item input,
.expertise-item input,
.testimonial-item input,
.gallery-item input,
.service-item textarea,
.expertise-item textarea,
.testimonial-item textarea {
  width: 100%;
  margin-bottom: 12px;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
}

.gallery-item img {
  margin-bottom: 12px;
  border-radius: 4px;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 12px;
  padding: 20px 40px;
  background: white;
  border-top: 1px solid #ddd;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.btn-primary,
.btn-secondary,
.btn-success {
  padding: 12px 24px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #f0f0f0;
  color: #333;
}

.btn-secondary:hover:not(:disabled) {
  background: #e0e0e0;
}

.btn-success {
  background: #48bb78;
  color: white;
}

.btn-success:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(72, 187, 120, 0.4);
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-success:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 16px 24px;
  background: #333;
  color: white;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  max-width: 400px;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  pointer-events: auto;
}

.toast.success {
  background: #48bb78;
}

.toast.error {
  background: #f56565;
}

.toast.info {
  background: #4299e1;
}

/* Confirm Dialog */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  text-align: center;
}

.modal-content p {
  margin-bottom: 30px;
  white-space: pre-wrap;
  color: #333;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary {
  flex: 1;
}

/* Preview Panel */
.preview-panel {
  background: white;
  padding: 30px;
  border-radius: 8px;
  max-width: 600px;
}

.preview-panel h2 {
  margin-bottom: 20px;
  font-size: 22px;
}

.preview-panel h3 {
  margin-bottom: 16px;
  font-size: 18px;
  color: #333;
}

.preview-panel ol {
  margin-bottom: 20px;
  padding-left: 20px;
}

.preview-panel li {
  margin-bottom: 12px;
  line-height: 1.6;
}

.preview-panel p {
  margin: 12px 0;
  color: #666;
}

/* Backups Table */
.backups-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.backups-table thead {
  background-color: #f5f5f5;
}

.backups-table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid #ddd;
  color: #333;
  font-size: 14px;
}

.backups-table td {
  padding: 12px;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}

.backups-table tbody tr:hover {
  background-color: #fafafa;
}

.btn-rollback {
  padding: 6px 12px;
  background-color: #4299e1;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background-color 0.3s;
}

.btn-rollback:hover:not(:disabled) {
  background-color: #3182ce;
}

.btn-rollback:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* File Upload Styles */
.upload-group {
  margin-bottom: 16px;
}

.upload-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.btn-upload {
  padding: 10px 16px;
  background-color: #667eea;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.3s;
  white-space: nowrap;
}

.btn-upload:hover:not(:disabled) {
  background-color: #764ba2;
}

.btn-upload:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.upload-status {
  font-size: 13px;
  font-weight: 500;
  margin-left: 8px;
  min-height: 20px;
  display: block;
}

.upload-group small {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: #666;
}

.upload-group small a {
  color: #667eea;
  text-decoration: none;
  word-break: break-all;
}

.upload-group small a:hover {
  text-decoration: underline;
}

.add-gallery-section {
  border-top: 1px solid #ddd;
  padding-top: 20px;
  margin-top: 20px;
}

.add-gallery-section h3 {
  margin-bottom: 16px;
  font-size: 16px;
  color: #333;
}

/* Responsive Design */
@media (max-width: 768px) {
  .cms-container {
    flex-direction: column;
  }

  .cms-sidebar {
    max-width: 100%;
    width: 100%;
    height: auto;
    max-height: 200px;
    overflow-x: auto;
    padding: 12px;
  }

  .sidebar-header {
    margin-bottom: 12px;
    padding-bottom: 12px;
  }

  .tab-list {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    overflow-x: auto;
  }

  .tab-list li {
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .tab-link {
    padding: 8px 10px;
    font-size: 12px;
  }

  .cms-main {
    max-height: calc(100vh - 200px);
  }

  .tab-panel {
    padding: 20px;
  }

  .tab-panel h1 {
    font-size: 20px;
    margin-bottom: 20px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .services-container,
  .expertise-container,
  .testimonials-container,
  .gallery-container {
    grid-template-columns: 1fr;
  }

  .action-buttons {
    flex-wrap: wrap;
    padding: 12px 20px;
  }

  .btn-primary,
  .btn-secondary,
  .btn-success {
    flex: 1;
    min-width: 100px;
    padding: 10px 12px;
    font-size: 13px;
  }

  .toast {
    bottom: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

/* Very small screens */
@media (max-width: 375px) {
  .cms-sidebar {
    max-height: 120px;
    padding: 8px;
  }

  .sidebar-header {
    margin-bottom: 8px;
    padding-bottom: 8px;
  }

  .sidebar-header h2 {
    font-size: 16px;
  }

  .tab-link {
    padding: 6px 8px;
    font-size: 11px;
  }

  .tab-panel {
    padding: 12px;
  }

  .tab-panel h1 {
    font-size: 18px;
    margin-bottom: 16px;
  }

  .action-buttons {
    flex-direction: column;
    gap: 8px;
  }

  .btn-primary,
  .btn-secondary,
  .btn-success {
    width: 100%;
  }
}
