/* ============================================================
   Acqua 自動送信システム — スタイルシート
   Acqua HP（acqua-weboffice.com）のデザインに準拠
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

/* ── リセット & 基本 ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-blue: #3498db;
    --primary-teal: #00c2cb;
    --gradient: linear-gradient(135deg, #3498db, #00c2cb);
    --gradient-hover: linear-gradient(135deg, #2980b9, #00a8b0);
    --bg-white: #ffffff;
    --bg-light: #f5f7fa;
    --bg-card: #ffffff;
    --text-dark: #1a1a2e;
    --text-body: #333333;
    --text-muted: #666666;
    --text-light: #999999;
    --border-light: #e8ecf1;
    --border-input: #d1d9e6;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --footer-bg: #1a1a2e;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 50px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Noto Sans JP', -apple-system, 'Segoe UI', sans-serif;
    color: var(--text-body);
    background: var(--bg-light);
    line-height: 1.7;
    min-height: 100vh;
}

/* ── ヘッダー ── */
.header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 28px;
    font-weight: 400;
    color: var(--text-dark);
    text-decoration: none;
    letter-spacing: 2px;
}

.logo span {
    font-size: 12px;
    color: var(--text-light);
    display: block;
    letter-spacing: 0.5px;
    font-family: 'Noto Sans JP', sans-serif;
    margin-top: -4px;
}

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

.nav a {
    text-decoration: none;
    color: var(--text-body);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    transition: var(--transition);
}

.nav a:hover {
    background: var(--bg-light);
    color: var(--primary-blue);
}

.nav a.active {
    background: var(--gradient);
    color: white;
}

/* ── メインコンテンツ ── */
.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 32px;
}

/* ── カード ── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border-light);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
}

.card-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--primary-blue);
    margin-bottom: 8px;
}

/* ── ボタン ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-pill);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: var(--gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.btn-primary:hover {
    background: var(--gradient-hover);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
}

.btn-outline:hover {
    background: var(--primary-blue);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

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

.btn-success:hover {
    background: #219a52;
}

.btn-sm {
    padding: 6px 16px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 36px;
    font-size: 16px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 6px 12px;
}

.btn-ghost:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

/* ── フォーム ── */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 16px;
    border: 1.5px solid var(--border-input);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-body);
    background: var(--bg-white);
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.form-textarea {
    min-height: 160px;
    resize: vertical;
    line-height: 1.8;
}

.form-hint {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

/* ── 統計カード ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid var(--border-light);
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-value.blue { color: var(--primary-blue); }
.stat-value.green { color: var(--success); }
.stat-value.red { color: var(--danger); }
.stat-value.teal { color: var(--primary-teal); }

.stat-label {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

/* ── テーブル ── */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    padding: 12px 16px;
    border-bottom: 2px solid var(--border-light);
    background: var(--bg-light);
}

td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

tr:hover td {
    background: rgba(52, 152, 219, 0.03);
}

/* ── ステータスバッジ ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-draft { background: #f0f0f0; color: #666; }
.badge-running { background: #e8f4fd; color: #2980b9; }
.badge-paused { background: #fef3cd; color: #856404; }
.badge-completed { background: #d4edda; color: #155724; }
.badge-error { background: #f8d7da; color: #721c24; }
.badge-cancelled { background: #f0f0f0; color: #666; }
.badge-success { background: #d4edda; color: #155724; }
.badge-failed { background: #f8d7da; color: #721c24; }

/* ── プログレスバー ── */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-light);
    border-radius: 4px;
    overflow: hidden;
    margin: 12px 0;
}

.progress-fill {
    height: 100%;
    background: var(--gradient);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
}

/* ── ステッパー（ウィザード） ── */
.stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 32px;
    gap: 0;
}

.step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    position: relative;
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-light);
    border: 2px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    transition: var(--transition);
}

.step.active .step-number {
    background: var(--gradient);
    border-color: transparent;
    color: white;
}

.step.active {
    color: var(--text-dark);
}

.step.done .step-number {
    background: var(--success);
    border-color: transparent;
    color: white;
}

.step-line {
    width: 40px;
    height: 2px;
    background: var(--border-light);
}

.step-line.done {
    background: var(--success);
}

/* ── ウィザードのステップコンテンツ ── */
.step-content {
    display: none;
}

.step-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── ファイルアップロードエリア ── */
.upload-area {
    border: 2px dashed var(--border-input);
    border-radius: var(--radius-md);
    padding: 48px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-light);
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary-blue);
    background: rgba(52, 152, 219, 0.05);
}

.upload-area .icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.upload-area .text {
    font-size: 14px;
    color: var(--text-muted);
}

