/* Meter Reading System - Pink Themed Stylesheet */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background: linear-gradient(135deg, var(--background-gradient-start) 0%, var(--background-gradient-end) 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header Styles - Pink Theme */
.header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 1rem 0;
  box-shadow: 0 2px 8px rgba(233, 30, 99, 0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.logo-container {
  flex: 1;
}

.logo {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.logo-subtitle {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--subtitle-color);
}

/* Mobile Menu Toggle Button */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 101;
}

.menu-toggle span {
  width: 100%;
  height: 3px;
  background-color: white;
  border-radius: 3px;
  transition: all 0.3s;
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 6px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -7px);
}

.nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  color: white;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background-color 0.3s;
  white-space: nowrap;
}

.nav-link:hover {
  background-color: var(--hover-overlay);
}

.user-info {
  color: var(--subtitle-color);
  font-size: 0.9rem;
  white-space: nowrap;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 2rem 0;
}

/* Dashboard Styles */
.dashboard {
  background-color: var(--card-background);
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 2px 4px rgba(233, 30, 99, 0.1);
}

.dashboard-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 3px solid var(--border-color);
}

.dashboard-header h2 {
  color: var(--primary-color);
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Card Styles */
.card {
  background-color: var(--card-background);
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 2px 4px rgba(233, 30, 99, 0.1);
  margin-bottom: 2rem;
  border-left: 4px solid var(--secondary-color);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-color);
}

.card-title {
  font-size: 1.5rem;
  color: var(--primary-color);
  font-weight: 600;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--primary-color);
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

.form-control:focus {
  outline: none;
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}

/* Meter Reading Input Container */
.meter-reading-container {
  margin: 2rem 0;
}

.meter-reading-label {
  display: block;
  margin-bottom: 1rem;
  font-size: 1.2rem;
  font-weight: 600;
  color: #c2185b;
  text-align: center;
}

.meter-reading-boxes {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  direction: rtl;
  margin-bottom: 1rem;
}

.meter-box {
  width: 60px;
  height: 80px;
  border: 3px solid var(--secondary-color);
  border-radius: 8px;
  font-size: 2rem;
  text-align: center;
  font-weight: bold;
  color: var(--primary-color);
  background-color: var(--card-background);
  transition: all 0.3s;
}

.meter-box:focus {
  outline: none;
  border-color: var(--primary-dark);
  background-color: var(--table-header);
  box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.2);
}

.meter-box.filled {
  background-color: var(--border-color);
  border-color: var(--primary-color);
}

.meter-reading-help {
  text-align: center;
  color: #666;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* Button Styles */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.3s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  box-shadow: 0 4px 8px rgba(233, 30, 99, 0.3);
}

.btn-secondary {
  background-color: var(--border-color);
  color: var(--primary-color);
}

.btn-secondary:hover {
  background-color: var(--table-header);
}

.btn-block {
  display: block;
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Alert Styles */
.alert {
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1.5rem;
  border-left: 4px solid;
}

.alert-error {
  background-color: #ffebee;
  color: #c62828;
  border-left-color: #c62828;
}

.alert-success {
  background-color: #e8f5e9;
  color: #2e7d32;
  border-left-color: #2e7d32;
}

.alert-info {
  background-color: var(--alert-info-bg);
  color: var(--alert-info-text);
  border-left-color: var(--secondary-color);
}

.alert-warning {
  background-color: var(--alert-warning-bg);
  color: var(--alert-warning-text);
  border-left-color: var(--accent-color);
}

/* Login Container */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 200px);
  padding: 2rem 0;
}

.login-box {
  background-color: var(--card-background);
  border-radius: 8px;
  padding: 2.5rem;
  box-shadow: 0 4px 12px rgba(233, 30, 99, 0.2);
  width: 100%;
  max-width: 450px;
  border-top: 4px solid var(--login-border-top);
}

.login-box h2 {
  color: var(--primary-color);
  text-align: center;
  margin-bottom: 2rem;
  font-size: 2rem;
}

/* Location Selection */
.location-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1.5rem 0;
}

.location-option {
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  background-color: var(--card-background);
}

.location-option:hover {
  border-color: var(--secondary-color);
  background-color: var(--border-color-light);
}

.location-option.selected {
  border-color: var(--secondary-color);
  background-color: var(--border-color);
  font-weight: 600;
}

/* Footer */
.footer {
  background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
  color: white;
  text-align: center;
  padding: 1.5rem 0;
  margin-top: auto;
}

/* Modal/Dialog Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal {
  background-color: white;
  border-radius: 8px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 4px 20px rgba(233, 30, 99, 0.3);
  border-top: 4px solid #e91e63;
}

.modal-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #f8bbd0;
}

.modal-title {
  font-size: 1.5rem;
  color: #c2185b;
  font-weight: 600;
}

.modal-body {
  margin-bottom: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

/* Table Styles */
.table-container {
  overflow-x: auto;
  margin: 2rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--card-background);
  border-radius: 8px;
  overflow: hidden;
}

