/* ShURL - リニューアルスタイル (Light & Clean) */
:root {
    --primary-color: #4f46e5;      /* 鮮やかなインディゴ */
    --primary-hover: #4338ca;
    --bg-body: #f8fafc;            /* 明るい背景色 */
    --bg-card: #ffffff;            /* カード背景 */
    --text-main: #334155;          /* 濃いグレー */
    --text-muted: #64748b;         /* 薄いグレー */
    --border-color: #e2e8f0;       /* 薄い枠線 */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --radius-md: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 60px 20px;
}

h1 {
    font-size: 2.2rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 8px;
    color: #1e293b;
    letter-spacing: -0.02em;
}

.subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 40px;
    font-size: 1rem;
}

/* カードデザイン（共通） */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

/* 入力フィールド */
label {
    display: block;
    font-size: 0.9rem;
    color: #475569;
    margin-bottom: 8px;
    font-weight: 600;
}

input[type="text"],
input[type="url"],
input[type="datetime-local"],
input[type="time"],
input[type="date"],
select {
    width: 100%;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    color: #1e293b;
    font-size: 1rem;
    outline: none;
    transition: all 0.2s ease;
    appearance: none; /* ブラウザ標準スタイルをリセット */
}

/* 入力フォーカス時のスタイル */
input:focus, select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.input-group {
    margin-bottom: 24px;
}

/* チェックボックスエリア */
.checkbox-group {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 16px;
    background: #f1f5f9;
    border-radius: var(--radius-sm);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #334155;
    font-weight: 500;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

/* オプションパネル（隠しエリア） */
.option-panel {
    display: none;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-bottom: 24px;
}

.option-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ボタン（共通） */
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.2;
}

.btn:active {
    transform: translateY(1px);
}

/* メインボタン */
.btn-primary {
    background: var(--primary-color);
    color: #fff;
    width: 100%;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

/* 結果表示エリア */
.result {
    display: none;
    background: #f0fdf4; /* 薄い緑 */
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-md);
    padding: 24px;
    margin-top: 32px;
    text-align: center;
    animation: slideUp 0.3s ease;
}

.result.active {
    display: block;
}

.result p {
    color: #15803d;
    font-weight: 600;
    margin-bottom: 8px;
}

.result-url {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #166534;
    word-break: break-all;
    margin: 12px 0 20px 0;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.btn-copy {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 10px 24px;
    font-size: 0.9rem;
    box-shadow: var(--shadow-sm);
}

.btn-copy:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}

/* A/Bテストセクション */
.ab-section {
    display: none;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.ab-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* 2カラムレイアウト用 */
.select-row {
    display: flex;
    gap: 16px;
    align-items: end;
}
.select-row > * {
    flex: 1;
}

/* エラーメッセージ */
.error-msg {
    color: #dc2626;
    background: #fef2f2;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 16px;
    display: none;
    text-align: center;
    border: 1px solid #fecaca;
}

.error-msg.active {
    display: block;
}

/* ====== 管理画面 (admin.php) 用スタイル ====== */
.admin-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
}

.admin-container h1 {
    font-size: 1.8rem;
}

/* 検索バー */
.search-bar {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 0;
}

.search-bar .input-group {
    margin-bottom: 0;
}

/* テーブルスタイル */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    padding: 0; /* カードのパディングをリセット */
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    background: #fff;
}

th {
    background: #f1f5f9;
    color: #475569;
    padding: 14px 16px;
    text-align: left;
    font-weight: 700;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: middle;
}

tr:hover td {
    background: #f8fafc;
}

/* URLセルの調整 */
.url-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #64748b;
}

/* ステータスバッジ */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-active { background: #dcfce7; color: #166534; }
.badge-expired { background: #fee2e2; color: #991b1b; }
.badge-used { background: #fef3c7; color: #92400e; }
.badge-onetime { background: #e0e7ff; color: #3730a3; }

.counter {
    font-weight: 700;
    color: var(--primary-color);
    font-family: monospace;
    font-size: 1rem;
}

/* ページネーション */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 32px;
}

.pagination a, .pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: 6px;
    font-size: 0.9rem;
    text-decoration: none;
    font-weight: 500;
}

.pagination a {
    background: #fff;
    border: 1px solid #cbd5e1;
    color: #64748b;
    transition: all 0.2s;
}

.pagination a:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #334155;
}

.pagination .current {
    background: var(--primary-color);
    border: 1px solid var(--primary-color);
    color: #fff;
}

/* 戻るリンク */
.admin-container p a {
    display: inline-block;
    color: var(--primary-color);
    font-weight: 600;
    margin-top: 16px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.admin-container p a:hover {
    background: #e0e7ff;
}

/* アニメーション定義 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .container, .admin-container {
        padding: 30px 16px;
    }
    
    .card {
        padding: 24px 16px;
    }

    .checkbox-group {
        flex-direction: column;
        gap: 12px;
    }
    
    .search-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .select-row {
        flex-direction: column;
        gap: 0;
    }
}