/* Unified CSS - Shared styles for all modes */

/* Base Styles */
body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Header Styles */
.sylph-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.04);
    height: 64px;
    display: flex;
    align-items: center;
}

.sylph-header.embedded {
    /* Styles when embedded in main site */
}

.header-content {
    display: flex;
    align-items: center;
    padding: 0 2%;
    width: 100%;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-right: auto;
    cursor: pointer;
    text-decoration: none;
}

.logo-section img {
    height: 2.5rem;
    width: 2.5rem;
}

.logo-section h1 {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
    font-weight: 600;
    font-size: 1.375rem;
    color: #1d1d1f;
    margin: 0;
}

.home-arrow {
    margin-left: auto;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #86868b;
    text-decoration: none;
    font-size: 0.875rem;
    white-space: nowrap;
    font-weight: 600;
}

.home-arrow:hover {
    color: #1d1d1f;
    background: rgba(0, 0, 0, 0.04);
}

/* Header Mode Tabs */
.header-mode-tabs {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
    align-items: center;
}

.header-mode-tab {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    color: #666;
    transition: all 0.2s;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
}

.header-mode-tab:hover {
    background: rgba(0, 122, 255, 0.1);
    color: #007aff;
}

.header-mode-tab.active {
    background: rgba(0, 122, 255, 0.15);
    color: #007aff;
}

/* Shader Enable Slider */
.shader-slider-container {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    margin-top: 0.5rem;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 6px;
    width: 100%;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
    visibility: visible !important;
    opacity: 1 !important;
}

.shader-slider-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
    white-space: nowrap;
}

.shader-toggle-switch {
    position: relative;
    display: inline-block !important;
    width: 50px;
    height: 24px;
    visibility: visible !important;
    opacity: 1 !important;
}

.shader-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.shader-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 24px;
}

.shader-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.shader-toggle-switch input:checked + .shader-toggle-slider {
    background-color: #007aff;
}

.shader-toggle-switch input:checked + .shader-toggle-slider:before {
    transform: translateX(26px);
}

.shader-slider-indicator {
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
    min-width: 30px;
    text-align: center;
}

.shader-slider-container:has(#shader-enable-slider:checked) .shader-slider-indicator {
    color: #007aff;
}

/* Hide shader slider in shader mode */
body.shader-mode .shader-slider-container {
    display: none !important;
}

/* Loading warning animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.loading-warning {
    animation: fadeIn 0.2s;
}

/* Shader Base Image Disabled State */
.shader-base-disabled .file-btn {
    opacity: 0.5;
    cursor: not-allowed;
    background: #ccc;
    pointer-events: auto;
}

.shader-base-disabled .file-btn:hover {
    background: #999;
}

.shader-base-notification {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    font-size: 0.875rem;
}

.shader-base-notification p {
    margin: 0 0 0.5rem 0;
    color: #856404;
}

.notification-confirm-btn,
.notification-cancel-btn {
    padding: 0.5rem 1rem;
    margin: 0.25rem 0.25rem 0 0;
    width: auto;
    font-size: 0.875rem;
}

.notification-confirm-btn {
    background: #ff3b30;
}

.notification-confirm-btn:hover {
    background: #d32f2f;
}

.notification-cancel-btn {
    background: #666;
}

.notification-cancel-btn:hover {
    background: #555;
}

/* Canvas Wrappers */
.canvas-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.canvas-wrapper.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 2;
}

.canvas-wrapper canvas {
    display: block;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 100%;
    max-height: 100%;
}

/* Main Container */
.main-container {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 64px);
    width: 100vw;
    margin-top: 64px;
    box-sizing: border-box;
    overflow: hidden;
}

/* Side Panel - Shared */
.side-panel {
    width: 400px;
    min-width: 400px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    padding-bottom: 5rem;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
}

.side-panel::-webkit-scrollbar {
    width: 8px;
}

.side-panel::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow: hidden;
    min-width: 0;
}

#card-canvas {
    display: block;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Mode Selector Tabs */
.mode-selector {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 0.5rem;
}

.sticky-mode-selector {
    position: sticky;
    top: 0;
    background: white;
    z-index: 100;
    padding-top: 1rem;
    margin-top: -1rem;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.sticky-mode-selector > div:first-child {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.sticky-mode-selector .mode-tab {
    flex: 1;
}

.mode-tab {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    color: #666;
    transition: all 0.2s;
}

.mode-tab:hover {
    background: rgba(0, 122, 255, 0.1);
    color: #007aff;
}

.mode-tab.active {
    background: rgba(0, 122, 255, 0.1);
    color: #007aff;
    border-bottom: 2px solid #007aff;
}

/* Control Panel Sections */
.control-panel {
    display: none;
}

.control-panel.active {
    display: block;
}

.control-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.control-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1d1d1f;
}

/* Common Form Controls */
select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    background: white;
    color: #333;
    font-size: 0.875rem;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.2);
}

.slider-group {
    margin-bottom: 1rem;
}

.slider-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #666;
    margin-bottom: 0.5rem;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e5e7eb;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007aff;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #007aff;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.value-display {
    font-size: 0.75rem;
    color: #999;
    text-align: right;
    margin-top: 0.25rem;
}

.file-upload {
    position: relative;
    display: inline-block;
    width: 100%;
}

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

.file-upload-label {
    display: block;
    padding: 0.75rem;
    background: #007aff;
    color: white;
    text-align: center;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.file-upload-label:hover {
    background: #0051d5;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-group label {
    font-size: 0.875rem;
    color: #333;
    cursor: pointer;
}

button {
    padding: 0.75rem 1.5rem;
    background: #007aff;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
    margin-top: 0.5rem;
}

button:hover {
    background: #0051d5;
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Loading Overlay */
#loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
}

#loading-overlay.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

