/* === Global layout === */
body {
  background: #f5f8fa;
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  color: #14171a;
}

/* === Wrapper & Sidebar === */
.wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: #1da1f2;
  color: white;
  padding: 20px;
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
}

.sidebar h3 {
  text-align: center;
  margin-top: 0;
}

.sidebar a {
  display: block;
  color: white;
  text-decoration: none;
  padding: 10px 0;
  font-weight: bold;
  border-radius: 6px;
}

.sidebar a:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* === Main content === */
.content {
  margin-left: 240px;
  padding: 30px;
  flex: 1;
}

.container, .profile-box, .tweet-box {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(0,0,0,0.08);
  padding: 20px;
  margin-bottom: 20px;
}

/* === Buttons === */
button, .btn {
  background: #1da1f2;
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 25px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.3s;
}

button:hover, .btn:hover {
  background: #0d8ae5;
}

/* === Inputs === */
input[type="text"], input[type="password"], input[type="file"], textarea {
  width: 100%;
  padding: 10px;
  margin: 8px 0;
  border: 1px solid #ccd6dd;
  border-radius: 6px;
  box-sizing: border-box;
}

/* === Tweets & Profile === */
.tweet {
  border-bottom: 1px solid #e6ecf0;
  padding: 10px 0;
}

.tweet:last-child {
  border-bottom: none;
}

.profile-box {
  text-align: center;
  max-width: 400px;
  margin: 0 auto;
}

.profile-box img {
  border-radius: 50%;
  width: 120px;
  height: 120px;
  object-fit: cover;
  margin-bottom: 10px;
}

/* === Mobile responsive === */
@media (max-width: 768px) {
  .wrapper {
    flex-direction: column;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    text-align: center;
    padding: 10px 0;
  }

  .sidebar a {
    display: inline-block;
    margin: 5px 10px;
  }

  .content {
    margin-left: 0;
    padding: 20px;
  }

  .profile-box, .tweet-box, .container {
    box-shadow: none;
    width: 100%;
  }

  button, .btn {
    width: 100%;
    border-radius: 8px;
  }
}
@media (max-width: 768px) {
  .wrapper {
    flex-direction: column;
  }
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    text-align: center;
    padding: 10px 0;
  }
  .content {
    margin-left: 0;
    width: 100%;
    padding: 20px;
  }
}
/* === FIX for mobile sidebar (100% width and not fixed) === */
@media (max-width: 768px) {
  .wrapper {
    flex-direction: column !important;
  }

  .sidebar {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    text-align: center !important;
    padding: 12px 0 !important;
  }

  .sidebar a {
    display: inline-block !important;
    margin: 6px 10px !important;
    padding: 8px 12px !important;
  }

  .content {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 15px !important;
  }
}

/* === Fix tweet.php buttons on mobile === */
@media (max-width: 768px) {
  .btn, button {
    display: block !important;
    width: 100% !important;
    margin: 8px 0 !important;
  }

  form button,
  form .btn {
    margin-top: 10px !important;
  }
}

/* --- Chrome-safe sidebar (use sticky instead of fixed) --- */
html, body {
  height: auto !important;
  overflow-y: auto !important;
  margin: 0;
  padding: 0;
}

/* Desktop: keep sidebar visible but not fixed to viewport (avoid Chrome clipping) */
@media (min-width: 769px) {
  .wrapper {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
  }

  .sidebar {
    position: -webkit-sticky; /* Safari/Chrome */
    position: sticky;
    top: 0;
    width: 220px;
    height: auto;      /* no 100vh here */
    align-self: flex-start;
    overflow: auto;
    z-index: 2;
  }

  .content {
    margin-left: 240px;
    padding-top: 20px;   /* ensure top content not hidden */
    padding-bottom: 40px;
    box-sizing: border-box;
    width: calc(100% - 240px);
    overflow: visible;
    height: auto;
  }
}

/* Mobile: stacked top bar */
@media (max-width: 768px) {
  .wrapper { flex-direction: column; }
  .sidebar {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    text-align: center;
  }
  .content {
    margin-left: 0 !important;
    padding: 16px !important;
  }
}

/* Safety patch for WebKit rendering quirks */
@supports (-webkit-appearance: none) {
  .content, .feed {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
}

