/* ===============================================
   Modern Page Container System
   =============================================== */

.modern-page-container {
  min-height: calc(100vh - 200px);
  background: linear-gradient(135deg, var(--bg-light) 0%, rgba(248, 250, 252, 0.8) 100%);
  padding: 2rem 1rem;
}

.modern-content-card {
  --modern-card-radius: 24px;
  --modern-card-header-gradient: var(--primary-gradient);
  --modern-card-header-accent: rgb(59, 130, 246);
  max-width: 900px;
  margin: 0 auto;
  background: var(--bg-white);
  border-radius: var(--modern-card-radius);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-light);
  overflow: hidden;
  position: relative;
}

.modern-content-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--modern-card-header-gradient);
  border-top-left-radius: var(--modern-card-radius);
  border-top-right-radius: var(--modern-card-radius);
}

.modern-card-header {
  color: white;
  padding: 2rem;
  text-align: center;
  position: relative;
  border-top-left-radius: var(--modern-card-radius);
  border-top-right-radius: var(--modern-card-radius);
  isolation: isolate;
}

.modern-card-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--modern-card-header-gradient);
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
  z-index: -1;
}

.modern-card-header::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-top: 12px solid var(--modern-card-header-accent);
}

.modern-card-header h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-family: 'Kaisei Opti', serif;
}

.modern-card-body {
  padding: 3rem 2.5rem;
}

/* ===============================================
   Modern Upload Area System
   =============================================== */

.modern-upload-area {
  border: 3px dashed var(--primary-color);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(29, 78, 216, 0.02) 0%, rgba(59, 130, 246, 0.05) 100%);
  text-align: center;
  padding: 3rem 2rem;
  margin: 2rem 0;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.modern-upload-area::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(29, 78, 216, 0.03) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modern-upload-area:hover::before,
.modern-upload-area.dragover::before {
  opacity: 1;
}

.modern-upload-area:hover,
.modern-upload-area.dragover {
  border-color: rgb(59, 130, 246);
  background: linear-gradient(135deg, rgba(29, 78, 216, 0.05) 0%, rgba(59, 130, 246, 0.1) 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(29, 78, 216, 0.15);
}

.upload-icon-modern {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  margin-bottom: 1rem;
  transition: transform 0.3s ease;
}

.modern-upload-area:hover .upload-icon-modern {
  transform: scale(1.1);
}

.upload-text-modern {
  font-size: 1.2rem;
  color: var(--text-dark);
  margin-bottom: 1.5rem;
  font-weight: 500;
}

.upload-button-modern {
  background: var(--primary-action-gradient, linear-gradient(135deg, #1e40af 0%, #2563eb 100%));
  color: white;
  border: none;
  border-radius: 12px;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px var(--primary-action-shadow, rgba(30, 64, 175, 0.28));
}

.upload-button-modern:hover {
  background: var(--primary-action-gradient-hover, linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%));
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-action-shadow-hover, rgba(30, 64, 175, 0.38));
}

/* ===============================================
   Modern Room Info System
   =============================================== */

.room-info-container {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: start;
  margin-bottom: 2rem;
}

.room-info-card {
  --room-info-header-gradient: var(--primary-gradient);
  background: var(--bg-white);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.room-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: white;
  padding: 0.55rem 0.7rem 0.55rem 1.25rem;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
  position: relative;
  isolation: isolate;
}

/* カードヘッダー右端のアイコンのみ共有ボタン */
.room-info-share-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.room-info-share-button .svg-icon,
.room-info-share-button .svg-icon svg,
.room-info-share-button svg {
  width: 19px;
  height: 19px;
  flex: none;
}

.room-info-share-button:hover,
.room-info-share-button:focus-visible {
  background: rgba(255, 255, 255, 0.34);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.28);
  transform: translateY(-1px);
  outline: none;
}

.room-info-share-button:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
}

.room-info-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--room-info-header-gradient);
  border-top-left-radius: inherit;
  border-top-right-radius: inherit;
  z-index: -1;
}

.room-info-body {
  padding: 0.25rem 0;
}

.room-info-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
}

.room-info-row:last-child {
  border-bottom: none;
}

.room-info-label {
  font-weight: 600;
  color: var(--text-medium);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 80px;
  flex-shrink: 0;
}

.room-info-value {
  color: var(--text-dark);
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
  font-size: 0.9rem;
  min-width: 0;
}

.qr-code-container {
  background: var(--bg-white);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  padding: 1.5rem;
  text-align: center;
  width: fit-content;
}

