@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap");

body {
  font-family: "Roboto", sans-serif;
  margin: 20px;
  background: linear-gradient(135deg, #f5f7fa, #c3cfe2);
  color: #333;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.5s ease;
}

h1,
h2 {
  text-align: center;
  font-weight: 700;
  color: #004085;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

form {
  margin-bottom: 20px;
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  transition: box-shadow 0.3s ease;
}

form:hover {
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

form label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #333;
}

form input,
form select {
  padding: 10px;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #bbb;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

form input:focus,
form select:focus {
  border-color: #007bff;
  outline: none;
  box-shadow: 0 0 8px rgba(0, 123, 255, 0.5);
}

form button {
  padding: 12px 20px;
  margin-right: 10px;
  cursor: pointer;
  border-radius: 6px;
  font-weight: 700;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

form button:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background-color: #007bff;
  color: white;
  border: none;
}

.btn-primary:hover {
  background-color: #0056b3;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
  border: none;
}

.btn-secondary:hover {
  background-color: #565e64;
}

.form-actions {
  display: flex;
  gap: 1rem;
}

.hidden {
  display: none;
}

.table-responsive {
  overflow-x: auto;
  width: 100%;
  padding: 0 1rem;
  box-sizing: border-box;
}

.table {
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease;
  table-layout: auto;
  max-width: 100%;
  width: 100%;
  margin: 0;
}

.table:hover {
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.table thead {
  background-color: #007bff;
  color: white;
  border-radius: 10px 10px 0 0;
}

.table th,
.table td {
  text-align: center;
  padding: 0.75rem 1.25rem;
  border: 1px solid #ccc;
  vertical-align: middle;
  word-break: break-word;
}

.table tbody tr:nth-child(even) {
  background-color: #f9f9f9;
  transition: background-color 0.3s ease;
}

.table tbody tr:hover {
  background-color: #d0e7ff;
  cursor: pointer;
}

.table tbody tr {
  transition: background-color 0.3s ease;
}

button.action-btn {
  padding: 8px 14px;
  margin: 0 4px;
  cursor: pointer;
  border-radius: 6px;
  font-weight: 600;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  font-size: 1.1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button.action-btn:hover {
  transform: translateY(-2px);
  background-color: #0056b3;
  color: white;
}

button.edit-btn {
  background-color: #28a745;
  color: white;
}

button.edit-btn:hover {
  background-color: #1e7e34;
}

button.delete-btn {
  background-color: #dc3545;
  color: white;
}

button.delete-btn:hover {
  background-color: #bd2130;
  color: white;
}

/* New styles for smaller circular icon buttons */
button.icon-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 1.2rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: background-color 0.3s ease, transform 0.2s ease;
  margin: 0 3px;
}

button.icon-btn:hover {
  transform: translateY(-2px);
  color: white;
}

button.icon-btn.edit-btn {
  background-color: #28a745;
  color: white;
}

button.icon-btn.edit-btn:hover {
  background-color: #1e7e34;
  color: white;
}

button.icon-btn.delete-btn {
  background-color: #dc3545;
  color: white;
}

button.icon-btn.delete-btn:hover {
  background-color: #bd2130;
  color: white;
}

/* Table improvements */
.table th,
.table td {
  text-align: center;
  padding: 0.75rem 1.25rem;
  border: 1px solid #ccc;
  vertical-align: middle;
}

.table tbody tr:hover {
  background-color: #d0e7ff;
  cursor: pointer;
}

.table tbody tr {
  transition: background-color 0.3s ease;
}

#plan-cancel-btn {
  background-color: #ccc;
  border-radius: 6px;
  font-weight: 600;
  transition: background-color 0.3s ease;
}

#plan-cancel-btn:hover {
  background-color: #999;
}

/* Reset and base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Header */
.header {
  background-color: #007bff;
  color: white;
  padding: 0.5rem 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: background-color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 1rem;
}

.header-buttons {
  width: 50%;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

#log-btn {
  background-color: #6c757d;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.4);
  transition: background-color 0.3s ease, transform 0.2s ease;
}

#log-btn:hover,
#log-btn:focus {
  background-color: #0056b3;
  outline: none;
  transform: translateY(-2px);
}

#create-sip-btn,
#yearly-report-btn {
  background-color: #6c757d;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(108, 117, 125, 0.4);
  transition: background-color 0.3s ease, transform 0.2s ease;
}

#create-sip-btn:hover,
#create-sip-btn:focus {
  background-color: #565e64;
  outline: none;
  transform: translateY(-2px);
}

.logo {
  font-weight: 900;
  font-size: 2rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
  margin: 0;
  flex: 1 1 100%;
  text-align: center;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  margin-top: 0.5rem;
}

.welcome-text {
  font-weight: 600;
  font-size: 1rem;
  color: white;
}

.logout-form {
  margin: 0;
}

.logout-btn {
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  border-radius: 6px;
  font-weight: 700;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.logout-btn:hover {
  background-color: #0056b3;
  transform: translateY(-2px);
}

/* Forms inside cards: two column layout */
.form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.form-group {
  flex: 1 1 calc(50% - 1rem);
  display: flex;
  flex-direction: column;
}

/* Make form-actions full width and aligned right */
.form-actions {
  flex: 1 1 100%;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

/* Tables: full width inside card */
.table-responsive {
  overflow-x: auto;
  width: 100%;
  padding: 0 1rem;
  box-sizing: border-box;
}

.table {
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease;
  table-layout: auto;
  max-width: 100%;
  width: 100%;
  margin: 0;
}

/* Card width and centering */
.card {
  max-width: 80%;
  margin-left: auto;
  margin-right: auto;
  padding: 2rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.3s ease;
}

/* Responsive adjustments */
@media (max-width: 992px) {
  main {
    flex-direction: column;
    padding: 0px;
  }

  .card {
    max-width: 100%;
    flex: 1 1 100%;
    padding: 1.5rem;
  }

  .form-group {
    flex: 1 1 100%;
  }

  .header-container {
    flex-direction: column;
    align-items: center;
  }

  .header-buttons {
    justify-content: center;
    margin-top: 0.5rem;
  }

  .user-info {
    justify-content: center;
    margin-top: 0.5rem;
  }
}

@media (max-width: 576px) {
  body {
    margin: 10px;
  }

  h1,
  h2 {
    font-size: 1.5rem;
  }

  .btn-primary,
  .btn-secondary,
  #log-btn,
  #create-sip-btn {
    padding: 0.4rem 0.8rem;
  }

  .form {
    padding: 15px 10px;
  }

  .form-group {
    flex: 1 1 100%;
  }

  .table th,
  .table td {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }

  .logo {
    font-size: 1.5rem;
  }

  .user-info {
    flex-direction: column;
    gap: 0.25rem;
  }

  .logout-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
  }

  /* Added for horizontal scroll on tables in mobile view */
  .table-responsive {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Force minimum width on tables inside .table-responsive to enable horizontal scroll */
  .table-responsive .table {
    min-width: 700px;
  }
}
