/* QuickQR Enhanced - Tool Template Style */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.main {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  min-height: 100vh;
  padding: 2rem 24px !important;
  margin: 0 auto !important;
  max-width: 1024px !important;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

/* Tool Header */
.tool-header {
  background: linear-gradient(45deg, #667eea, #764ba2);
  color: white;
  padding: 30px 40px;
  text-align: center;
}

.tool-header h1 {
  font-size: 2.5em;
  margin-bottom: 10px;
  font-weight: 700;
}

.tool-header p {
  opacity: 0.9;
  font-size: 1.1em;
  margin-bottom: 8px;
}

.tool-header .sub-desc {
  font-size: 1em;
  opacity: 0.8;
}

.privacy-note {
  margin-top: 15px;
  padding: 10px 15px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  font-size: 0.9em;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Main Content */
.main-content {
  padding: 40px;
}

.input-section {
  margin-bottom: 30px;
}

.input-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}


.mode-buttons {
  display: flex;
  gap: 5px;
}

.mode-btn {
  padding: 8px 16px;
  border: 2px solid #667eea;
  background: white;
  color: #667eea;
  border-radius: 25px;
  cursor: pointer;
  font-size: 0.9em;
  transition: all 0.3s ease;
}

.mode-btn.active {
  background: #667eea;
  color: white;
}

.preset-dropdown {
  position: relative;
}

.preset-btn {
  padding: 8px 16px;
  border: 2px solid #764ba2;
  background: white;
  color: #764ba2;
  border-radius: 25px;
  cursor: pointer;
  font-size: 0.9em;
}

.preset-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border: 1px solid #ddd;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  min-width: 200px;
  z-index: 1000;
}

.preset-item {
  padding: 10px 15px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
}

.preset-item:hover {
  background: #f5f5f5;
}

.preset-item:last-child {
  border-bottom: none;
}

#textInput {
  width: 100%;
  padding: 20px;
  border: 2px solid #e0e0e0;
  border-radius: 15px;
  font-size: 1.1em;
  resize: vertical;
  min-height: 120px;
  transition: border-color 0.3s ease;
}

#textInput:focus {
  outline: none;
  border-color: #667eea;
}

/* Form Sections */
.wifi-form,
.vcard-form,
.event-form,
.location-form {
  display: none;
  background: #f0f8ff;
  padding: 20px;
  border-radius: 15px;
  margin-bottom: 15px;
}

.form-row {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.form-field {
  flex: 1;
  min-width: 200px;
}

.form-field label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: #555;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 1em;
}

.form-field textarea {
  resize: vertical;
  min-height: 80px;
}

.gps-btn {
  padding: 10px 16px;
  background: #4CAF50;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  width: 100%;
}

.map-container {
  margin-top: 15px;
}

.map-instructions {
  text-align: center;
  color: #666;
  font-size: 0.9em;
  margin-top: 10px;
}

/* Batch Section */
.batch-section {
  display: none;
  background: #fff5f5;
  padding: 20px;
  border-radius: 15px;
  margin-bottom: 15px;
}

.batch-input {
  width: 100%;
  min-height: 120px;
  padding: 15px;
  border: 2px dashed #ddd;
  border-radius: 10px;
  font-family: monospace;
  font-size: 0.9em;
  resize: vertical;
  transition: border-color 0.3s ease;
}

.batch-input:focus {
  outline: none;
  border-color: #667eea;
}

.batch-input.dragover {
  border-color: #4CAF50;
  background: #f8fff8;
}

.file-drop-zone {
  border: 2px dashed #ddd;
  border-radius: 10px;
  padding: 40px;
  text-align: center;
  color: #666;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 15px;
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
  border-color: #4CAF50;
  background: #f8fff8;
  color: #4CAF50;
}

.batch-controls {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.batch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.batch-item {
  background: white;
  border-radius: 10px;
  padding: 15px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.batch-item-text {
  font-size: 0.8em;
  color: #666;
  margin-bottom: 10px;
  word-break: break-all;
  max-height: 40px;
  overflow: hidden;
}

.batch-item canvas {
  margin-bottom: 10px;
}

.batch-item-actions {
  display: flex;
  justify-content: center;
  gap: 5px;
}

.batch-item-btn {
  padding: 4px 8px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.8em;
  color: white;
}

.btn-download-small {
  background: #4CAF50;
}

.btn-copy-small {
  background: #2196F3;
}

/* QR Display Section */
.qr-section {
  text-align: center;
  margin-bottom: 30px;
}

#qrcode {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: white;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
  min-height: 200px;
  transition: min-height 0.3s ease;
  position: relative;
  overflow: hidden;
}

#qrcode.size-128 {
  min-height: 168px;
}

