/* Custom styles for the simulator */
:root {
  --primary-color: #4f46e5;
  --border-color: #d1d5db;
  --light-gray-bg: #f9fafb;
}

body {
    font-family: 'Noto Sans JP', 'Inter', sans-serif;
    background-color: #f3f4f6;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 2rem; /* PC表示での基本の余白 */
    box-sizing: border-box;
}

.container {
    background-color: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    width: 100%;
    max-width: 1200px;
}

.simulator-area {
    display: flex; /* Default for mobile (single column) */
    flex-direction: column;
    gap: 2.5rem;
    width: 100%;
}

.preview-column {
    width: 100%;
    position: -webkit-sticky; /* Safari向け */
    position: sticky;
    top: 0; /* 画面上部からの距離 */
    z-index: 10; /* 他の要素より手前に表示させるため */
    background-color: #ffffff;
    padding: 2.5rem; /* 親要素の余白と同じ値の余白を追加 */
    box-sizing: border-box; /* 余白を含めて幅100%になるように調整 */
}

.controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.svg-container {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    overflow: hidden;
    position: relative;
}

svg.uniform-svg { /* Common class for all uniform SVGs */
    display: block;
    width: 100%;
    height: auto;
}

.control-group {
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    background-color: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.control-item {
    display: grid;
    grid-template-columns: 100px 1fr;
    align-items: center;
    gap: 1rem;
}

.control-item label, .checkbox-control label, .radio-group-label {
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
}

.view-toggle {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
    background-color: #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.25rem;
}

.view-toggle button {
    padding: 0.5rem 1rem;
    border: none;
    background-color: transparent;
    color: #4b5563;
    font-weight: 600;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}

.view-toggle button.active {
    background-color: #ffffff;
    color: #1f2937;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.color-swatch-btn {
    width: 44px;
    height: 44px;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.color-swatch-btn:hover {
    transform: scale(1.05);
}

#color-palette-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: none; /* Initially hidden */
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 1rem;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 0.75rem;
}

.palette-swatch {
    width: 40px;
    height: 40px;
    border-radius: 0.375rem;
    cursor: pointer;
    border: 1px solid #e5e7eb;
}

.category-header {
    grid-column: 1 / -1;
    font-weight: 700;
    color: #4b5563;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.25rem;
}

.category-header:first-of-type {
    margin-top: 0;
}

input[type="file"], input[type="text"], input[type="number"], select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    color: #374151;
    width: 100%;
    box-sizing: border-box; /* width 100% を維持するために追加 */
}

input:focus {
  border-color: var(--primary-color); /* #4f46e5 を var(...) に変更 */
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

input[type="file"]::file-selector-button {
    background-color: #4f46e5;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    border: none;
    cursor: pointer;
    margin-right: 0.75rem;
    transition: background-color 0.2s ease;
}

input[type="file"]::file-selector-button:hover {
    background-color: #4338ca;
}

input[type="range"]:hover { opacity: 1; }

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    cursor: pointer;
    border-radius: 50%;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #4f46e5;
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

.slider-control {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1rem;
}

.error-message {
    font-size: 0.8rem;
    color: #ef4444;
    margin-top: -0.75rem;
    grid-column: 2;
}

.radio-group {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: normal;
}

.checkbox-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    grid-column: 1 / -1;
}

.action-btn {
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s;
    border: none;
}

.action-btn:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

#notification-banner {
    position: fixed;
    top: -100px; /* Start off-screen */
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: top 0.5s ease-in-out;
    z-index: 2000;
    text-align: center;
}

#notification-banner.show {
    top: 20px;
}

#notification-banner.success {
    background-color: #28a745; /* Green */
}

#notification-banner.error {
    background-color: #dc3545; /* Red */
}

#notification-banner.info {
    background-color: #17a2b8; /* Blue */
}

/* Desktop layout: Side-by-side using CSS Grid */
@media (min-width: 1024px) {
    .simulator-area {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: flex-start;
        gap: 2.5rem;
    }
    .preview-column, .controls {
        width: auto;
    }
    .preview-column {
        top: 2rem; /* PC表示の時は少し上にスペースを空ける */
    }
}

/* ▼▼▼ スマホ表示用の設定を追加 ▼▼▼ */
@media (max-width: 767px) {
    body {
        padding: 0.5rem; /* 画面全体の左右の余白を小さくする */
    }
    .container {
        padding: 0; /* 白いコンテナ自体の余白はなくす */
        box-shadow: none; /* 影もなくす */
        border-radius: 0; /* 角丸もなくす */
    }
    .preview-column {
        padding: 1rem; /* プレビューエリアの内側の余白を調整 */
        top: 0; /* 画面の最上部に固定 */
        border-radius: 0;
    }
    .control-group {
        border-left: none;
        border-right: none;
        border-radius: 0;
    }
}