:root {
  --background: hsl(0, 0%, 100%);
  --foreground: hsl(20, 14.3%, 4.1%);
  --muted: hsl(60, 4.8%, 95.9%);
  --muted-foreground: hsl(25, 5.3%, 44.7%);
  --popover: hsl(0, 0%, 100%);
  --popover-foreground: hsl(20, 14.3%, 4.1%);
  --card: hsl(0, 0%, 100%);
  --card-foreground: hsl(20, 14.3%, 4.1%);
  --border: hsl(20, 5.9%, 90%);
  --input: hsl(20, 5.9%, 90%);
  --primary: hsl(207, 90%, 54%);
  --primary-foreground: hsl(211, 100%, 99%);
  --secondary: hsl(60, 4.8%, 95.9%);
  --secondary-foreground: hsl(24, 9.8%, 10%);
  --accent: hsl(60, 4.8%, 95.9%);
  --accent-foreground: hsl(24, 9.8%, 10%);
  --destructive: hsl(0, 84.2%, 60.2%);
  --destructive-foreground: hsl(60, 9.1%, 97.8%);
  --ring: hsl(20, 14.3%, 4.1%);
  --radius: 0.5rem;
  --success: hsl(122, 39%, 49%);
  --warning: hsl(35, 91%, 62%);
  --error: hsl(0, 84%, 60%);
}

* {
  border-color: var(--border);
}

body {
  font-family: 'Noto Sans JP', sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  font-feature-settings: "rlig" 1, "calt" 1;
  -webkit-font-smoothing: antialiased;
  margin: 0;
  padding: 0;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 0.5rem;
}

.header {
  background: white;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  border-bottom: 1px solid hsl(20, 5.9%, 90%);
  padding: 0.5rem 0;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 2.5rem;
  height: 2.5rem;
  background-color: var(--primary);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
}

.logo-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: hsl(20, 14.3%, 4.1%);
  margin: 0;
}

.logo-text p {
  font-size: 0.875rem;
  color: hsl(25, 5.3%, 44.7%);
  margin: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: var(--primary);
  color: white;
  text-decoration: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color 0.3s;
}

.header-link:hover {
  background-color: hsl(207, 90%, 48%);
  color: white;
  text-decoration: none;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: white;
  padding: 0.75rem;
  border-radius: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border);
}

.user-details {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 2.5rem;
  height: 2.5rem;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: white;
}

.user-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--foreground);
  margin: 0;
}

.remaining-days {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  display: inline-block;
}

.remaining-days.normal {
  background: hsl(122, 39%, 95%);
  color: hsl(122, 39%, 30%);
}

.remaining-days.warning {
  background: hsl(35, 91%, 95%);
  color: hsl(35, 91%, 30%);
}

.remaining-days.expired {
  background: hsl(0, 84%, 95%);
  color: hsl(0, 84%, 30%);
}

.logout-btn {
  background: var(--destructive);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.3s;
}

.logout-btn:hover {
  background: hsl(0, 84.2%, 55%);
}

.main {
  background-color: hsl(60, 4.8%, 95.9%);
  min-height: calc(100vh - 260px);
  padding: 2rem 0;
}

/* Login Form Styles */
.login-container {
  max-width: 400px;
  margin: 4rem auto;
  background: white;
  padding: 2rem;
  border-radius: 0.75rem;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
}

.login-header p {
  font-size: 0.875rem;
  color: hsl(25, 5.3%, 44.7%);
  margin: 0;
}

.form-group {
  margin-bottom: 1.5rem;
}

.label {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(20, 14.3%, 4.1%);
  margin-bottom: 0.5rem;
  display: block;
}

.input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--input);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  transition: border-color 0.3s;
  background: white;
  box-sizing: border-box;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px hsl(207, 90%, 54%, 0.2);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.3s;
  text-decoration: none;
  box-sizing: border-box;
}

.button-primary {
  background-color: var(--primary);
  color: white;
  width: 100%;
}

.button-primary:hover {
  background-color: hsl(207, 90%, 48%);
}

.button-secondary {
  background-color: var(--secondary);
  color: var(--secondary-foreground);
}

.button-secondary:hover {
  background-color: hsl(60, 4.8%, 91%);
}

