/* リセットとベーススタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* コンテナとレイアウト */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ページコンテナ */
.page-container {
    display: none;
    min-height: 100vh;
    animation: fadeIn 0.3s ease-in-out;
}

.page-container.active {
    display: block;
}

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

/* ヘッダー */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
    position: relative;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.1rem;
    font-weight: 300;
    opacity: 0.9;
}

.back-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.05);
}

/* メインコンテンツ */
.main-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

/* 店舗グリッド */
.store-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.store-card {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.store-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.store-icon {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 15px;
}

.store-card h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.store-card p {
    color: #666;
    font-size: 0.9rem;
}

/* カテゴリグリッド */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    max-width: 600px;
    margin: 0 auto;
}

.category-card {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border-radius: 15px;
    padding: 40px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.category-icon {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 15px;
}

.category-card h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.category-card p {
    color: #666;
    font-size: 0.9rem;
}

/* 商品グリッド */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.product-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.product-image {
    height: 200px;
    overflow: hidden;
    position: relative;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-info {
    padding: 20px;
}

.product-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.product-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: #e74c3c;
}

/* フォームスタイル */
.form-container {
    max-width: 600px;
    margin: 0 auto;
}

.selected-info {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
}

.selected-info h3 {
    color: #333;
    margin-bottom: 15px;
    font-weight: 600;
}

.selected-product {
    display: flex;
    align-items: center;
    gap: 15px;
}

.selected-product img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
}

.product-details h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.product-details .product-price {
    font-size: 1rem;
    color: #666;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.total-amount {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    margin: 20px 0;
}

.total-amount h3 {
    font-size: 1.3rem;
    color: #333;
}

.total-amount span {
    color: #e74c3c;
    font-weight: 700;
}

/* ボタン */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.form-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

/* 管理者セクション */
.admin-section {
    text-align: center;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e9ecef;
}

.admin-btn {
    background: linear-gradient(145deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.admin-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.3);
}

/* 管理者画面の統計 */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    padding: 25px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.stat-card i {
    font-size: 2.5rem;
    color: #667eea;
}

.stat-info h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
}

.stat-info p {
    color: #666;
    font-size: 0.9rem;
}

/* 管理者コンテンツ */
.admin-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.reports-section,
.charts-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
}

.reports-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.reports-section h2,
.charts-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-weight: 600;
}

.reports-section .section-header h2 {
    margin-bottom: 0;
}

.reports-list {
    max-height: 400px;
    overflow-y: auto;
}

.report-item {
    background: white;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.report-item h4 {
    color: #333;
    font-weight: 600;
    margin-bottom: 5px;
}

.report-item p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.no-reports {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
}

.chart-container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    height: 400px;
}

/* 完了画面 */
.completion-content {
    text-align: center;
    padding: 50px 20px;
}

.success-icon {
    font-size: 4rem;
    color: #28a745;
    margin-bottom: 20px;
}

.completion-content h1 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 15px;
}

