/* Base Reset */
* {
  box-sizing: border-box;
}
html, body {
  margin: 0;
  padding: 0;
  font-family: sans-serif;
  background-color: #f8f8f8;
  color: #333;
}

/* Header */
header {
  width: 100%;
  background-color: #004080;
  color: white;
  padding: 1em;
  border-bottom: 1px solid #003366;
}
.header-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1em;
}
.header-left,
.header-center,
.header-right {
  flex: 1 1 100%;
  text-align: center;
}
.header-center h2 {
  margin: 0;
  font-size: 2.4em;
}
.logo-title {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2em;
}
.logo-left,
.logo-right {
  height: 50px;
}

/* Header Buttons */
header button {
  background-color: #004080;
  color: white;
  border: 1px solid #003366;
  padding: 0.5em 1em;
  font-size: 1.4em;
  cursor: pointer;
}
header button:hover {
  background-color: #003366;
}

/* Forms */
.login-form,
.topic-form {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5em;
}
.login-form input,
.topic-form select {
  padding: 0.5em;
  font-size: 1em;
}
.login-form button {
  background-color: #004080;
  color: white;
  border: none;
  padding: 0.5em 1em;
  cursor: pointer;
}
.login-form button:hover {
  background-color: #003366;
}
.error {
  color: red;
  font-weight: bold;
  margin-top: 0.5em;
}

/* Layout */
.container {
  display: flex;
  flex-direction: row;
  min-height: calc(100vh - 100px);
}

/* Sidebar */
.sidebar {
  width: 250px;
  background-color: #fff;
  border-right: 1px solid #ccc;
  padding: 1em;
  overflow-y: auto;
}
.sidebar h3 {
  margin-top: 0;
}
.sidebar table {
  width: 100%;
  border-collapse: collapse;
}
.sidebar td {
  padding: 0.5em;
  border-bottom: 1px solid #eee;
}
.sidebar a {
  color: #004080;
  text-decoration: none;
}
.sidebar a:hover {
  text-decoration: underline;
}

/* Main Panel */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.subpage {
  flex: 1;
  background-color: #f0f0f0;
  padding: 1em;
  overflow-y: auto;
}

/* Login Box */
.login-box {
  background-color: #004080;
  color: white;
  padding: 2em;
  border-radius: 8px;
  max-width: 500px;
  margin: 10vh auto;
  text-align: center;
  box-shadow: 0 0 10px rgba(0,0,0,0.2);
}
.login-box h2 {
  margin-bottom: 1em;
  font-size: 2.4em;
}
.login-box input {
  width: 100%;
  padding: 0.8em;
  margin: 0.6em 0;
  font-size: 1.2em;
  border: none;
  border-radius: 4px;
}
.login-box button {
  background-color: white;
  color: #004080;
  border: none;
  padding: 0.8em 1.6em;
  font-size: 1.2em;
  cursor: pointer;
  border-radius: 4px;
  margin-top: 1em;
}
.login-box button:hover {
  background-color: #e0e0e0;
}
.login-box .error {
  background-color: #660000;
  color: #ffdddd;
  padding: 0.6em;
  margin-top: 1em;
  border-radius: 4px;
}

/* Responsive Layout */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #ccc;
    order: 2;
  }
  .main {
    width: 100%;
    order: 1;
  }
  .header-left,
  .header-center,
  .header-right {
    flex: 1 1 100%;
    text-align: center;
  }
  .logo-title {
    flex-direction: column;
  }
  .login-form,
  .topic-form {
    flex-direction: column;
    align-items: center;
  }
  .login-form input,
  .login-form button,
  .topic-form select {
    width: 100%;
    margin: 0.3em 0;
  }
}