/* ========================================
   🔄 共通コンポーネント - components.css
   ======================================== */

/* ===== Buttons ===== */
.btn {
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 10px 15px;
  cursor: pointer;
  margin-top: 5px;
  border-radius: 4px;
  width: 100%;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.3s ease;
  display: inline-block;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 2px 4px var(--shadow);
}

.btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow-dark);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px var(--shadow);
}

.btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: var(--accent);
  color: #222;
  font-weight: 600;
}

.btn-primary:hover {
  background: #f9aa07;
}

.btn-secondary {
  background: var(--bg-light);
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-secondary:hover {
  background: var(--primary);
  color: var(--white);
}

.btn-danger {
  background: #f44336;
}

.btn-danger:hover {
  background: #d32f2f;
}

.btn-small {
  padding: 6px 12px;
  font-size: 14px;
}

.kick-btn {
  margin-top: 6px;
  background: #f44336;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  font-size: 12px;
}

.kick-btn:hover {
  opacity: 0.85;
}

/* ===== Forms ===== */
input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  padding: 8px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-sizing: border-box;
  font-size: 14px;
  transition: border-color 0.3s ease;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(92, 106, 196, 0.1);
}

label {
  display: block;
  margin: 10px 0 5px;
  font-weight: 500;
  color: var(--text);
}

/* ===== Cards ===== */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 5px var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-dark);
}

.card-header {
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.card-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.card-body {
  line-height: 1.6;
}

/* ===== Chat Components ===== */
.chat-section {
  background: var(--white);
  border: 1px solid var(--border);
  padding: 15px;
  border-radius: 8px;
  margin-top: 20px;
  box-shadow: 0 2px 5px var(--shadow);
}

.chat-log {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #ddd;
  padding: 10px;
  background: #f9f9f9;
  margin-bottom: 10px;
  border-radius: 4px;
  scroll-behavior: smooth;
}

.chat-message {
  margin-bottom: 5px;
  padding: 2px 0;
}

.system-message {
  font-style: italic;
  color: #666;
}

#chat-input {
  width: calc(100% - 80px);
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* ===== ノートPC向けレスポンシブ対応（1024px - 1599px）===== */
@media (max-width: 1599px) and (min-width: 1024px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  textarea {
    padding: 6px 10px;
    margin-bottom: 7px;
    font-size: 12px;
    border-radius: 3px;
  }

  label {
    margin: 7px 0 3px;
    font-size: 12px;
  }

  .badge {
    padding: 3px 6px;
    font-size: 10px;
    border-radius: 10px;
  }

  .kick-btn {
    padding: 3px 6px;
    font-size: 10px;
    border-radius: 5px;
    margin-top: 4px;
  }
}

/* ===== 小型ノートPC/タブレット向け（769px - 1023px）===== */
@media (max-width: 1023px) and (min-width: 769px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  textarea {
    padding: 5px 8px;
    margin-bottom: 6px;
    font-size: 11px;
    border-radius: 3px;
  }

  label {
    margin: 6px 0 2px;
    font-size: 11px;
  }

  .badge {
    padding: 2px 5px;
    font-size: 9px;
    border-radius: 8px;
  }

  .kick-btn {
    padding: 2px 5px;
    font-size: 9px;
    border-radius: 4px;
    margin-top: 3px;
  }
}

@media (max-width: 768px) {
  #chat-input {
    width: calc(100% - 70px);
  }
}

/* ===== Modal/Overlay ===== */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.overlay.show {
  display: flex;
  opacity: 1;
}

.overlay-content {
  background: var(--white);
  padding: 30px;
  border-radius: 8px;
  text-align: center;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.overlay.show .overlay-content {
  transform: scale(1);
}

/* ===== Loading States ===== */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(92, 106, 196, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== Badges and Labels ===== */
.badge {
  display: inline-block;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-primary {
  background: var(--primary);
  color: var(--white);
}

.badge-success {
  background: #4caf50;
  color: var(--white);
}

.badge-warning {
  background: var(--accent);
  color: #222;
}

.badge-danger {
  background: #f44336;
  color: var(--white);
}

/* ===== Tooltips ===== */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 1000;
  margin-bottom: 5px;
}
