:root {
  --sumi: #2c2c2c;
  --sumi-light: #4a4a4a;
  --washi: #fafaf8;
  --washi-dark: #f0f0ed;
  --shu: #c8543c;
  --shu-light: #d97a66;
  --border: #e0e0dd;
  --text-primary: #2c2c2c;
  --text-secondary: #6b6b6b;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html{
    height: 100%;
}

body {
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", sans-serif;
  background: var(--washi);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--text-primary);
  text-decoration: none;
}

a:hover {
  color: var(--shu);
}

header {
  background: var(--sumi);
  color: var(--washi);
  padding: 16px 20px;
  text-align: center;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--shu);
}

header h1 {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.05em;
}

main {
  flex: 1 0 auto;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px;
}

section {
  display: none;
}

section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

h2 {
  font-size: 22px;
  font-weight: 500;
  margin-bottom: 28px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.05em;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

button {
  width: 100%;
  padding: 16px 20px;
  font-size: 15px;
  font-weight: 500;
  background: var(--washi-dark);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.05em;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}

button:hover {
  background: linear-gradient(to #4a4a4a, rgba(200, 84, 60, 0.05) 0%, var(--washi) 100%);
}

button.primary {
  background: var(--shu);
  color: var(--washi);
  border-color: var(--shu);
}

button.primary:hover {
  background: var(--shu-light);
  border-color: var(--shu-light);
}

button.secondary {
  background: transparent;
  border-color: var(--sumi-light);
}

button.secondary:hover {
  background: var(--washi-dark);
}

.form-group {
  margin-bottom: 24px;
}

label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.05em;
}

input, select {
  width: 100%;
  padding: 14px 16px;
  font-size: 15px;
  background: var(--washi);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 2px;
  transition: all 0.2s ease;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--shu);
  box-shadow: 0 0 0 3px rgba(200, 84, 60, 0.1);
}

input::placeholder {
  color: #b0b0ad;
}

input[type="file"] {
  padding: 12px 16px;
  cursor: pointer;
}

select {
  background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8"><path fill="%236b6b6b" d="M6 8L0 0h12z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px;
  padding-right: 40px;
}

.card {
  background: var(--washi);
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 2px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.card h3 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 12px;
  letter-spacing: 0.05em;
}

.card p {
  font-size: 14px;
  margin: 8px 0;
  line-height: 1.6;
}

.card p strong {
  display: inline-block;
  min-width: 80px;
  color: var(--text-secondary);
  font-weight: 500;
}

.result-list {
  background: var(--washi-dark);
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 2px;
  margin-bottom: 20px;
  max-height: 200px;
  overflow-y: auto;
}

.result-list p {
  font-size: 14px;
  margin: 8px 0;
  padding-left: 12px;
  border-left: 2px solid var(--border);
}

.result-list p.success {
  border-left-color: var(--shu);
}

.result-list p.error {
  border-left-color: #999;
}

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--washi);
  border: 1px solid var(--border);
  border-radius: 2px;
  margin-bottom: 24px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 14px 16px;
  font-size: 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  background: var(--washi-dark);
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--washi-dark);
}

footer {
  flex-shrink: 0;
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--washi);
  background: var(--sumi);
  letter-spacing: 0.1em;
}

.message {
  padding: 16px;
  margin-bottom: 20px;
  border-radius: 2px;
  border-left: 3px solid;
}

.message.success {
  background: rgba(200, 84, 60, 0.1);
  border-left-color: var(--shu);
  color: var(--text-primary);
}

.message.error {
  background: rgba(107, 107, 107, 0.1);
  border-left-color: var(--text-secondary);
  color: var(--text-primary);
}

.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--shu);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#reader-single, #reader-change, #reader-bulk {
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.2s ease;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--washi);
  padding: 32px;
  border-radius: 2px;
  max-width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-content h3 {
  font-size: 18px;
  margin-bottom: 16px;
  letter-spacing: 0.05em;
}

.modal-content .button-group {
  margin-top: 24px;
}

@media (max-width: 640px) {
  main {
    padding: 24px 16px;
  }
  
  h2 {
    font-size: 20px;
  }
  
  button {
    padding: 14px 20px;
    font-size: 14px;
  }
  
  header h1 {
    font-size: 16px;
  }

  .modal-content {
    padding: 24px;
  }
}

#list .button-group {
  margin-bottom: 20px;
}

#list .button-group button {
  background: var(--primary-color);
  color: black;
}

#list .button-group button:hover {
  background: var(--primary-hover);
}

.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(44, 44, 44, 0.7);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.loading-overlay.active {
  display: flex;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(250, 250, 248, 0.3);
  border-top-color: var(--shu);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.error-modal .modal-content {
  border-left: 4px solid var(--text-secondary);
}

.error-modal .error-details {
  background: var(--washi-dark);
  padding: 12px;
  margin: 16px 0;
  border-radius: 2px;
  font-size: 13px;
  color: var(--text-secondary);
  font-family: monospace;
  max-height: 150px;
  overflow-y: auto;
}

.skip-list-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.skip-list-content {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.skip-list-items {
  margin: 1.5rem 0;
}

.skip-item {
  border: 1px solid #ddd;
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.skip-item-info {
  flex: 1;
}

.skip-isbn {
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.skip-reason {
  color: #666;
  margin-bottom: 0.5rem;
}

.skip-time {
  font-size: 0.9rem;
  color: #999;
}

.skip-item-actions {
  display: flex;
  gap: 0.5rem;
}

.skip-item-actions button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.btn-register {
  background: #4CAF50;
  color: white;
}

.btn-remove {
  background: #f44336;
  color: white;
}

.btn-close {
  width: 100%;
  padding: 0.75rem;
  background: #666;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 1rem;
}

.container {
  padding: 0;
  width: 100%;
}

section {
  display: none;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
}

section.active {
  display: block;
}

/* static/css/style.css に追加 */
.confirm-modal .modal-content {
  border-left: 4px solid var(--shu);
}

.existing-holdings-list {
  background: var(--washi-dark);
  padding: 16px;
  border-radius: 2px;
  margin: 16px 0;
  max-height: 300px;
  overflow-y: auto;
}

.holding-item {
  padding: 12px;
  margin-bottom: 8px;
  background: var(--washi);
  border: 1px solid var(--border);
  border-radius: 2px;
}

.holding-item:last-child {
  margin-bottom: 0;
}

.holding-location {
  display: block;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.holding-details {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
}

/* 棚変更の保存ボタンと蔵書一覧の表示ボタンを朱色に統一 */
#change .button-group .primary,
#list .button-group .primary {
    background: var(--shu);
    color: var(--washi);
    border-color: var(--shu);
}

#change .button-group .primary:hover,
#list .button-group .primary:hover {
    background: var(--shu-light);
    border-color: var(--shu-light);
}