.button-success {
  background-color: var(--success);
  color: white;
}

.button-success:hover {
  background-color: hsl(122, 39%, 44%);
}

.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.button.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.button.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1rem;
  height: 1rem;
  margin: -0.5rem 0 0 -0.5rem;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.button.loading::before {
  content: '処理中...';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: inherit;
  font-size: 0.875rem;
}

.button.loading.button-primary::before {
  content: '情報を抽出中...';
}

.button.loading.button-success::before {
  content: '申請書作成中...';
}

.button-full {
  width: 100%;
}

.error-message {
  background: hsl(0, 84.2%, 95%);
  border: 1px solid hsl(0, 84.2%, 80%);
  color: hsl(0, 84.2%, 40%);
  padding: 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.progress-indicator {
  margin-bottom: 2rem;
}

.progress-steps {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.step {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.step-circle {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transition: all 0.3s;
}

.step-circle.active {
  background-color: var(--primary);
  color: white;
}

.step-circle.inactive {
  background-color: hsl(60, 4.8%, 95.9%);
  color: hsl(25, 5.3%, 44.7%);
}

.step-title {
  font-size: 0.875rem;
  font-weight: 500;
}

.step-title.active {
  color: hsl(20, 14.3%, 4.1%);
}

.step-title.inactive {
  color: hsl(25, 5.3%, 44.7%);
}

.step-connector {
  width: 4rem;
  height: 1px;
  background-color: hsl(60, 4.8%, 95.9%);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}

.card {
  background: white;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid hsl(60, 4.8%, 95.9%);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: hsl(20, 14.3%, 4.1%);
  margin: 0 0 0.5rem 0;
}

.card-description {
  font-size: 0.875rem;
  color: hsl(25, 5.3%, 44.7%);
  margin: 0;
}

.card-content {
  padding: 1.5rem;
}

.upload-area {
  border: 2px dashed hsl(20, 5.9%, 90%);
  border-radius: 0.5rem;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.3s;
}

.upload-area:hover {
  border-color: var(--primary);
}

.upload-icon {
  width: 4rem;
  height: 4rem;
  background-color: hsl(60, 4.8%, 95.9%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  color: hsl(25, 5.3%, 44.7%);
  font-size: 2rem;
}

.upload-text {
  font-size: 1.125rem;
  font-weight: 500;
  color: hsl(20, 14.3%, 4.1%);
  margin: 0 0 0.25rem 0;
}

.upload-subtext {
  font-size: 0.875rem;
  color: hsl(25, 5.3%, 44.7%);
  margin: 0 0 1rem 0;
}

.upload-format {
  font-size: 0.75rem;
  color: hsl(25, 5.3%, 44.7%);
  margin: 0;
}

.select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--input);
  border-radius: 0.375rem;
  font-size: 0.875rem;
  background: white;
  cursor: pointer;
}

.action-buttons {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.hidden {
  display: none;
}

/* Full screen loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}

.loading-overlay.hidden {
  display: none !important;
}

.loading-overlay-content {
  background: white;
  padding: 2rem;
  border-radius: 0.75rem;
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 10px 10px -5px rgb(0 0 0 / 0.04);
  text-align: center;
  max-width: 400px;
  width: 90%;
}

.loading-overlay-spinner {
  width: 3rem;
  height: 3rem;
  border: 3px solid hsl(60, 4.8%, 95.9%);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

.loading-overlay-text {
  font-size: 1.125rem;
  font-weight: 500;
  color: hsl(20, 14.3%, 4.1%);
  margin: 0 0 0.5rem 0;
}

.loading-overlay-subtext {
  font-size: 0.875rem;
  color: hsl(25, 5.3%, 44.7%);
  margin: 0;
}

@media (max-width: 1024px) {
  .grid {
    grid-template-columns: 1fr;
  }
  
  .action-buttons {
    flex-direction: column;
    align-items: center;
  }
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .user-info {
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    width: 100%;
  }

  .user-details {
    flex-direction: column;
    text-align: center;
  }

  .user-text {
    align-items: center;
  }
  
  .logo-text h1 {
    font-size: 1.125rem;
  }
  
  .logo-text p {
    font-size: 0.75rem;
  }
}
