/* ==========================================================================
   InstaAssistant Mobile-First Stories Studio CSS (v4 with Staff Avatars)
   ========================================================================== */

:root {
  --bg-dark: #090a10;
  --bg-card: rgba(22, 26, 42, 0.85);
  --border-glass: rgba(255, 255, 255, 0.12);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  
  --insta-gradient: linear-gradient(135deg, #833ab4 0%, #fd1d1d 50%, #fcb045 100%);
  --primary-accent: #e1306c;
  --font-family: 'Outfit', 'Noto Sans JP', sans-serif;
  --radius-md: 16px;
  --radius-sm: 10px;
}

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

body {
  background-color: #030407;
  color: var(--text-main);
  font-family: var(--font-family);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 0;
}

/* スマホ用枠組み（ラッパー） */
.mobile-app-wrapper {
  width: 100%;
  max-width: 440px;
  background: var(--bg-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

/* Header */
.mobile-header {
  height: 50px;
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(13, 16, 27, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-sparkle {
  width: 26px;
  height: 26px;
  background: var(--insta-gradient);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
}

.app-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.header-badge {
  font-size: 10px;
  background: rgba(225, 48, 108, 0.2);
  color: #f472b6;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
  border: 1px solid rgba(244, 114, 182, 0.3);
}

/* Mode Selector Section */
.mode-selector-section {
  padding: 10px 16px 2px;
}

.mode-pills {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 4px;
}

.mode-pill {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 600;
  padding: 8px 0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.mode-pill.active {
  background: var(--insta-gradient);
  color: #fff;
  box-shadow: 0 2px 10px rgba(225, 48, 108, 0.3);
}

/* Main Container */
.mobile-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  padding-bottom: 80px;
}

/* 1. Preview Section (9:16 Canvas) */
.preview-section {
  padding: 10px 16px 8px;
  display: flex;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, rgba(225, 48, 108, 0.15), transparent 70%);
}

.stories-canvas-container {
  width: 230px;
  height: 408px; /* Exact 9:16 ratio */
  border-radius: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6);
  border: 4px solid #1f2937;
  background: #000;
}

#stories-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Stories UI Overlay */
.phone-frame-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.story-top-bars .progress-bar {
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  margin-bottom: 4px;
}

.progress-bar .fill {
  width: 70%;
  height: 100%;
  background: #fff;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fff;
}

.user-row img {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid #e1306c;
}

.user-row .username {
  font-size: 9px;
  font-weight: 600;
}

.user-row .time {
  font-size: 8px;
  opacity: 0.7;
}

/* 2. Control Section & Tabs */
.control-section {
  padding: 0 16px;
}

.tab-nav {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 3px;
  margin-bottom: 10px;
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 11px;
  font-weight: 600;
  padding: 8px 4px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 14px;
  backdrop-filter: blur(12px);
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.card-title-row h3 {
  font-size: 13px;
  font-weight: 600;
  color: #f472b6;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-sparkle-sm {
  background: var(--insta-gradient);
  border: none;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
}

/* Staff Card Styling */
.staff-list-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.staff-item-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 8px 10px;
}

.staff-avatar-uploader {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}

.staff-avatar-prev {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e1306c;
}

.icon-upload-btn {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: #111;
  border: 1px solid var(--border-glass);
  color: #fff;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  cursor: pointer;
}

.staff-inputs-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.staff-name, .staff-time {
  padding: 5px 8px !important;
  font-size: 11px !important;
}

.btn-icon-del {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

/* Inputs */
.form-group {
  margin-bottom: 10px;
}

label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

input[type="text"], input[type="time"] {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 8px 12px;
  color: #fff;
  font-family: var(--font-family);
  font-size: 12px;
  outline: none;
}

input[type="text"]:focus, input[type="time"]:focus {
  border-color: #e1306c;
}

/* Upload Dropzone */
.upload-dropzone {
  border: 2px dashed rgba(225, 48, 108, 0.4);
  background: rgba(225, 48, 108, 0.05);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  margin-bottom: 10px;
}

.upload-dropzone i {
  font-size: 20px;
  color: #f472b6;
}

.upload-dropzone span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-main);
}

.hint-text {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.sample-preset-title {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.sample-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.preset-img {
  width: 100%;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
}

.preset-img.active {
  border-color: #e1306c;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 10px;
  border-radius: 10px;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.full-width {
  width: 100%;
  margin-top: 6px;
}

/* Bottom Action Bar */
.bottom-action-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 440px;
  padding: 10px 16px;
  background: rgba(13, 16, 27, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-glass);
  z-index: 100;
}

.btn-primary-action {
  width: 100%;
  background: var(--insta-gradient);
  border: none;
  color: #fff;
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 13px;
  padding: 13px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(225, 48, 108, 0.4);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 20px;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 100%;
  max-width: 340px;
  background: #131724;
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 24px;
  position: relative;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
}

.modal-icon {
  width: 48px;
  height: 48px;
  background: #10b981;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  margin: 0 auto 12px;
}

.modal-content h3 {
  font-size: 15px;
  margin-bottom: 6px;
}

.modal-content p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.launch-app-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--insta-gradient);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 12px;
  padding: 12px;
  border-radius: 10px;
}
