/* Basic Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Base font and colors */
body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  background-color: #f4f4f4;
  color: #212529;
  padding: 20px;
  max-width: 900px;
  margin: auto;
}

/* Container */
.container {
  width: 90%;
  max-width: 900px;
  margin: 0 auto;
}

/* Links */
a {
  color: #003366;
  text-decoration: none;
  transition: color 0.2s ease-in-out;
}
a:hover,
a:focus {
  color: #0055a5;
  text-decoration: underline;
  outline: none;
}

/* Header */
header {
  background-color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  padding: 30px 20px;
  border-bottom: 1px solid #e5e5e5;
  margin-bottom: 40px;
  position: sticky;
  top: 0;
  z-index: 100;
}

header .container {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

header .title-block {
  flex-grow: 1;
}

header h1 {
  font-weight: 800;
  font-size: 3rem;
  color: #003366;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  letter-spacing: 1px;
  line-height: 1.1;
}

header p {
  font-weight: 400;
  font-size: 1.2rem;
  color: #6c757d;
  margin-top: 4px;
}

/* User block (login/logout) */
header .user-block {
  font-size: 0.9rem;
  color: #4d4d4d;
  white-space: nowrap;
}

header .user-block a {
  color: #003366;
  text-decoration: none;
  margin-left: 10px;
  font-weight: 600;
}
header .user-block a:hover,
header .user-block a:focus {
  color: #0055a5;
  text-decoration: underline;
  outline: none;
}

/* Botões padronizados (Reply, Edit, Delete, Save) */
.btn,
button,
input[type="submit"] {
  display: inline-block;
  background-color: #003366;
  color: #fff;
  padding: 8px 16px;
  font-size: 0.95rem;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  text-align: center;
  transition: background-color 0.3s ease;
  text-decoration: none;
  margin-right: 5px;
  margin-top: 5px;
}

.btn:hover,
button:hover,
input[type="submit"]:hover,
.btn:focus,
button:focus,
input[type="submit"]:focus {
  background-color: #0055a5;
  color: #fff;
  outline: none;
}

/* Botões principais (Submit Comment, Back to Home) */
button.submit-btn,
button.back-btn,
input[type="submit"].submit-btn {
  display: inline-block;
  background-color: #003366;
  color: #fff;
  padding: 10px 20px; /* tamanho maior que os Reply/Edit/Delete */
  font-size: 1rem;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  text-align: center;
  transition: background-color 0.3s ease;
  text-decoration: none;
  margin-right: 5px;
  margin-top: 5px;
}

button.submit-btn:hover,
button.back-btn:hover,
input[type="submit"].submit-btn:hover,
button.submit-btn:focus,
button.back-btn:focus,
input[type="submit"].submit-btn:focus {
  background-color: #0055a5;
  color: #fff;
  outline: none;
}

/* Posts and post-card */
.post,
.post-card {
  background: #fff;
  border: 1px solid #dee2e6;
  padding: 20px;
  border-radius: 0.375rem;
  margin-bottom: 25px;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  transition: box-shadow 0.2s ease-in-out;
}
.post:hover,
.post-card:hover {
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

.post h2,
.post-card h2 {
  margin-bottom: 12px;
  font-size: 1.75rem;
  color: #003366;
}
.post p,
.post-card p {
  margin-bottom: 18px;
  color: #495057;
  font-size: 1.1rem;
  line-height: 1.5;
}

/* Ajuste para evitar vazamento de texto */
.post-card p {
  margin-bottom: 10px;
  font-size: 1rem;
  color: #212529;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}

.post small,
.post-card small {
  display: block;
  margin-bottom: 15px;
  color: #6c757d;
  font-size: 0.9rem;
}

/* Comment actions and reply form */
.comment-actions {
  display: flex;
  gap: 8px; /* Espaço entre os botões */
  margin-bottom: 5px; /* Espaço abaixo dos botões */
}

.reply-btn {
  display: inline-block;
  font-size: 0.95rem;
  padding: 8px 16px;
  background-color: #003366; /* mesma cor do btn */
  color: #fff;
  border-radius: 0.25rem;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.reply-btn:hover {
  background-color: #0055a5;
  color: #fff;
}

.reply-form {
  margin-top: 15px;
  margin-left: 0;
  display: none;
}

.reply-form textarea {
  margin-bottom: 10px;
  width: 100%;
  padding: 10px;
  border-radius: 0.25rem;
  border: 1px solid #ced4da;
  font-size: 1rem;
}

.reply-form button {
  padding: 8px 16px;
  font-size: 0.95rem;
  background-color: #003366;
  color: #fff;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.reply-form button:hover {
  background-color: #0055a5;
  color: #fff;
}

/* Forms gerais */
input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  font-size: 1rem;
  margin-bottom: 20px;
  resize: vertical;
  transition: border-color 0.3s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus {
  border-color: #003366;
  outline: none;
}

/* Edit history box */
pre {
  background: #eee;
  padding: 15px;
  border-radius: 0.375rem;
  font-family: monospace;
  line-height: 1.5;
  margin: 15px 0;
  white-space: pre-wrap;
  color: #333;
}

/* Posts by Month/Year box */
.posts-by-month-year-box {
  background: #fff;
  border: 1px solid #dee2e6;
  padding: 15px 20px;
  border-radius: 0.375rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
}

.posts-by-month-year-box h3 {
  margin-bottom: 15px;
  color: #003366;
  font-weight: 700;
}

.posts-by-month-year-box ul {
  list-style: none;
  padding-left: 0;
}

.posts-by-month-year-box li {
  padding: 6px 0;
  font-size: 1rem;
  color: #333;
}

/* Responsive */
@media (max-width: 768px) {
  body,
  .container {
    padding: 15px;
    max-width: 100%;
  }

  header {
    padding: 20px 15px;
    margin-bottom: 30px;
  }

  header h1 {
    font-size: 2.2rem;
  }

  header p {
    font-size: 1rem;
  }

  header .container {
    flex-direction: column;
    gap: 10px;
  }

  header .user-block {
    margin-top: 10px;
    white-space: normal;
    text-align: center;
  }

  button,
  input[type="submit"],
  .btn,
  .reply-btn {
    width: 100%;
    padding: 14px;
  }

  .post h2,
  .post-card h2 {
    font-size: 1.4rem;
  }

  .post p,
  .post-card p {
    font-size: 1rem;
  }
}

/* Better focus outline for accessibility */
a:focus,
button:focus,
input:focus {
  outline: 3px solid #0055a5;
  outline-offset: 2px;
}

.month-separator {
  font-size: 1.5rem;
  font-weight: 700;
  color: #003366;
  margin: 40px 0 20px;
  padding-bottom: 5px;
  border-bottom: 2px solid #dee2e6;
}
