/* ========== Base & Reset ========== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Open Sans', sans-serif;
  background-color: #fefefe;
  color: #333;
  line-height: 1.6;
}

/* ========== Header & Navigation ========== */
header {
  background-color: #f8f9fa;
  border-bottom: 1px solid #ddd;
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1em;
  max-width: 1000px;
  margin: 0 auto;
  position: relative;
}

.logo img {
  height: 80px;
  max-width: 100%;
}

/* Hamburger menu toggle */
.menu-toggle {
  display: none;
}

.hamburger {
  display: none;
  font-size: 2rem;
  cursor: pointer;
  color: #007BFF;
  padding: 0.2em;
  user-select: none;
}

/* Nav links */
.nav-tabs {
  display: flex;
  gap: 1em;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-tab a {
  text-decoration: none;
  color: #007BFF;
  font-weight: 600;
  padding-bottom: 0.25em;
  transition: border-color 0.2s ease;
}

.nav-tab.active a,
.nav-tab a:hover {
  border-bottom: 2px solid #007BFF;
}

/* ========== Main Content ========== */
main {
  padding: 2em 1em;
  max-width: 1000px;
  margin: auto;
}

h1,
h2,
h3 {
  margin-top: 1em;
  margin-bottom: 0.5em;
}

h1 {
  font-size: 1.8rem;
}

h2 {
  font-size: 1.4rem;
}

h3 {
  font-size: 1.1rem;
  margin-top: 1.5em;
}

/* ========== Tables ========== */
.subscriptions-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  background-color: #fff;
}

.subscriptions-table th,
.subscriptions-table td {
  border: 1px solid #ccc;
  padding: 0.75em;
  text-align: left;
  vertical-align: top;
}

.subscriptions-table th {
  background-color: #f0f0f0;
}

/* ========== Forms ========== */
form {
  margin-top: 1em;
}

label {
  display: block;
  margin: 0.5em 0 0.2em;
  font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="number"],
select {
  width: 100%;
  max-width: 300px;
  padding: 0.5em;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-bottom: 1em;
}

button {
  padding: 0.6em 1.2em;
  color: white;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease;
  background-color: #345170;
}

button:hover {
  background-color: #20354b;
}

button.primary {
  background-color: #007BFF;
}

button.primary:hover {
  background-color: #0056b3;
}

button.disabled {
  background-color: #7e7e80;
}

li {
  margin-left: 1em;
}

/* ========== Messages & Utility ========== */
.warning {
  color: #d9cb4f;
  font-weight: bold;
  margin-top: 1em;
}

#login-message {
  margin-top: 1em;
  font-style: italic;
  color: #28a745;
}

.code-string {
  font-family: monospace;
  background-color: #f4f4f4;
  padding: 0.2em 0.4em;
  border-radius: 4px;
}

.hidden {
  display: none !important;
}

.tab-content {
  display: none;
  margin-top: 2em;
}

.tab-content.active {
  display: block;
}

.tab-content input,
.tab-content select,
.tab-content button {
  display: inline-block;
  margin-right: 0.5em;
}

.de-emphasised {
  color: gray;
  font-size: 80%;
}

.map-icon {
  margin: 0.2em;
}

.loading-spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 2s linear infinite;
  padding: 0;
  font-size: 1%;
}

.loading-spinner::before {
  content: "⏳";
  animation: spin 1s linear infinite;
  font-size: 10000%;
}

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

textarea {
  width: 100%;
}

/* ========== Footer ========== */
footer {
  text-align: center;
  padding: 1em;
  background-color: #f8f9fa;
  border-top: 1px solid #ddd;
  margin-top: 2em;
}

footer p {
  margin: 0.25em 0;
}

/* ========== Responsive Navigation ========== */
@media (max-width: 768px) {
  .hamburger {
    display: block;
  }

  .nav-tabs {
    display: none;
    flex-direction: column;
    background-color: #f8f9fa;
    width: 100%;
    padding: 1em 0;
    position: absolute;
    top: 100%;
    left: 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }

  .menu-toggle:checked+.hamburger+nav .nav-tabs {
    display: flex;
  }

  .nav-tab {
    margin: 0.5em 1em;
  }
}

/* ========== Hero Section (About Page) ========== */
#about-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero img {
  width: 100%;
  max-width: 900px;
  height: auto;
  border-radius: 10px;
  margin-bottom: 2em;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.about-content {
  max-width: 700px;
}

/* Add some additional styles for the calendar */
#calendar-container {
  margin-top: 2em;
}

/* ========== Billing Styles ========== */

.bill-amount {
  font-size: 2em;
  font-weight: bold;
  color: #007bff;
}

.error {
  color: #dc3545;
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  padding: 10px;
  border-radius: 5px;
}

#estimated-bill {
  text-align: center;
  padding: 20px;
  background-color: #e9ecef;
  border-radius: 5px;
  margin: 15px 0;
}

/* ========== Error Dialog ========== */

.error-dialog {
  border: none;
  border-radius: 12px;
  padding: 0;
  max-width: 500px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(4px);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

.error-dialog-content {
  position: relative;
}

.error-dialog-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  padding: 5px;
  line-height: 1;
}

.error-dialog-close:hover {
  color: #333;
}

@media (max-width: 768px) {
  .usage-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .bill-amount {
    font-size: 1.5em;
  }
  
  .error-dialog {
    max-width: 90vw;
    margin: 20px;
  }
}
