/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  cursor: url('https://search.jachu.xyz/images/cursor.cur'), auto;
  transition: background 0.6s ease, color 0.6s ease;
}

.main-container {
  text-align: center;
  padding: 20px;
  width: 95%;
  max-width: 600px;
}

.title {
  font-size: 2rem;
  margin-bottom: 20px;
  animation: fadeIn 1.2s ease-out;
}

.shortener-box {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  padding: 35px;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  animation: floatUp 0.8s ease-out;
  transition: all 0.4s ease-in-out;
}

.input {
  width: 100%;
  padding: 12px 15px;
  margin: 10px 0;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  transition: all 0.4s ease-in-out;
}

.expiry-wrapper {
  display: flex;
  gap: 10px;
  flex-direction: column;
}

.button {
  padding: 12px 20px;
  background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
  border: none;
  color: #fff;
  border-radius: 12px;
  cursor: pointer;
  font-weight: bold;
  margin-top: 15px;
  transition: transform 0.3s ease, all 0.4s ease-in-out;
}

.button:hover {
  transform: scale(1.05);
}

.pulse {
  animation: pulse 1.5s infinite;
}

/* --- Result Box & Loader --- */
.result-box {
  margin-top: 20px;
  font-size: 1rem;
  word-wrap: break-word;
  padding: 12px;
  border-radius: 10px;
  animation: fadeIn 0.5s ease;
}
.result-box.success {
  background-color: #e6ffed;
  color: #006b2b;
  border-left: 5px solid #22c55e;
  animation: bounceSuccess 0.4s ease-in-out;
}
.result-box.error {
  background-color: #ffe6e6;
  color: #a40000;
  border-left: 5px solid #ef4444;
  animation: shakeError 0.4s ease-in-out;
}

