/* 管理画面用CSS - まっくる屋工房テーマ */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

/* モバイルでのビューポート高さの安定化 */
:root {
    --vh: 1vh;
}

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

body {
    font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Meiryo', sans-serif;
    background-color: #f9f8f6;
    color: #4E2700;
    line-height: 1.6;
    background-image: linear-gradient(45deg, #f9f8f6 25%, transparent 25%), 
                      linear-gradient(-45deg, #f9f8f6 25%, transparent 25%), 
                      linear-gradient(45deg, transparent 75%, #f9f8f6 75%), 
                      linear-gradient(-45deg, transparent 75%, #f9f8f6 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    margin: 0;
    padding: 0;
    height: 100vh;
}

.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
    margin: 0;
    padding: 0;
}

.no-scroll {
    overflow: hidden;
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
}

/* Header */
header {
    position: relative;
    display: flex;
    justify-content: flex-end; /* space-betweenから変更 */
    align-items: center;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

header h1 {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
}

.btn-logout {
    display: inline-block;
    padding: 10px 20px;
    background-color: #f44336;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.btn-logout:hover {
    background-color: #d32f2f;
}

/* Login Form */
.login-container {
    background: #EAE4D5;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(78, 39, 0, 0.15);
    max-width: 400px;
    margin: 0;
    border: 3px solid #D4C4A8;
    position: relative;
    text-align: center; /* 中央揃えを追加 */
}

.login-container::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(45deg, #D4C4A8, #EAE4D5, #D4C4A8);
    border-radius: 15px;
    z-index: -1;
}

.login-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #4E2700;
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: 0.1em;
}

.home-button-container {
    margin-top: 25px;
    text-align: center;
}

.btn-home {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(135deg, #D4C4A8, #C8B99C);
    color: #4E2700;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    letter-spacing: 0.05em;
    transition: all 0.3s;
    border: 2px solid #B8A082;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-home:hover {
    background: linear-gradient(135deg, #C8B99C, #D4C4A8);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.error {
    color: #D32F2F;
    background-color: #FFCDD2;
    border: 1px solid #D32F2F;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4E2700;
    font-size: 1.1rem;
    letter-spacing: 0.05em;
}

.form-group input {
    width: 100%;
    padding: 14px;
    border: 2px solid #C8B99C;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
    background: #F5F2ED;
    color: #4E2700;
    font-weight: 500;
}

.form-group input:focus {
    outline: none;
    border-color: #8B4513;
    background: #FEFCF8;
    box-shadow: 0 0 8px rgba(139, 69, 19, 0.2);
}

/* Buttons */
button, .btn-primary, .btn-secondary, .btn-danger {
    padding: 12px 24px;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: all 0.3s;
    font-weight: 600;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button, .btn-primary {
    background: linear-gradient(135deg, #8B4513, #A0522D);
    color: white;
    border-color: #654321;
}

button:hover, .btn-primary:hover {
    background: linear-gradient(135deg, #A0522D, #8B4513);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: linear-gradient(135deg, #D4C4A8, #C8B99C);
    color: #4E2700;
    border-color: #B8A082;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #C8B99C, #D4C4A8);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-danger {
    background: linear-gradient(135deg, #D2691E, #CD853F);
    color: white;
    border-color: #B8860B;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #CD853F, #D2691E);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Admin Panel */
.admin-panel {
    background: #EAE4D5;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(78, 39, 0, 0.15);
    overflow: hidden;
    border: 3px solid #D4C4A8;
}

.admin-nav {
    background: linear-gradient(135deg, #8B4513, #A0522D);
    padding: 0;
    border-bottom: 3px solid #654321;
}

.admin-nav ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

.admin-nav li {
    flex: 1;
    border-right: 1px solid #654321;
}

.admin-nav li:last-child {
    border-right: none;
}

.admin-nav a {
    display: block;
    padding: 18px 20px;
    color: #EAE4D5;
    text-decoration: none;
    transition: all 0.3s;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-align: center;
}

.admin-nav a:hover {
    background: linear-gradient(135deg, #A0522D, #8B4513);
    color: white;
    transform: translateY(-2px);
}

.admin-content {
    padding: 30px 40px;
    background: #F5F2ED;
}

.admin-content h2 {
    color: #4E2700;
    margin-bottom: 20px;
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    border-bottom: 2px solid #D4C4A8;
    padding-bottom: 10px;
}

/* Menu Cards */
.menu-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.card {
    background: #EAE4D5;
    border: 2px solid #D4C4A8;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 6px 12px rgba(78, 39, 0, 0.15);
    transition: all 0.3s;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 48%, rgba(212, 196, 168, 0.3) 49%, rgba(212, 196, 168, 0.3) 51%, transparent 52%);
    border-radius: 10px;
    pointer-events: none;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(78, 39, 0, 0.2);
}

.card h3 {
    color: #4E2700;
    margin-bottom: 15px;
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: 0.1em;
}

.card p {
    color: #5D3A0A;
    margin-bottom: 20px;
    line-height: 1.7;
}

/* Product Management */
.product-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 3px solid #D4C4A8;
    background: #EAE4D5;
    border-radius: 8px 8px 0 0;
}

.tab-button {
    background: none;
    border: none;
    padding: 18px 25px;
    cursor: pointer;
    font-size: 16px;
    color: #7A5A3A;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    font-weight: 600;
    letter-spacing: 0.05em;
    flex: 1;
}

.tab-button.active {
    color: #4E2700;
    border-bottom-color: #8B4513;
    background: linear-gradient(135deg, #D4C4A8, #C8B99C);
}

.tab-button:hover {
    color: #4E2700;
    background: rgba(212, 196, 168, 0.5);
}

.tab-content {
    display: none;
}

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

/* Product List */
.product-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 20px;
    max-width: 100%;
}

/* レスポンシブデザイン - 商品リスト */
@media (min-width: 768px) and (max-width: 1023px) {
    .product-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) and (max-width: 1279px) {
    .product-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 最大4列に制限 */
@media (min-width: 1280px) {
    .product-list {
        grid-template-columns: repeat(4, 1fr);
    }
}

.product-item {
    background: #EAE4D5;
    border: 2px solid #D4C4A8;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 6px 12px rgba(78, 39, 0, 0.15);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    min-height: 380px; /* 最小高さを設定 */
}

.product-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(78, 39, 0, 0.2);
}

.product-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 2px solid #C8B99C;
}

/* カテゴリ別の画像サイズ設定 */
.product-item-chairs img {
    height: 290px;
}

.product-item-tables img {
    height: 210px;
}

.product-item-others img {
    height: 210px;
}

.product-item h3 {
    color: #4E2700;
    margin-bottom: 10px;
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.product-item .price {
    font-size: 1.3em;
    font-weight: 700;
    color: #8B4513;
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
}

.product-item .price::before {
    content: "¥";
}

.product-item .description {
    color: #5D3A0A;
    margin-bottom: 15px;
    line-height: 1.6;
    white-space: pre-wrap; /* 改行を保持 */
    flex-grow: 1; /* 残りのスペースを埋める */
}

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

.product-actions button {
    flex: 1;
    padding: 8px 16px;
    font-size: 14px;
}

/* Product Form */
.product-form {
    background: #F5F2ED;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    border: 2px solid #D4C4A8;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: none; /* デフォルトで非表示にする */
}

.product-form.active {
    display: block; /* activeクラスで表示する */
}

.product-form h3 {
    color: #4E2700;
    margin-bottom: 20px;
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    border-bottom: 2px solid #C8B99C;
    padding-bottom: 10px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row .form-group {
    flex: 1;
}

.form-group textarea {
    width: 100%;
    padding: 14px;
    border: 2px solid #C8B99C;
    border-radius: 8px;
    font-size: 16px;
    resize: vertical;
    min-height: 120px;
    transition: all 0.3s;
    background: #F5F2ED;
    color: #4E2700;
    font-weight: 500;
    font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Meiryo', sans-serif;
}

.form-group textarea:focus {
    outline: none;
    border-color: #8B4513;
    background: #FEFCF8;
    box-shadow: 0 0 8px rgba(139, 69, 19, 0.2);
}

.form-group select {
    width: 100%;
    padding: 14px;
    border: 2px solid #C8B99C;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s;
    background: #F5F2ED;
    color: #4E2700;
    font-weight: 500;
}

.form-group select:focus {
    outline: none;
    border-color: #8B4513;
    background: #FEFCF8;
    box-shadow: 0 0 8px rgba(139, 69, 19, 0.2);
}

/* Image Upload Container */
.image-upload-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* Image Upload */
.image-upload {
    border: 3px dashed #C8B99C;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    transition: all 0.3s;
    background: #F5F2ED;
    position: relative;
    flex: 1;
    min-width: 300px;
    height: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.image-upload::before {
    content: '📷';
    font-size: 3rem;
    display: block;
    margin-bottom: 10px;
    opacity: 0.6;
}

.image-upload:hover {
    border-color: #8B4513;
    background: #FEFCF8;
    transform: scale(1.02);
}

.image-upload.dragover {
    border-color: #8B4513;
    background: #FEFCF8;
    transform: scale(1.02);
}

.image-upload input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    top: 0;
    left: 0;
}

.upload-label {
    pointer-events: none;
    color: #5D3A0A;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.image-preview {
    flex: 1;
    max-width: 300px;
    height: 240px;
    background: #FEFCF8;
    border: 2px solid #C8B99C;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview.empty::before {
    content: '画像が選択されていません';
    color: #B8A082;
    font-style: italic;
    font-size: 14px;
}

.image-preview .image-container {
    margin: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
}

.image-preview img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #C8B99C;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 画像コンテナのスタイル */
.image-container {
    position: relative;
    display: inline-block;
    border-radius: 8px;
    overflow: hidden;
    background: #F5F2ED;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.image-container:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.image-container img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border: 2px solid #C8B99C;
    border-radius: 8px;
    margin: 0;
    display: block;
}

/* 画像ラベルのスタイル */
.image-label {
    background: rgba(78, 39, 0, 0.9);
    color: white;
    padding: 5px 8px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.05em;
}

/* 削除ボタンのスタイル */
.image-delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(210, 105, 30, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.image-delete-btn:hover {
    background: rgba(205, 133, 63, 0.9);
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
}

/* 既存の画像と新しい画像を区別するスタイル */
.existing-image {
    border-color: #8B4513;
}

.existing-image .image-label {
    background: rgba(139, 69, 19, 0.9);
}

.new-image {
    border-color: #228B22;
}

.new-image .image-label {
    background: rgba(34, 139, 34, 0.9);
}

/* Messages */
.message {
    padding: 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 600;
    letter-spacing: 0.05em;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    animation: messageSlideIn 0.3s ease-out;
}

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

.message::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    border-radius: 2px;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
    line-height: 1.5;
}

.message-content strong {
    display: block;
    margin-bottom: 5px;
    font-size: 1.1em;
}

.message-content span {
    display: block;
    font-weight: 400;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message-close {
    background: none;
    border: none;
    font-size: 18px;
    color: inherit;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
    flex-shrink: 0;
    box-shadow: none;
}

.message-close:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
}

.message.success {
    background-color: #E8F5E8;
    color: #2D5A2D;
    border: 2px solid #A0D0A0;
}

.message.success::before {
    background-color: #4CAF50;
}

.message.success .message-close:hover {
    background: rgba(45, 90, 45, 0.1);
}

.message.error {
    background-color: #FFF0E8;
    color: #8B4513;
    border: 2px solid #D2691E;
}

.message.error::before {
    background-color: #D2691E;
}

.message.error .message-close:hover {
    background: rgba(139, 69, 19, 0.1);
}

/* メッセージの詳細情報用のスタイル */
.message-details {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 0.9em;
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    body {
        background-size: 15px 15px;
        background-position: 0 0, 0 7px, 7px -7px, -7px 0px;
        height: 100vh;
        height: -webkit-fill-available;
    }
    
    .login-page {
        height: 100vh;
        height: -webkit-fill-available;
        padding: 20px 0;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .login-container {
        padding: 30px 20px;
        margin: auto 20px;
    }
    
    .admin-content {
        padding: 20px 15px;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .admin-nav ul {
        flex-direction: column;
    }
    
    .admin-nav a {
        padding: 15px 20px;
        border-right: none;
        border-bottom: 1px solid #654321;
    }
    
    .admin-nav li:last-child a {
        border-bottom: none;
    }
    
    .product-list {
        grid-template-columns: 1fr;
    }
    
    .product-item {
        min-height: 350px; /* モバイル用に高さを調整 */
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .product-tabs {
        flex-direction: column;
    }
    
    .tab-button {
        border-bottom: none;
        border-right: 3px solid transparent;
    }
    
    .tab-button.active {
        border-right-color: #8B4513;
    }
    
    .card {
        padding: 20px;
    }
    
    .image-upload {
        padding: 30px 20px;
    }
    
    .image-upload-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .image-preview {
        max-width: none;
        min-height: 150px;
    }
    
    .message {
        padding: 15px;
        gap: 10px;
        font-size: 14px;
    }
    
    .message-content strong {
        font-size: 1em;
    }
    
    .message-close {
        width: 20px;
        height: 20px;
        font-size: 16px;
    }
} 

/* 商品追加ボタンのスタイル */
.add-product-item {
    background: #EAE4D5;
    border: 2px solid #D4C4A8;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 6px 12px rgba(78, 39, 0, 0.15);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    min-height: 380px;
    cursor: pointer;
    position: relative;
}

.add-product-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(78, 39, 0, 0.2);
}

.add-product-btn {
    padding: 15px 20px;
    border: 2px solid #B8A082;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    transition: all 0.3s;
    font-weight: 600;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #D4C4A8, #C8B99C);
    color: #4E2700;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    line-height: 1.3;
}

.add-product-btn:hover {
    background: linear-gradient(135deg, #C8B99C, #D4C4A8);
    transform: translate(-50%, -50%) translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.add-product-btn::before {
    content: '+\A';
    font-size: 20px;
    font-weight: bold;
    white-space: pre;
    display: block;
    margin-bottom: 3px;
}

/* フォームを閉じるボタンのスタイル */
.btn-close {
    background: linear-gradient(135deg, #757575, #616161);
    color: white;
    border: 2px solid #424242;
    margin-left: 10px;
}

.btn-close:hover {
    background: linear-gradient(135deg, #616161, #757575);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
} 