.completion-content p {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.completion-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .back-btn {
        position: static;
        transform: none;
        margin-bottom: 20px;
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }
    
    .main-content {
        padding: 20px;
        border-radius: 15px;
    }
    
    .store-grid {
        grid-template-columns: 1fr;
    }
    
    .category-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .admin-stats {
        grid-template-columns: 1fr;
    }
    
    .form-buttons {
        flex-direction: column;
    }
    
    .completion-buttons {
        flex-direction: column;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .chart-container {
        height: 300px;
    }
    
    .export-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .export-controls .form-group {
        margin-bottom: 15px;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .summary-card {
        padding: 20px;
    }
    
    .inventory-table-container {
        overflow-x: auto;
    }
    
    .inventory-table {
        min-width: 700px;
    }
    
    .products-table {
        min-width: 600px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .store-card,
    .category-card {
        padding: 20px;
    }
    
    .product-card {
        margin-bottom: 15px;
    }
    
    .selected-product {
        flex-direction: column;
        text-align: center;
    }
    
    .selected-product img {
        width: 100px;
        height: 100px;
    }
}

/* カスタムスクロールバー */
.reports-list::-webkit-scrollbar {
    width: 6px;
}

.reports-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.reports-list::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.reports-list::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 管理者タブ */
.admin-tabs {
    display: flex;
    margin-bottom: 30px;
    border-bottom: 2px solid #e9ecef;
}

.tab-btn {
    background: none;
    border: none;
    padding: 15px 25px;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.admin-tab-content {
    display: none;
}

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

/* 商品管理 */
.product-management {
    width: 100%;
}

.management-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.management-header h2 {
    color: #333;
    font-weight: 600;
}

.store-filter {
    margin-bottom: 20px;
}

.store-filter label {
    font-weight: 600;
    color: #333;
    margin-right: 10px;
}

.store-filter select {
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
}

/* 商品テーブル */
.products-table-container {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

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

.products-table th {
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
    padding: 15px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
}

.products-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.products-table tr:hover {
    background: #f8f9fa;
}

.product-image-cell img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.product-name {
    font-weight: 600;
    color: #333;
    max-width: 200px;
    word-wrap: break-word;
}

.product-price {
    font-weight: 600;
    color: #e74c3c;
}

.product-actions {
    display: flex;
    gap: 5px;
}

.btn-small {
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.btn-edit {
    background: #17a2b8;
    color: white;
}

.btn-edit:hover {
    background: #138496;
    transform: translateY(-2px);
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
    transform: translateY(-2px);
}

.no-products {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 30px;
}

/* 商品フォーム */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.form-help {
    display: block;
    margin-top: 5px;
    font-size: 0.85rem;
    color: #666;
}

.form-help i {
    color: #17a2b8;
    margin-right: 5px;
}

/* 画像プレビュー */
.image-preview {
    margin: 20px 0;
}

.preview-container {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}

.preview-container h4 {
    color: #333;
    margin-bottom: 15px;
    font-weight: 600;
}

.preview-container img {
    max-width: 200px;
    max-height: 200px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* エクスポート機能 */
.export-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.export-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-weight: 600;
}

.export-controls {
    display: flex;
    gap: 20px;
    align-items: end;
    flex-wrap: wrap;
}

.export-controls .form-group {
    margin-bottom: 0;
}

.export-controls label {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    display: block;
}

.export-controls select {
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 1rem;
    min-width: 100px;
}

.export-controls button {
    white-space: nowrap;
}

/* 在庫管理 */
.inventory-management {
    width: 100%;
}

.inventory-summary {
    margin-bottom: 30px;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.summary-card {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    padding: 25px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.summary-card.warning {
    background: linear-gradient(145deg, #fff3cd, #ffeaa7);
}

.summary-card i {
    font-size: 2.5rem;
    color: #667eea;
}

.summary-card.warning i {
    color: #e67e22;
}

.summary-info h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 5px;
}

.summary-info p {
    color: #666;
    font-size: 0.9rem;
}

/* 在庫テーブル */
.inventory-table-container {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

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

.inventory-table th {
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
    padding: 15px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
}

.inventory-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.inventory-table tr:hover {
    background: #f8f9fa;
}

.stock-quantity {
    text-align: center;
    vertical-align: middle;
}

.products-table .stock-quantity {
    font-weight: 600;
    color: #333;
}

.stock-display {
    display: inline-block;
    min-width: 40px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
}

.stock-display:hover {
    background: #f8f9fa;
    border-radius: 4px;
    padding: 2px 4px;
    cursor: pointer;
}

.stock-status {
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 15px;
    text-align: center;
}

.stock-status.stock-normal {
    background: #d4edda;
    color: #155724;
}

.stock-status.stock-low {
    background: #fff3cd;
    color: #856404;
}

.stock-status.stock-out {
    background: #f8d7da;
    color: #721c24;
}

.stock-actions {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.btn-add {
    background: #28a745;
    color: white;
}

.btn-add:hover {
    background: #218838;
}

.btn-subtract {
    background: #dc3545;
    color: white;
}

.btn-subtract:hover {
    background: #c82333;
}

/* レスポンシブ調整 */
@media (max-width: 768px) {
    .admin-tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        text-align: center;
        border-bottom: none;
        border-right: 3px solid transparent;
    }
    
    .tab-btn.active {
        border-bottom: none;
        border-right-color: #667eea;
    }
    
    .management-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .products-table-container {
        overflow-x: auto;
    }
    
    .products-table {
        min-width: 600px;
    }
    
    .products-table th,
    .products-table td {
        padding: 8px 6px;
        font-size: 0.85rem;
    }
    
    .product-name {
        max-width: 150px;
    }
}

@media (max-width: 480px) {
    .admin-tabs {
        margin-bottom: 20px;
    }
    
    .tab-btn {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
    
    .products-table th,
    .products-table td {
        padding: 6px 4px;
        font-size: 0.8rem;
    }
    
    .product-image-cell img {
        width: 40px;
        height: 40px;
    }
    
    .btn-small {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
    
    .preview-container img {
        max-width: 150px;
        max-height: 150px;
    }
}

/* アニメーション */
.product-card,
.store-card,
.category-card {
    animation: slideUp 0.3s ease-out;
}

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