th {
  background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
  color: white;
  padding: 1rem;
  text-align: left;
  font-weight: 600;
}

td {
  padding: 1rem;
  border-bottom: 1px solid var(--table-border);
}

tr:hover {
  background-color: var(--table-header);
}

/* Responsive Design */
@media (max-width: 992px) {
  .container {
    padding: 0 15px;
  }

  .card {
    padding: 1.5rem;
  }

  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    font-size: 0.9rem;
  }

  th, td {
    padding: 0.75rem;
  }
}

@media (max-width: 768px) {
  /* Mobile Menu Styles */
  .menu-toggle {
    display: flex;
  }

  .nav {
    position: fixed;
    top: 72px;
    right: -100%;
    width: 280px;
    height: calc(100vh - 72px);
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 1.5rem 0;
    box-shadow: -4px 0 10px rgba(0, 0, 0, 0.2);
    transition: right 0.3s ease-in-out;
    overflow-y: auto;
  }

  .nav.active {
    right: 0;
  }

  .nav-link {
    width: 100%;
    padding: 1rem 1.5rem;
    border-radius: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15);
  }

  .user-info {
    width: 100%;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-weight: 500;
  }

  .logo {
    font-size: 1.25rem;
  }

  .logo-subtitle {
    font-size: 0.75rem;
  }

  /* Mobile optimized form elements */
  .meter-reading-boxes {
    gap: 0.3rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
  }

  .meter-box {
    width: 38px;
    height: 52px;
    font-size: 1.3rem;
    flex-shrink: 0;
  }

  .login-box {
    padding: 1.5rem;
    margin: 1rem;
  }

  .card {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .btn {
    padding: 0.65rem 1.25rem;
    font-size: 0.95rem;
  }

  .form-control {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  /* Mobile table improvements */
  table {
    font-size: 0.85rem;
  }

  th, td {
    padding: 0.5rem;
  }

  th {
    position: sticky;
    top: 0;
    z-index: 10;
  }

  /* Dashboard improvements */
  .dashboard {
    padding: 1rem;
  }

  .dashboard-header h2 {
    font-size: 1.5rem;
  }

  /* Better touch targets */
  a, button, input[type="submit"], .btn {
    min-height: 44px;
    min-width: 44px;
  }
}

@media (max-width: 480px) {
  .meter-box {
    width: 35px;
    height: 48px;
    font-size: 1.15rem;
  }

  .meter-reading-boxes {
    gap: 0.15rem;
  }

  .login-box {
    padding: 1rem;
  }

  .card {
    padding: 0.75rem;
  }

  .logo {
    font-size: 1.1rem;
  }

  .logo-subtitle {
    font-size: 0.7rem;
  }

  table {
    font-size: 0.8rem;
  }

  th, td {
    padding: 0.4rem;
  }

  .btn {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.text-muted {
  color: #999;
}

.mt-2 {
  margin-top: 1rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.hidden {
  display: none;
}

/* App Update Overlay */
.app-update-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(236, 72, 153, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.app-update-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.app-update-content {
  text-align: center;
  color: white;
  padding: 2rem;
}

.app-update-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  animation: pulse 1.5s ease-in-out infinite;
}

.app-update-title {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.app-update-message {
  font-size: 1.1rem;
  color: #fce7f3;
  margin-bottom: 1.5rem;
}

.app-update-spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* PWA Install Banner */
.pwa-install-banner {
  background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4);
  position: sticky;
  top: 0;
  z-index: 999;
  animation: slideDown 0.3s ease-out;
}

.pwa-install-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  flex-wrap: wrap;
}

.pwa-install-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.pwa-install-text {
  flex: 1;
  min-width: 200px;
}

.pwa-install-text strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.pwa-install-text p {
  font-size: 0.875rem;
  color: #fce7f3;
  margin: 0;
}

.pwa-install-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.pwa-install-btn {
  background: white;
  color: #ec4899;
  border: none;
  padding: 0.5rem 1.5rem;
  border-radius: 0.375rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pwa-install-btn:hover {
  background: #fce7f3;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.pwa-install-btn:active {
  transform: translateY(0);
}

.pwa-dismiss-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.pwa-dismiss-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Responsive Design for Install Banner */
@media (max-width: 768px) {
  .pwa-install-content {
    gap: 0.75rem;
  }

  .pwa-install-icon {
    font-size: 1.5rem;
  }

  .pwa-install-text strong {
    font-size: 0.9rem;
  }

  .pwa-install-text p {
    font-size: 0.8rem;
  }

  .pwa-install-btn {
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
  }

  .pwa-dismiss-btn {
    width: 28px;
    height: 28px;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .pwa-install-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .pwa-install-actions {
    width: 100%;
    justify-content: space-between;
  }

  .pwa-install-btn {
    flex: 1;
  }
}
