/* ============================================
   自販機リクエストシステム - スタイルシート
   ============================================ */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #f59e0b;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --sold-out: #dc2626;
    --product-req: #2563eb;
    --other: #6b7280;
}

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

body {
    font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'メイリオ', sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
}

/* === 共通レイアウト === */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 16px;
}

.container-wide {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px;
}

/* === ヘッダー === */
.header {
    background: var(--primary);
    color: white;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 16px;
    font-weight: 600;
}

.header-admin {
    background: var(--gray-900);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-admin a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 14px;
}

.header-admin a:hover {
    color: white;
}

/* === 管理画面ナビゲーション === */
.admin-nav {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 16px;
    overflow-x: auto;
    white-space: nowrap;
}

.admin-nav a {
    display: inline-block;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--gray-500);
    font-size: 14px;
    border-bottom: 2px solid transparent;
}

.admin-nav a:hover {
    color: var(--gray-900);
}

.admin-nav a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* === カード === */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 16px;
}

.card-header {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

/* === 自販機情報（購入者画面） === */
.machine-info {
    background: var(--primary);
    color: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.machine-info .machine-name {
    font-size: 20px;
    font-weight: 700;
}

.machine-info .machine-location {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 4px;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 16px; /* スマホでズームしないように16px以上 */
    font-family: inherit;
}

.form-group textarea {
    height: 100px;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* === リクエスト種別選択ボタン === */
.request-type-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.request-type-btn {
    display: block;
    padding: 16px 20px;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    background: white;
    text-decoration: none;
    color: var(--gray-900);
    font-size: 16px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s;
}

.request-type-btn:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.03);
}

.request-type-btn .type-icon {
    font-size: 24px;
    margin-right: 8px;
}

.request-type-btn .type-desc {
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: var(--gray-500);
    margin-top: 4px;
}

.request-type-btn.sold-out { border-left: 4px solid var(--sold-out); }
.request-type-btn.product-req { border-left: 4px solid var(--product-req); }
.request-type-btn.other { border-left: 4px solid var(--other); }

/* === ボタン === */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.15s;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

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

.btn-outline {
    background: white;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-outline:hover {
    background: var(--gray-50);
}

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

.btn-block {
    display: block;
    width: 100%;
}

/* === 商品選択リスト === */
.product-list {
    list-style: none;
}

.product-item {
    padding: 12px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.product-item:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.03);
}

.product-item.selected {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.08);
}

.product-item input[type="radio"] {
    margin-right: 8px;
}

.product-item .product-name {
    font-weight: 600;
}

.product-item .product-price {
    color: var(--gray-500);
    font-size: 13px;
    margin-left: 8px;
}

/* === 完了画面 === */
.complete-box {
    text-align: center;
    padding: 40px 20px;
}

.complete-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.complete-message {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.complete-sub {
    color: var(--gray-500);
    font-size: 14px;
}

/* === ダッシュボード統計 === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
}

.stat-card.sold-out .stat-value { color: var(--sold-out); }
.stat-card.product-req .stat-value { color: var(--product-req); }

/* === テーブル（管理画面） === */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    background: var(--gray-50);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-200);
    vertical-align: top;
}

.data-table tr:hover {
    background: var(--gray-50);
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* === ステータスバッジ === */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.badge-new { background: #fef3c7; color: #92400e; }
.badge-confirmed { background: #dbeafe; color: #1e40af; }
.badge-resolved { background: #d1fae5; color: #065f46; }
.badge-dismissed { background: var(--gray-100); color: var(--gray-500); }

.badge-sold-out { background: #fee2e2; color: #991b1b; }
.badge-product-req { background: #dbeafe; color: #1e40af; }
.badge-other { background: var(--gray-100); color: var(--gray-700); }

/* === ランキング === */
.ranking-list {
    list-style: none;
}

.ranking-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
}

.ranking-rank {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    margin-right: 12px;
    flex-shrink: 0;
}

.ranking-rank.top { background: var(--warning); color: white; }

.ranking-name {
    flex: 1;
    font-weight: 600;
}

.ranking-count {
    font-weight: 700;
    color: var(--primary);
}

/* === アラート === */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-info { background: #dbeafe; color: #1e40af; }

/* === フィルタ === */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-bar select {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    background: white;
}

/* === 空状態 === */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* === ログイン画面 === */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
}

.login-box {
    background: white;
    padding: 32px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 24px;
}

/* === ユーティリティ === */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--gray-500); }

/* === レスポンシブ === */
@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filter-bar {
        flex-direction: column;
    }
    
    .filter-bar select {
        width: 100%;
    }
}
