/**
 * 在庫管理システム - スタイルシート
 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f9fafb;
    --text-color: #1f2937;
    --border-color: #e5e7eb;
    --card-bg: #ffffff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

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

/* ヘッダー */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

header nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

header nav a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

header nav a:hover {
    background-color: rgba(255,255,255,0.2);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    margin-right: 1rem;
    font-size: 0.9rem;
}

/* ハンバーガーメニューボタン */
.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s;
}

/* サイドバー */
.sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    height: 100vh;
    width: 280px;
    background: white;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
    z-index: 1002;
    overflow-y: auto;
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.sidebar-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.sidebar-close:hover {
    background-color: rgba(255,255,255,0.2);
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-item:hover {
    background-color: #f3f4f6;
    border-left-color: var(--primary-color);
}

.sidebar-item.active {
    background-color: #e0e7ff;
    border-left-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar-item .icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.sidebar-logout {
    color: var(--danger-color);
}

.sidebar-logout:hover {
    background-color: #fee2e2;
    border-left-color: var(--danger-color);
}

.sidebar-divider {
    height: 1px;
    background: var(--border-color);
    margin: 1rem 0;
}

/* サイドバーオーバーレイ */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1001;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* メインコンテンツ（サイドバー対応） */
main.with-sidebar {
    margin-left: 0;
    transition: margin-left 0.3s ease;
}

/* メインコンテンツ */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 200px);
}

/* カード */
.card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* 商品詳細ページ */
.product-detail-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.product-media {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.product-images,
.product-videos {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.product-image,
.product-video {
    width: 100%;
    max-width: 500px;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.product-video {
    border: none;
}

.product-info {
    display: flex;
    flex-direction: column;
}

.product-title {
    margin-top: 0;
    font-size: 2rem;
    color: var(--text-color);
}

.product-code {
    font-size: 1.1rem;
    color: #6b7280;
    margin-bottom: 1rem;
}

.product-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.product-description {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.product-description h3 {
    margin-top: 0;
    color: var(--primary-color);
}

.product-description p {
    white-space: pre-wrap;
    line-height: 1.8;
}

.card h2 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1.25rem;
}

/* フォーム */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

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

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

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

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

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

.btn-success:hover {
    background-color: #059669;
}

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

.btn-danger:hover {
    background-color: #dc2626;
}

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

.btn-secondary:hover {
    background-color: #4b5563;
}

/* テーブル */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
}

table thead {
    background-color: var(--primary-color);
    color: white;
}

table th,
table td {
    padding: 0.75rem;
    text-align: left;
}

table tbody tr {
    border-bottom: 1px solid var(--border-color);
}

table tbody tr:hover {
    background-color: #f9fafb;
}

table tbody tr:last-child {
    border-bottom: none;
}

/* グリッドレイアウト */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* アラート */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid var(--success-color);
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid var(--danger-color);
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid var(--primary-color);
}

/* ログインページ */
.login-container {
    max-width: 400px;
    margin: 5rem auto;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.login-container h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary-color);
}

/* 統計カード */
.stats-card {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
}

.stats-card h3 {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.stats-card .value {
    font-size: 2rem;
    font-weight: 600;
}

/* リアルタイム更新インジケーター */
.update-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success-color);
    margin-left: 0.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* フッター */
footer {
    background-color: #1f2937;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 3rem;
}

/* レスポンシブ */
@media (min-width: 769px) {
    /* デスクトップ: サイドバーを常に表示 */
    .sidebar {
        left: 0;
        position: fixed;
    }
    
    main.with-sidebar {
        margin-left: 280px;
    }
    
    /* ログイン時（サイドバー表示時）のヘッダーとフッターのマージン調整 */
    header .container.with-sidebar,
    footer .container.with-sidebar {
        margin-left: 280px;
        transition: margin-left 0.3s ease;
    }
    
    .menu-toggle {
        display: none !important;
    }
    
    .sidebar-close {
        display: none;
    }
    
    /* 商品詳細ページ: PCは2カラム */
    .product-detail-container {
        grid-template-columns: 1fr 1fr !important;
        gap: 2rem !important;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
}

@media (max-width: 768px) {
    /* モバイル: ハンバーガーメニュー */
    .menu-toggle {
        display: flex;
    }
    
    .user-info {
        font-size: 0.8rem;
        margin-right: 0.5rem;
    }
    
    header .container {
        padding: 0 15px;
    }
    
    header h1 {
        font-size: 1.2rem;
    }
    
    .grid {
        grid-template-columns: 1fr;
    }
    
    table {
        font-size: 0.875rem;
    }
    
    table th,
    table td {
        padding: 0.5rem;
    }
    
    .sidebar {
        left: -280px;
    }
    
    main.with-sidebar {
        margin-left: 0;
    }
    
    /* 商品詳細ページのレスポンシブ対応 */
    .product-detail-container {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    .product-media {
        order: 1;
    }
    
    .product-info {
        order: 2;
    }
    
    .product-title {
        font-size: 1.5rem !important;
    }
    
    .product-price {
        font-size: 1.2rem !important;
    }
}

/* ローディング */
.loading {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.close {
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
}

.close:hover {
    color: var(--text-color);
}