#qrcode.size-256 {
  min-height: 296px;
}

#qrcode.size-384 {
  min-height: 424px;
}

#qrcode canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

/* QRコード表示の中央配置を強化 */
#qrcode>div {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
  height: 100% !important;
}

#qrcode canvas {
  margin: 0 auto !important;
}

.size-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

.size-btn {
  padding: 8px 16px;
  border: 2px solid #667eea;
  background: white;
  color: #667eea;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.size-btn.active {
  background: #667eea;
  color: white;
}

.action-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.action-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-download {
  background: linear-gradient(45deg, #4CAF50, #45a049);
  color: white;
}

.btn-copy {
  background: linear-gradient(45deg, #2196F3, #1976D2);
  color: white;
}

.btn-print {
  background: linear-gradient(45deg, #FF9800, #F57C00);
  color: white;
}

.btn-scan {
  background: linear-gradient(45deg, #9C27B0, #7B1FA2);
  color: white;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* History Section */
.history-section {
  background: #f8f9ff;
  padding: 20px;
  border-radius: 15px;
  margin-top: 20px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.history-header h3 {
  color: #555;
  font-size: 1.2em;
}

.history-controls {
  display: flex;
  gap: 10px;
}

.save-history,
.clear-history {
  padding: 6px 12px;
  border: none;
  border-radius: 15px;
  cursor: pointer;
  font-size: 0.9em;
}

.save-history {
  background: #4CAF50;
  color: white;
}

.clear-history {
  background: #ff4757;
  color: white;
}

.history-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.history-item {
  background: white;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid #e0e0e0;
}

.history-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.history-text {
  font-size: 0.9em;
  color: #666;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.history-time {
  font-size: 0.8em;
  color: #999;
  margin-top: 5px;
}

/* Scanner Section */
.scanner-section {
  display: none;
  background: #f0f8ff;
  padding: 20px;
  border-radius: 15px;
  margin-top: 20px;
  text-align: center;
}

#video {
  width: 100%;
  max-width: 400px;
  border-radius: 10px;
  margin-bottom: 15px;
}

.scanner-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* Status Messages */
.status-message {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 15px 20px;
  border-radius: 10px;
  color: white;
  font-weight: 600;
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}

.status-message.show {
  transform: translateX(0);
}

.status-success {
  background: #4CAF50;
}

.status-error {
  background: #f44336;
}

/* Print Styles */
.print-view {
  display: none;
}

@media print {

  /* すべてのページ要素を非表示 */
  body * {
    visibility: hidden;
  }

  /* 印刷表示要素のみ表示 */
  .print-view,
  .print-view * {
    visibility: visible !important;
  }

  .print-view {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: block !important;
    background: white;
    color: black;
    font-family: Arial, sans-serif;
    padding: 20px;
    margin: 0;
    box-sizing: border-box;
  }

  /* 印刷時のページ設定 */
  @page {
    margin: 1cm;
    size: A4;
  }

  /* 印刷内容のスタイル調整 */
  .print-view h2 {
    color: black !important;
    font-size: 24px !important;
    margin-bottom: 20px !important;
  }

  .print-view img {
    max-width: 300px !important;
    height: auto !important;
    display: block !important;
    margin: 0 auto !important;
  }

  .print-view div {
    color: black !important;
  }

  /* ページ分割の制御 */
  .print-view>div {
    page-break-inside: avoid;
  }
}

/* Responsive Design */
@media (max-width: 768px) {


  .main-content {
    padding: 10px;
  }

  .tool-header {
    padding: 20px;
  }

  .tool-header h1 {
    font-size: 2em;
  }

  .input-controls {
    flex-direction: column;
  }

  .mode-buttons {
    justify-content: center;
  }

  .action-buttons {
    flex-direction: column;
    align-items: center;
  }

  .action-btn {
    width: 200px;
    justify-content: center;
  }

  .form-row {
    flex-direction: column;
  }

  .form-field {
    min-width: auto;
  }
}

@media (max-width: 480px) {
  .tool-header h1 {
    font-size: 1.8em;
  }

  .container {
    border-radius: 10px;
  }

  .main-content {
    padding: 15px;
  }
}