.qr-code-container img,
.qr-code-container canvas {
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ===============================================
   Modern Form Elements
   =============================================== */

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

.modern-form-label {
  display: block;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.modern-form-input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid var(--border-light);
  border-radius: 12px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: var(--bg-white);
}

.modern-form-input:focus {
  border-color: var(--primary-color);
}

.modern-form-input:focus-visible {
  outline: 3px solid transparent;
  box-shadow: var(--focus-ring-strong, 0 0 0 3px rgba(29, 78, 216, 0.22));
}

.upload-limit-status {
  margin-top: 0.75rem;
  color: var(--text-medium);
  font-size: 0.92rem;
  line-height: 1.5;
}

.upload-limit-status.is-warning {
  color: var(--status-error-text);
  font-weight: 700;
}

.modern-file-item.is-invalid {
  border-color: var(--status-error-border-soft);
  background: var(--status-error-bg);
}

.modern-file-item-note {
  display: block;
  margin-top: 0.2rem;
  color: var(--status-error-text);
  font-size: 0.82rem;
  font-weight: 700;
}

.modern-editor {
  width: 100%;
  border: 2px solid var(--primary-color);
  border-radius: 16px;
  padding: 1.5rem;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  transition: all 0.3s ease;
  background: var(--bg-white);
  min-height: 300px;
}

.modern-editor:focus {
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.modern-editor:focus-visible {
  outline: 3px solid transparent;
  box-shadow: var(--focus-ring-strong, 0 0 0 3px rgba(29, 78, 216, 0.22));
}

.modern-btn {
  background: var(--primary-action-gradient, linear-gradient(135deg, #1e40af 0%, #2563eb 100%));
  color: white;
  border: none;
  border-radius: 12px;
  padding: 0.875rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px var(--primary-action-shadow, rgba(30, 64, 175, 0.28));
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.modern-btn:hover {
  background: var(--primary-action-gradient-hover, linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%));
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-action-shadow-hover, rgba(30, 64, 175, 0.38));
  color: white;
  text-decoration: none;
}

.modern-btn-success {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.modern-btn-success:hover {
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
  color: white;
  text-decoration: none;
}

.modern-btn.modern-btn-danger {
  min-height: 2.75rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 12px;
  background: #dc2626;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.24);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modern-btn.modern-btn-danger:hover,
.modern-btn.modern-btn-danger:focus-visible {
  border-color: transparent;
  background: #b91c1c;
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.34);
  transform: translateY(-2px);
  color: white;
  text-decoration: none;
}

.modern-btn.modern-btn-danger .svg-icon,
.modern-btn.modern-btn-danger .svg-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

.owner-delete-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem;
  margin-top: 2rem;
  border: 1px solid rgba(220, 38, 38, 0.15);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(254, 242, 242, 0.6) 0%, rgba(255, 255, 255, 0.8) 100%);
  text-align: left;
  box-shadow: 0 4px 15px rgba(220, 38, 38, 0.04);
}

.owner-delete-panel--standalone {
  width: min(100%, 580px);
  margin: 2rem auto 0;
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: 16px;
  box-shadow: 0 8px 24px -8px rgba(220, 38, 38, 0.12);
}

.owner-delete-copy {
  min-width: 0;
}

.owner-delete-title {
  display: block;
  color: #991b1b;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
}

.owner-delete-description {
  display: block;
  margin-top: 0.35rem;
  color: #b91c1c;
  font-size: 0.85rem;
  line-height: 1.5;
  opacity: 0.85;
}

.owner-delete-form {
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
  margin: 0;
}

@media (max-width: 575.98px) {
  .owner-delete-panel {
    align-items: stretch;
    flex-direction: column;
    padding: 1.25rem;
    gap: 1rem;
    text-align: center;
  }

  .owner-delete-form,
  .owner-delete-form .modern-btn-danger {
    width: 100%;
  }

  .owner-delete-form .modern-btn-danger {
    justify-content: center;
  }
}

/* ===============================================
   Modern File List System
   =============================================== */

.room-usage {
  margin: 0 0 0.5rem;
}

.room-usage__text {
  font-size: 0.85rem;
  color: var(--text-medium);
  margin-bottom: 0.35rem;
}

.room-usage__bar {
  height: 6px;
  border-radius: 999px;
  background: var(--border-light);
  overflow: hidden;
}

.room-usage__bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--primary, #006d80);
  transition: width 0.3s ease, background-color 0.3s ease;
}

.room-usage.is-full .room-usage__bar-fill {
  background: #d9534f;
}

.room-usage.is-full .room-usage__text {
  color: #d9534f;
}

.modern-file-list {
  background: var(--bg-light);
  border-radius: 12px;
  border: 1px solid var(--border-light);
  max-height: 300px;
  overflow-y: auto;
  margin: 1rem 0;
}

.modern-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  transition: background-color 0.2s ease;
}

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

.modern-file-item:hover {
  background: rgba(29, 78, 216, 0.05);
}

.modern-file-name {
  font-weight: 500;
  color: var(--text-dark);
  flex-grow: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0; /* Allow shrinking */
  min-height: 2.5rem;
  line-height: 1.4;
}

.modern-file-name-info {
  flex: 1;
  min-width: 0;
}

.modern-file-name-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.modern-file-icon {
  color: var(--primary-color);
}

.modern-file-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modern-file-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-medium);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  width: 2.5rem;
  height: 2.5rem;
  line-height: 1;
  flex: 0 0 auto;
}

.modern-file-action-btn:hover {
  background: var(--border-light);
  color: var(--text-dark);
}

.modern-file-action-btn.delete:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* ===============================================
   Responsive Design for Modern Components
   =============================================== */

@media (max-width: 767.98px) {
  .modern-page-container {
    padding: 1rem 0.25rem !important;
    width: 100% !important;
  }
  
  .modern-content-card {
    border-radius: 16px !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  
  .modern-card-header {
    padding: 1.5rem 1rem !important;
  }
  
  .modern-card-header h1 {
    font-size: 1.6rem !important;
  }
  
  .modern-card-body {
    padding: 1.5rem 0.5rem !important;
  }
  
  .room-info-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .qr-code-container {
    margin: 0 auto;
  }
  
  .modern-upload-area {
    padding: 2rem 1rem;
  }
  
  .upload-icon-modern {
    font-size: 3rem;
  }
  
  .upload-text-modern {
    font-size: 1rem;
  }
  
  .modern-file-item {
    padding: 0.75rem 1rem;
  }
  
  .modern-file-name {
    font-size: 0.9rem;
  }
}
