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

* {
  transition: all 0.25s ease;
  min-width: 0;
}

body {
  font-family: 'Poppins', Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #f4f4f9;
  color: #333;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

body.dark {
  background: #0d0d0d;
  color: #e0e0e0;
}

/* Header */
.header {
  background: linear-gradient(90deg, #4CAF50, #43A047);
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  border-bottom: 1px solid #388e3c;
  border-radius: 0 0 12px 12px;
  flex-wrap: wrap;
}

body.dark .header {
  background: linear-gradient(90deg, #1a1a1a, #2a2a2a);
  border-bottom: 1px solid #333;
}

/* Logo and Title */
.left-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-img {
  height: 40px;
  width: auto;
}

.page-title {
  font-size: 1.5rem;
  font-weight: bold;
}

/* User Info */
.user-info {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
}

/* Balance Box */
.balance-box {
  background: #e0e0e0;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: bold;
  color: #333;
}

body.dark .balance-box {
  background: #1a1a1a;
  color: #ccc;
}

/* Nav Bar */
nav {
  display: flex;
  flex-wrap: wrap;
  background: white;
  border-bottom: 1px solid #ccc;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  width: 100%;
}

body.dark nav {
  background: #1a1a1a;
  border-bottom: 1px solid #333;
}

nav button {
  flex: 1;
  padding: 1rem;
  font-weight: bold;
  background: white;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: #555;
  transition: background 0.3s, color 0.3s, transform 0.2s;
}

nav button.active {
  background: #4CAF50;
  color: white;
}

nav button:hover {
  background: #f0f0f0;
}

body.dark nav button {
  background: #1a1a1a;
  color: #ddd;
}

body.dark nav button.active {
  background: #2e7d32;
  color: white;
}

body.dark nav button:hover {
  background: #2b2b2b;
}

/* Real Button Style */
button, .nav-link-button {
  display: inline-block;
  background: linear-gradient(180deg, #4CAF50, #388E3C);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.75rem 1.5rem;
  margin: 0.5rem 0;
  border: none;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.25s, box-shadow 0.25s, transform 0.25s;
  overflow-wrap: anywhere;
}

button:hover, .nav-link-button:hover {
  background: linear-gradient(180deg, #43A047, #2E7D32);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
  transform: translateY(-2px);
}

button:focus, .nav-link-button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.5);
}

body.dark button, body.dark .nav-link-button {
  background: linear-gradient(180deg, #2e7d32, #1b5e20);
  color: #f1f1f1;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

body.dark button:hover, body.dark .nav-link-button:hover {
  background: linear-gradient(180deg, #1b5e20, #145214);
}

button:disabled, .nav-link-button:disabled {
  background: #ccc;
  color: #666;
  box-shadow: none;
  cursor: not-allowed;
}

body.dark button:disabled, body.dark .nav-link-button:disabled {
  background: #444;
  color: #888;
}

/* Container */
.container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding: 1rem;
  box-sizing: border-box;
  min-width: 0;
}

/* Box, Contract, Tab */
.box, .contract, .tab {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  text-align: center;
  width: 100%;
  max-width: 500px;
  box-sizing: border-box;
  transition: transform 0.3s, box-shadow 0.3s;
}

body.dark .box, body.dark .contract, body.dark .tab {
  background-color: #1a1a1a;
  color: #e0e0e0;
}

.tab {
  display: none;
  margin: 2rem auto;
}

.tab.active {
  display: block;
}

/* Hover Cards */
.box:hover, .contract:hover, .tab.active:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

/* Inputs and Buttons */
input, button, select {
  padding: 0.75rem;
  margin-top: 1rem;
  width: 100%;
  box-sizing: border-box;
  font-size: 1rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  transition: border-color 0.3s, box-shadow 0.3s;
  max-width: 100%;
}

input:focus, button:focus, select:focus {
  border-color: #4CAF50;
  box-shadow: 0 0 4px rgba(76, 175, 80, 0.5);
  outline: none;
}

body.dark input, body.dark select {
  background: #121212;
  color: #eee;
  border-color: #444;
}

button {
  background: #4CAF50;
  color: white;
  border: none;
  font-weight: 600;
  padding: 0.75rem;
  margin-top: 1rem;
  width: 100%;
  border-radius: 8px;
  font-size: 1rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: background 0.3s, box-shadow 0.3s, transform 0.2s;
}

button:hover {
  background: #43A047;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
  transform: translateY(-2px);
}

button:focus {
  outline: none;
  background: #388E3C;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.5);
}

/* Dark mode buttons */
body.dark button {
  background: #2e7d32;
  color: #f1f1f1;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

body.dark button:hover {
  background: #1b5e20;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.5);
}

/* Disabled button */
button:disabled {
  background: #ccc;
  color: #666;
  box-shadow: none;
  cursor: not-allowed;
}

body.dark button:disabled {
  background: #444;
  color: #888;
}

/* History */
.history {
  font-size: 0.9rem;
  color: #555;
  margin-top: 0.5rem;
  text-align: left;
}

body.dark .history {
  color: #aaa;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #333;
  color: #fff;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease, transform 0.5s ease;
  max-width: 90vw;
  z-index: 1000;
  overflow-wrap: anywhere;
}

.toast.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-10px);
}

body.dark .toast {
  background: #444;
  color: #eee;
}

/* Suggestions */
#suggestions div {
  cursor: pointer;
  padding: 0.5rem;
  border-bottom: 1px solid #ccc;
  background: #f9f9f9;
}

#suggestions div:hover {
  background: #e0e0e0;
}

body.dark #suggestions div {
  background: #2a2a2a;
  color: #eee;
  border-bottom: 1px solid #444;
}

body.dark #suggestions div:hover {
  background: #3a3a3a;
}

/* Invite List */
ul#invitedList {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  text-align: left;
}

/* Responsive */
@media (max-width: 600px) {
  body {
    font-size: 15px;
  }

  .header, .user-info, .nav-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    width: 100%;
  }

  .nav-links {
    width: 100%;
    padding-right: 0;
  }

  .box, .contract, .tab {
    padding: 1rem;
    max-width: calc(100vw - 2rem);
  }

  nav button {
    font-size: 0.9rem;
    padding: 0.75rem;
    min-height: 44px;
  }

  input, button, select, .nav-link-button {
    min-height: 44px;
  }

  .toast {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    max-width: none;
  }
}

/* Back Link */
.back-link {
  font-weight: bold;
  background: none;
  color: white;
  text-decoration: none;
  font-size: 1rem;
}

body.dark .back-link {
  color: #e0e0e0;
}
