/* Interフォントの読み込み */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
:root {
    --header-height: 60px; /* ヘッダーの高さの目安 */
}
body {
    font-family: 'Inter', sans-serif;
    background-color: #f0f2f5;
    padding-top: var(--header-height); /* 固定ヘッダー分のパディング */
}
.container {
    max-width: 900px;
}
.image-preview {
    width: 100%;
    height: 200px;
    background-color: #e2e8f0;
    border: 2px dashed #cbd5e0;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #64748b;
    font-size: 0.9rem;
    border-radius: 0.5rem;
    overflow: hidden;
    position: relative;
}
.image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.canvas-container { /* For crop preview */
    border: 2px solid #cbd5e0;
    border-radius: 0.5rem;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #ffffff;
    position: relative;
    width: 100%; 
    padding-top: 75%; 
}
.canvas-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

#overlayCanvasFixedContainer { /* For final overlay preview */
    width: 100%; 
    max-width: 513px; 
    height: auto; 
    aspect-ratio: 1 / 1; 
    border: 2px solid #cbd5e0;
    border-radius: 0.5rem;
    overflow: hidden;
    display: flex; 
    justify-content: center;
    align-items: center;
    background-color: #ffffff; 
    position: relative; 
    margin-left: auto;  
    margin-right: auto;
}
#overlayCanvasFixedContainer canvas { 
    position: absolute;
    top: 0;
    left: 0;
    width: 100%; 
    height: 100%;
    display: block;
}

.btn-primary {
    background-color: #4f46e5; 
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease-in-out;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: none;
}
.btn-primary:hover {
    background-color: #4338ca; 
    transform: translateY(-1px);
}
.btn-primary:active {
    background-color: #3730a3; 
    transform: translateY(0);
}
.btn-secondary {
    background-color: #6b7280; 
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease-in-out;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: none;
}
.btn-secondary:hover {
    background-color: #4b5563; 
    transform: translateY(-1px);
}
.btn-secondary:active {
    background-color: #374151; 
    transform: translateY(0);
}
.input-file-label {
    display: inline-block;
    background-color: #3b82f6; 
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease-in-out;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.input-file-label:hover {
    background-color: #2563eb; 
    transform: translateY(-1px);
}
.input-file-label:active {
    background-color: #1d4ed8; 
    transform: translateY(0);
}
.input-file-label input[type="file"] {
    display: none;
}
.slider-container {
    width: 100%;
    margin-top: 1rem;
}
.slider {
    width: 100%;
    height: 8px;
    background: #d1d5db;
    border-radius: 5px;
    outline: none;
    opacity: 0.7;
    transition: opacity .2s;
    -webkit-appearance: none; 
    appearance: none;
}
.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4f46e5;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4f46e5;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.message-box {
    position: fixed;
    top: calc(var(--header-height) + 20px); /* Adjusted for fixed header */
    left: 50%;
    transform: translateX(-50%);
    background-color: #4CAF50; 
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.5s ease-in-out, top 0.3s ease-in-out;
}
.message-box.show {
    opacity: 1;
}

.crop-container {
    position: relative;
    width: 100%;
    max-width: 400px; 
    margin: 0 auto;
    border: 2px solid #cbd5e0;
    border-radius: 0.5rem;
    overflow: hidden;
    background-color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
    touch-action: none; 
}
.crop-container.dragging {
    cursor: grabbing;
}
.crop-canvas { 
    display: block;
    width: 100%; 
    height: auto; 
}
.crop-selection-box {
    position: absolute;
    border: 2px solid #3b82f6; 
    cursor: grab;
    box-sizing: border-box; 
}
.crop-selection-box:active {
    cursor: grabbing;
}
.resize-handle {
    position: absolute;
    width: 16px; 
    height: 16px;
    background-color: #3b82f6; 
    border: 1px solid white;
    border-radius: 50%;
    z-index: 10; 
}

.resize-handle.nw { top: -8px; left: -8px; cursor: nw-resize; }
.resize-handle.ne { top: -8px; right: -8px; cursor: ne-resize; }
.resize-handle.sw { bottom: -8px; left: -8px; cursor: sw-resize; }
.resize-handle.se { bottom: -8px; right: -8px; cursor: se-resize; }

.circular-mask-selection-box {
    position: absolute;
    border: 2px dashed #ef4444; 
    border-radius: 50%; 
    cursor: grab;
    box-sizing: border-box;
    z-index: 5; 
}
.circular-mask-selection-box:active {
    cursor: grabbing;
}
.circular-mask-resize-handle {
    position: absolute;
    width: 16px;
    height: 16px;
    background-color: #ef4444; 
    border: 1px solid white;
    border-radius: 50%;
    z-index: 10;
    cursor: se-resize; 
    bottom: -8px;
    right: -8px;
}

.thumbnails-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    min-height: 80px;
    align-items: center;
    justify-content: center;
    background-color: #f8fafc;
}
.thumbnail-item {
    width: 60px;
    height: 60px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border: 2px solid transparent;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: border-color 0.2s ease-in-out, transform 0.1s ease-in-out;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    position: relative;
}
.thumbnail-item:hover {
    border-color: #93c5fd; 
    transform: translateY(-1px);
}
.thumbnail-item.active {
    border-color: #3b82f6; 
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.thumbnail-item .remove-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #ef4444; 
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    border: 1px solid white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.thumbnail-item .remove-btn:hover {
    background-color: #dc2626;
}
.current-image-name {
    font-size: 0.875rem; 
    color: #4b5563; 
    margin-top: 8px;
    text-align: center;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.crop-status-message {
    color: #ef4444; 
    font-weight: 600;
    text-align: center;
    margin-bottom: 16px;
}

/* Hamburger Menu Styles */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height); /* Use CSS variable */
    background-color: #4f46e5; /* Indigo-600 */
    color: white;
    padding: 0 1rem; /* Adjusted padding */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1001; 
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.app-title {
    font-size: 1.25rem; 
    font-weight: 600;
}
.hamburger-button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    display: flex; 
    flex-direction: column;
    gap: 4px; 
}
.hamburger-button .bar {
    width: 24px;
    height: 3px;
    background-color: white;
    border-radius: 2px;
    transition: all 0.3s ease-in-out;
}
.hamburger-button.open .bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.hamburger-button.open .bar:nth-child(2) {
    opacity: 0;
}
.hamburger-button.open .bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.nav-menu {
    display: none; 
    position: absolute;
    top: var(--header-height); /* Position below the header */
    right: 0;
    background-color: #4338ca; 
    border-radius: 0 0 0 0.5rem; 
    box-shadow: -2px 2px 5px rgba(0,0,0,0.2);
    min-width: 200px;
    overflow: hidden; 
}
.nav-menu.open {
    display: block;
}
.nav-menu a {
    display: block;
    padding: 0.75rem 1.25rem; 
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out;
}
.nav-menu a:hover {
    background-color: #3730a3; 
}

/* Input number hide arrows */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
input[type=number] {
  -moz-appearance: textfield; /* Firefox */
}