.loader-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background-color: rgba(0,0,0,0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.spinner {
  border: 6px solid #f3f3f3;
  border-top: 6px solid #6a11cb;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 0.8s linear infinite;
}

/* --- OG Card --- */
.og-card {
  display: flex;
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 12px #38bdf8;
  animation: cardPulse 2s infinite;
  margin-top: 20px;
  max-width: 600px;
  transition: all 0.4s ease-in-out;
}
.og-card img {
  width: 120px;
  object-fit: cover;
}
.og-info {
  padding: 15px;
  flex: 1;
}
.og-info h3 { margin: 0 0 10px; }
.og-info p { margin: 0 0 12px; word-break: break-all; }

.share-buttons a {
  display: inline-block;
  margin: 5px 5px 0 0;
  padding: 6px 12px;
  background: #3b82f6;
  color: #fff;
  border-radius: 5px;
  font-size: 14px;
  text-decoration: none;
  transition: background 0.3s;
}
.share-buttons a:hover { background: #2563eb; }

/* --- Hamburger Menu & Overlay --- */
.hamburger-menu {
  display: none;
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 1001;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  backdrop-filter: blur(5px);
  align-items: center;
  justify-content: center;
}
.hamburger-menu svg { stroke: white; }

#overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* --- Sidebar --- */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 270px;
  height: 100vh;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border-right: 1px solid rgba(255,255,255,0.1);
  padding: 20px;
  box-shadow: 2px 0 12px rgba(0,0,0,0.2);
  z-index: 1000;
  color: white;
  overflow-y: auto;
  display: none; /* Hidden by default */
  transition: all 0.4s ease-in-out;
}
.sidebar h2 { font-size: 1.4rem; margin-bottom: 10px; }
.sidebar p { font-size: 0.9rem; margin-bottom: 10px; color: #a3e635; }
.sidebar ul { list-style: none; padding: 0; }
.sidebar li {
  margin: 8px 0;
  background: rgba(255, 255, 255, 0.07);
  padding: 8px 12px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}
.sidebar li a { color: #38bdf8; text-decoration: none; }
.sidebar li button {
  background: #ef4444;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}
.sidebar-divider { display: none; }
.sidebar-signout { display: none; }

/* Show sidebar on desktop if user is logged in */
body.logged-in .sidebar {
  display: block;
}

/* --- Edit Form in Sidebar --- */
.edit-form {
  margin-top: 10px;
  padding: 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  width: 100%;
}
.edit-form input { width: 100%; margin: 5px 0; padding: 8px; border-radius: 8px; border: none; }
.edit-form button {
  margin-top: 5px; padding: 6px 12px; border-radius: 6px; font-size: 14px;
  cursor: pointer; background: #22c55e; color: white; border: none;
}
.edit-form button:nth-child(4) { background: #ef4444; margin-left: 5px; }


/* --- Light Mode --- */
body.light-mode { background: linear-gradient(135deg, #ffffff, #e0e0e0); color: #111; }
body.light-mode #authModal > div { background: #f9fafb; color: #111; }
body.light-mode .input { background: #f0f0f0; color: #000; }
body.light-mode .button { background: linear-gradient(135deg, #0f2027, #203a43); color: white; }
body.light-mode .result-box.success { background-color: #d4edda; color: #155724; border-left: 5px solid #28a745; }
body.light-mode .result-box.error { background-color: #f8d7da; color: #721c24; border-left: 5px solid #dc3545; }
body.light-mode .og-card { background: #fff; color: #000; box-shadow: 0 0 10px rgba(0,0,0,0.1); }
body.light-mode .edit-form { background: rgba(0, 0, 0, 0.05); }

/* --- Animations --- */
@keyframes floatUp { 0% { transform: translateY(40px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(106, 17, 203, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(106, 17, 203, 0); } 100% { box-shadow: 0 0 0 0 rgba(106, 17, 203, 0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes bounceSuccess { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes shakeError { 0% { transform: translateX(0); } 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-5px); } 100% { transform: translateX(0); } }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes cardPulse { 0%, 100% { box-shadow: 0 0 12px #38bdf8; } 50% { box-shadow: 0 0 25px #60a5fa; } }

/* ========== RESPONSIVE & MOBILE THEME ========== */
@media (max-width: 768px) {
  /* Show hamburger on mobile if logged in */
  body.logged-in .hamburger-menu {
    display: flex;
  }
  
  /* Hide desktop auth buttons on mobile */
  #authButtons {
    display: none;
  }
  #userIdDisplay {
    top: 22px;
    left: 65px;
  }

  /* Sidebar becomes a slide-in menu */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    display: block !important; /* Always in DOM for transition */
  }

  /* When body has .sidebar-open class, slide it in */
  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open #overlay {
    opacity: 1;
    visibility: visible;
  }

  .sidebar-divider { display: block; }
  .sidebar-signout {
    display: block;
    width: 100%;
    margin-top: 15px;
    background: #c12a2a;
  }
}

body.mobile-theme {
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
  font-family: 'Poppins', sans-serif;
  color: #e0e0e0;
  padding-bottom: 120px;
  overflow-x: hidden;
}
body.mobile-theme .main-container { width: 100%; padding: 20px; max-width: none; }
body.mobile-theme .title { font-size: 2rem; font-weight: 700; color: #fca311; margin-top: 15px; margin-bottom: 30px; text-shadow: 0 0 10px rgba(252, 163, 17, 0.4); }
body.mobile-theme .shortener-box { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); padding: 30px 25px; border-radius: 25px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
body.mobile-theme .input { padding: 16px; margin: 12px 0; font-size: 1rem; background: #1e293b; color: #fff; border: 1px solid #475569; border-radius: 15px; }
body.mobile-theme .input::placeholder { color: #94a3b8; }
body.mobile-theme .input:focus { outline: none; border-color: #fca311; box-shadow: 0 0 15px rgba(252, 163, 17, 0.3); }
body.mobile-theme .button { background: linear-gradient(135deg, #fca311, #e17700); font-size: 1.1rem; font-weight: 600; padding: 16px; border-radius: 15px; width: 100%; margin-top: 15px; box-shadow: 0 4px 15px rgba(252, 163, 17, 0.2); }
body.mobile-theme .button:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(252, 163, 17, 0.3); }
body.mobile-theme .result-box { font-size: 1rem; padding: 16px; margin-top: 20px; border-radius: 15px; }
body.mobile-theme .og-card { flex-direction: column; box-shadow: none; background: rgba(30, 41, 59, 0.7); border: 1px solid rgba(148, 163, 184, 0.2); border-radius: 15px; }
body.mobile-theme .og-card img { width: 100%; height: auto; border-top-left-radius: 15px; border-top-right-radius: 15px; }

/* Mobile theme sidebar overrides */
body.mobile-theme .sidebar {
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  width: 280px;
  padding: 25px;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}
body.mobile-theme .sidebar h2 { color: #fca311; }
body.mobile-theme .sidebar li { background: rgba(148, 163, 184, 0.15); border-radius: 15px; }
body.mobile-theme .sidebar li:hover { background: rgba(148, 163, 184, 0.25); }