.upload-area .text strong {
    color: var(--primary-blue);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    margin-top: 12px;
}

.file-info .icon {
    font-size: 24px;
}

.file-info .name {
    font-weight: 500;
    font-size: 13px;
}

.file-info .meta {
    font-size: 11px;
    color: var(--text-light);
}

/* ── アラート ── */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-info {
    background: #e8f4fd;
    color: #1a5276;
    border-left: 4px solid var(--primary-blue);
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid var(--success);
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid var(--warning);
}

/* ── モーダル ── */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    max-width: 560px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ── ドライランプレビュー ── */
.preview-card {
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border-light);
}

.preview-card .label {
    font-size: 11px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-card .value {
    font-size: 13px;
    color: var(--text-dark);
    margin-top: 2px;
}

.preview-card .body {
    font-size: 12px;
    color: var(--text-body);
    white-space: pre-wrap;
    line-height: 1.6;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
}

/* ── 送信ログ（リアルタイム） ── */
.log-container {
    max-height: 400px;
    overflow-y: auto;
    background: var(--footer-bg);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
}

.log-line {
    padding: 3px 0;
    color: #b0b0b0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.log-line.success {
    color: #2ecc71;
}

.log-line.failed {
    color: #e74c3c;
}

.log-line .time {
    color: #666;
    margin-right: 8px;
}

/* ── 空状態 ── */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-light);
}

.empty-state .icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state .title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.empty-state .desc {
    font-size: 14px;
    margin-bottom: 24px;
}

/* ── グリッド ── */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

/* ── フッター ── */
.footer {
    background: var(--footer-bg);
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    padding: 24px;
    font-size: 12px;
    margin-top: 64px;
}

/* ── ローディング ── */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── レスポンシブ ── */
@media (max-width: 768px) {
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }

    .header-inner {
        padding: 0 16px;
    }

    .main {
        padding: 16px;
    }

    .stepper {
        flex-wrap: wrap;
    }

    .step-line {
        width: 20px;
    }

    .modal {
        width: 95%;
    }
}

/* ── トースト通知 ── */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-white);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideIn 0.3s ease;
    min-width: 280px;
    border-left: 4px solid var(--primary-blue);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ── テンプレート変数ヘルプ ── */
.var-help {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.var-tag {
    padding: 3px 10px;
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-family: monospace;
    color: var(--primary-blue);
    cursor: pointer;
    transition: var(--transition);
}

.var-tag:hover {
    background: rgba(52, 152, 219, 0.1);
    border-color: var(--primary-blue);
}

/* ── その他ユーティリティ ── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.hidden { display: none; }

/* ── アコーディオン ── */
.accordion {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    overflow: hidden;
    transition: var(--transition);
}

.accordion:hover {
    border-color: rgba(52, 152, 219, 0.3);
}

.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    cursor: pointer;
    background: var(--bg-white);
    transition: var(--transition);
    user-select: none;
}

.accordion-header:hover {
    background: var(--bg-light);
}

.accordion-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.accordion-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.accordion-meta {
    display: block;
    font-size: 12px;
    color: var(--text-light);
    font-weight: 400;
    margin-top: 1px;
    font-family: 'Consolas', 'Monaco', monospace;
}

.accordion-arrow {
    font-size: 10px;
    color: var(--text-light);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.accordion.open .accordion-arrow {
    transform: rotate(180deg);
}

.accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-light);
    border-top: 0 solid var(--border-light);
}

.accordion.open .accordion-body {
    max-height: 800px;
    border-top-width: 1px;
}

.accordion-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}

.accordion-section:last-child {
    border-bottom: none;
}

.accordion-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.accordion-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 24px;
    font-size: 13px;
    color: var(--text-body);
}

.accordion-info-grid code {
    background: rgba(52, 152, 219, 0.1);
    color: var(--primary-blue);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.info-label {
    font-weight: 500;
    color: var(--text-muted);
}

.accordion-steps {
    padding-left: 20px;
    font-size: 13px;
    line-height: 1.9;
    color: var(--text-body);
}

.accordion-steps li {
    margin-bottom: 4px;
}

.accordion-steps a {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 500;
}

.accordion-steps a:hover {
    text-decoration: underline;
}

.accordion-notes {
    padding-left: 18px;
    font-size: 12px;
    line-height: 1.8;
    color: var(--text-muted);
}

.accordion-notes li {
    margin-bottom: 2px;
}

@media (max-width: 768px) {
    .accordion-info-grid {
        grid-template-columns: 1fr;
    }
}

/* Hide TinyMCE notification banner */
.tox-notifications-container {
    display: none !important;
}
