/* ログイン画面の共通スタイル */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body,
input,
button,
label,
h1,
h2,
h3,
h4,
h5,
h6,
p {
  font-family: 'Noto Sans JP', Arial, sans-serif !important;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s, color 0.3s;
  background: linear-gradient(135deg, #ffffff 0%, #f0f4f8 100%);
}

/* ダークモード */
body.dark {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  color: #fff;
}

/* ライトモード */
body.light {
  background: linear-gradient(135deg, #ffffff 0%, #f0f4f8 100%);
  color: #333;
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-card {
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  padding: 32px;
  transition: background-color 0.3s, box-shadow 0.3s;
}

body.dark .login-card {
  background-color: #2d2d2d;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: #333;
  transition: color 0.3s;
}

body.dark .login-title {
  color: #fff;
}

.login-subtitle {
  font-size: 16px;
  color: #666;
  margin: 0;
  font-weight: 400;
  transition: color 0.3s;
}

body.dark .login-subtitle {
  color: #ccc;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group--checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0;
  margin: 8px 0;
}

.form-label {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  transition: color 0.3s;
}

body.dark .form-label {
  color: #fff;
}

.form-input {
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.3s;
  background-color: #fff;
  color: #333;
}

.form-input:focus {
  outline: none;
  border-color: #1babbe;
  box-shadow: 0 0 0 3px rgba(27, 171, 190, 0.1);
}

.form-input::placeholder {
  color: #999;
}

body.dark .form-input {
  background-color: #333;
  color: #fff;
  border-color: #555;
  caret-color: #fff;
}

body.dark .form-input:focus {
  border-color: #1babbe;
  box-shadow: 0 0 0 3px rgba(27, 171, 190, 0.2);
}

body.dark .form-input::placeholder {
  color: #777;
}

/* パスワード表示アイコンのスタイル - ライトモード（ダークグレー） */
body.light .form-input[type="password"]::-ms-reveal,
body.light .form-input[type="password"]::-ms-clear {
  filter: invert(0%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(40%) contrast(100%);
  opacity: 0.7;
}

body.light .form-input[type="password"]::-webkit-credentials-auto-fill-button {
  filter: invert(0%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(40%) contrast(100%);
  opacity: 0.7;
}

/* パスワード表示アイコンのスタイル - ダークモード（白系） */
body.dark .form-input[type="password"]::-ms-reveal,
body.dark .form-input[type="password"]::-ms-clear {
  filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
}

body.dark .form-input[type="password"]::-webkit-credentials-auto-fill-button {
  filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(100%);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  user-select: none;
}

.checkbox-input {
  width: 16px;
  height: 16px;
  accent-color: #1babbe;
  cursor: pointer;
}

.checkbox-text {
  color: #666;
  transition: color 0.3s;
}

body.dark .checkbox-text {
  color: #ccc;
}

.login-button {
  position: relative;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  background-color: #1babbe;
  color: white;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
}

.login-button:hover:not(:disabled) {
  background-color: #1b90be;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(27, 171, 190, 0.3);
}

.login-button:active {
  transform: translateY(0);
}

.login-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.button-text {
  transition: opacity 0.3s;
}

.button-spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 8px;
}

.login-button.loading .button-text {
  opacity: 0.7;
}

.login-button.loading .button-spinner {
  display: block;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.error-message {
  color: #e74c3c;
  font-size: 14px;
  text-align: center;
  padding: 8px;
  border-radius: 4px;
  background-color: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.2);
  display: none;
  animation: shake 0.5s ease-in-out;
}

.error-message.show {
  display: block;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

body.dark .error-message {
  background-color: rgba(231, 76, 60, 0.2);
  border-color: rgba(231, 76, 60, 0.3);
}

.login-footer {
  margin-top: 24px;
  border-top: 1px solid #eee;
  padding-top: 20px;
  transition: border-color 0.3s;
}

body.dark .login-footer {
  border-top-color: #444;
}

.theme-toggle-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.theme-label {
  font-size: 14px;
  color: #666;
  font-weight: 500;
  transition: color 0.3s;
}

body.dark .theme-label {
  color: #ccc;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  background-color: #1babbe;
  color: white;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.theme-toggle:hover {
  background-color: #1b90be;
  transform: scale(1.05);
}

body.dark .theme-toggle {
  background-color: #444;
}

body.dark .theme-toggle:hover {
  background-color: #555;
}

.theme-icon {
  transition: transform 0.3s;
}

.theme-toggle:hover .theme-icon {
  transform: rotate(20deg);
}

/* レスポンシブ対応 */
@media (max-width: 480px) {
  .login-container {
    padding: 16px;
  }
  
  .login-card {
    padding: 24px;
  }
  
  .login-title {
    font-size: 24px;
  }
  
  .login-subtitle {
    font-size: 14px;
  }
}

@media (max-height: 600px) {
  .login-container {
    padding: 10px;
  }
  
  .login-card {
    padding: 20px;
  }
  
  .login-header {
    margin-bottom: 20px;
  }
}

/* ブラウザのオートフィル時のスタイルを上書き */
.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus,
.form-input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px #333 inset !important;
  -webkit-text-fill-color: #fff !important;
  transition: background-color 5000s ease-in-out 0s;
}

body.dark .form-input:-webkit-autofill,
body.dark .form-input:-webkit-autofill:hover,
body.dark .form-input:-webkit-autofill:focus,
body.dark .form-input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px #333 inset !important;
  -webkit-text-fill-color: #fff !important;
}
