/* ImageCraft - Figma Design Implementation */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Logo styles */
    --logo-size: 24px;
    
    /* Figma Colors */
    --white: #FFFFFF;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #374151;
    --gray-900: #111827;
    --blue-500: #3B82F6;
    --green-500: #10B981;
    --amber-500: #F59E0B;
    --red-500: #EF4444;
    --indigo-500: #6366F1;
    --violet-500: #8B5CF6;
    
    /* Figma Dimensions (from layout data) */
    --app-width: 1200px;
    --controls-width: 400px;
    --border-radius-sm: 4px;
    --border-radius: 6px;
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
    
    /* Figma Typography (from style data) */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-lg: 20px;
    --font-size-xl: 24px;
    --line-height-tight: 1.2em;
    --line-height-normal: 1.2em;
    
    /* Gradients from Figma */
    --gradient-logo: linear-gradient(135deg, #FF6B6B 0%, #4ECDC4 100%);
    --gradient-generate: linear-gradient(135deg, #3B82F6 0%, #8B5CF6 100%);
}

body {
    font-family: var(--font-family);
    background-color: var(--gray-50);
    color: var(--gray-900);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* App Container */
.app-container {
    width: var(--app-width);
    max-width: 100%;
    margin: 0 auto;
    background: var(--white);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 0 1px var(--gray-200);
    overflow: hidden; /* Prevent content from spilling outside */
}

/* App Logo Section */
.app-logo-section {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Description Section */
.description-section {
    background-color: var(--gray-50);
    border-radius: var(--border-radius-md);
    padding: 12px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.description-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--gray-900);
    line-height: var(--line-height-tight);
}

.description-text {
    font-size: var(--font-size-sm);
    font-weight: 400;
    color: var(--gray-500);
    line-height: 1.4em;
}

.logo {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    filter: invert(0%);
    cursor: pointer;
}

/* Modal styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    max-width: 480px; /* 20% more than the original 400px */
    width: 90%;
    max-height: 80vh;
    height: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--gray-500);
}

.modal-close:hover {
    color: var(--gray-900);
}

.modal-icon {
    width: 200px;
    height: 200px;
    object-fit: contain;
}

.modal-thank-you {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--gray-900);
    text-align: center;
    margin: 6px 0;
    opacity: 0;
    transform: translateY(10px);
    animation: slideIn 0.3s ease forwards;
}

/* Thank you emoji styling removed */

/* Countdown styles */
.modal-countdown {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 12px 0 0 0;
    width: 100%;
    border-top: 1px solid var(--gray-200);
    padding-top: 12px;
    justify-content: center;
}

.countdown-circle {
    position: relative;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.countdown-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.countdown-bg {
    fill: none;
    stroke: var(--gray-200);
    stroke-width: 10;
}

.countdown-progress {
    fill: none;
    stroke: var(--blue-500);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 339; /* Circumference of circle (2πr = 2π*54 ≈ 339) */
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

.countdown-number {
    position: absolute;
    font-size: 16px;
    font-weight: bold;
    color: var(--gray-900);
}

.countdown-text {
    font-size: var(--font-size-sm);
    color: var(--gray-600);
    text-align: center;
    font-weight: 500;
    margin-top: 15px;
}

/* Service Worker update notification */
.update-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--blue-500);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 9999;
    animation: slideIn 0.3s ease forwards;
    opacity: 0;
}

.update-notification p {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
}

.update-notification button {
    background-color: white;
    color: var(--blue-500);
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.update-notification button:hover {
    background-color: var(--gray-100);
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-ad-placeholder {
    width: 100%;
    min-height: 100px;
    background: var(--gray-50);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 16px 0;
    overflow: hidden;
}

/* AdSense specific styles */
.modal-ad-placeholder .adsbygoogle {
    width: 100% !important;
    min-height: 100px;
    display: block !important;
}

.modal-ad-placeholder ins {
    border-radius: var(--border-radius);
}

.logo-text {
    font-size: var(--font-size-lg);
    font-weight: 700;
    line-height: var(--line-height-tight);
    color: var(--gray-900);
}

.actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.export-button,
.clear-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border-radius: var(--border-radius-md);
    border: 1px solid;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 600;
    line-height: var(--line-height-normal);
    transition: all 0.2s ease;
}

.export-button {
    background: var(--gray-900);
    border-color: var(--gray-900);
    color: var(--white);
}

.export-button:hover {
    background: var(--gray-600);
    border-color: var(--gray-600);
}

.clear-button {
    background: var(--white);
    border-color: var(--gray-200);
    color: var(--gray-500);
}

.clear-button:hover {
    border-color: var(--gray-300);
    background: var(--gray-50);
}

.button-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main Content */
.main-content {
    display: flex;
    gap: 32px;
    padding: 32px;
    flex: 1;
    max-width: 100%;
    align-items: flex-start; /* Prevent stretching child elements */
}

/* Right-side container for preview and output panels */
.right-panels {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0; /* Prevent overflow */
}

.preview-panel,
.output-panel {
    width: 100%; /* Full width of the right-panels container */
    box-sizing: border-box; /* Include padding and border in element's total width and height */
}

/* Controls Panel */
.controls-panel {
    width: var(--controls-width);
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: fit-content; /* Allow the panel to expand to fit its content */
    height: auto; /* Let it size naturally based on content */
}

/* Section */
.section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-spacer {
    flex-grow: 1; /* Allows the spacer to push items to the top, creating space at the bottom */
    min-height: 24px; /* Minimum height for visual spacing */
}

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-title {
    font-size: var(--font-size-base);
    font-weight: 700;
    line-height: var(--line-height-tight);
    color: var(--gray-900);
}

/* Dimension Controls */
.dimension-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-label {
    font-size: var(--font-size-sm);
    font-weight: 500;
    line-height: var(--line-height-normal);
    color: var(--gray-600);
}

.input-field {
    position: relative;
}

.input-field input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 400;
    line-height: var(--line-height-normal);
    color: var(--gray-900);
    background: var(--white);
    outline: none;
    transition: border-color 0.2s ease;
}

.input-field input:focus {
    border-color: var(--blue-500);
}

.select-field {
    position: relative;
}

.select-field select {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 400;
    line-height: var(--line-height-normal);
    color: var(--gray-900);
    background: var(--white);
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.select-field select:focus {
    border-color: var(--blue-500);
}

/* Background Controls */
.background-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tab-selector {
    display: flex;
    gap: 4px;
}

.tab-button {
    flex: 1;
    height: 36px;
    padding: 0 16px;
    border-radius: var(--border-radius);
    border: 1px solid;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: var(--font-size-xs);
    font-weight: 600;
    line-height: var(--line-height-normal);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-button.active {
    background: var(--blue-500);
    border-color: var(--blue-500);
    color: var(--white);
}

.tab-button:not(.active) {
    background: var(--white);
    border-color: var(--gray-200);
    color: var(--gray-500);
}

.tab-button:not(.active):hover {
    border-color: var(--gray-300);
    background: var(--gray-50);
}

/* Tab Content */
.tab-content {
    display: none;
}

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

.color-picker-field {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-md);
    background: var(--white);
}

.color-preview {
    width: 20px;
    height: 20px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--gray-300);
    flex-shrink: 0;
}

.color-input {
    flex: 1;
    border: none;
    outline: none;
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 400;
    line-height: var(--line-height-normal);
    color: var(--gray-900);
    background: transparent;
}

.palette-button {
    width: 16px;
    height: 16px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Image Upload */
.image-upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--border-radius-md);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--gray-50);
}

.image-upload-zone:hover {
    border-color: var(--blue-400);
    background: var(--blue-50);
}

.image-upload-zone.dragover {
    border-color: var(--blue-500);
    background: var(--blue-100);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-content p {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--gray-600);
}

.upload-content small {
    font-size: var(--font-size-xs);
    color: var(--gray-500);
}

.link-text {
    color: var(--blue-600);
    text-decoration: underline;
}

.image-preview-container {
    position: relative;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    border: 1px solid var(--gray-300);
}

.image-preview {
    width: 100%;
    height: 120px;
    object-fit: contain;
    display: block;
}

.remove-image-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.remove-image-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.hidden {
    display: none !important;
}

/* Text Controls */
.text-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.textarea-field {
    position: relative;
}

.textarea-field textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 400;
    line-height: var(--line-height-normal);
    color: var(--gray-900);
    background: var(--white);
    outline: none;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.textarea-field textarea:focus {
    border-color: var(--blue-500);
}

/* Select Input */
.select-input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 400;
    line-height: var(--line-height-normal);
    color: var(--gray-900);
    background: var(--white);
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.select-input:focus {
    border-color: var(--blue-500);
}

.textarea-field textarea::placeholder {
    color: var(--gray-400);
}

/* Format Controls */
.format-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.format-options {
    display: flex;
    gap: 8px;
}

.format-option {
    flex: 1;
    height: 36px;
    padding: 0 16px;
    border-radius: var(--border-radius);
    border: 1px solid;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: var(--font-size-xs);
    font-weight: 600;
    line-height: var(--line-height-normal);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.format-option.active {
    background: var(--blue-500);
    border-color: var(--blue-500);
    color: var(--white);
}

.format-option:not(.active) {
    background: var(--white);
    border-color: var(--gray-200);
    color: var(--gray-500);
}

.format-option:not(.active):hover {
    border-color: var(--gray-300);
    background: var(--gray-50);
}

/* Scale Mode Options */
.scale-options {
    display: flex;
    gap: 8px;
}

.scale-option {
    flex: 1;
    height: 36px;
    padding: 0 16px;
    border-radius: var(--border-radius);
    border: 1px solid;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: var(--font-size-xs);
    font-weight: 600;
    line-height: var(--line-height-normal);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scale-option.active {
    background: var(--blue-500);
    border-color: var(--blue-500);
    color: var(--white);
}

.scale-option:not(.active) {
    background: var(--white);
    border-color: var(--gray-200);
    color: var(--gray-500);
}

.scale-option:not(.active):hover {
    border-color: var(--gray-300);
    background: var(--gray-50);
}

/* Generate Button */
.generate-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
    padding: 0 16px;
    border-radius: var(--border-radius-md);
    border: none;
    background: var(--gradient-generate);
    color: var(--white);
    cursor: pointer;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: 700;
    line-height: var(--line-height-tight);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.generate-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.generate-button:active {
    transform: translateY(0);
}

.generate-button:disabled {
    opacity: 0.8;
    cursor: not-allowed;
    pointer-events: none;
}

.generate-button .button-icon {
    width: 20px;
    height: 20px;
}

/* Preview Panel */
.preview-panel {
    flex: 0 0 auto; /* Don't flex grow, let height be controlled by JS */
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0; /* Prevent overflow */
    overflow: hidden;
    margin-bottom: 24px; /* Add margin to separate from output panel */
}

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

.title-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-title {
    font-size: var(--font-size-base);
    font-weight: 700;
    line-height: var(--line-height-tight);
    color: var(--gray-900);
}

.preview-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-button {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
    background: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.action-button:hover {
    border-color: var(--gray-300);
    background: var(--gray-50);
    transform: translateY(-1px);
}

/* Preview Area */
.preview-area {
    flex: 1; /* Allow it to fill available space */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 200px; /* Minimum height */
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-md);
    position: relative;
    overflow: hidden;
    padding: 16px;
    width: 100%;
}

.preview-content {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    min-height: auto; /* Changed from fixed 300px to auto */
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
    position: relative;
    overflow: hidden;
}

.preview-content.show-canvas {
    background: transparent;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    min-height: 0;
    box-shadow: none;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-content.show-sample {
    background: var(--blue-500);
}

.preview-content:hover {
    transform: scale(1.02);
}

.sample-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    overflow: hidden;
}

.sample-text {
    font-size: var(--font-size-xl);
    font-weight: 600;
    line-height: var(--line-height-normal);
    color: var(--white);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

#canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--border-radius-sm);
    object-fit: contain;
    display: block;
}

/* Preview Info */
.preview-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.info-text {
    font-size: var(--font-size-xs);
    font-weight: 400;
    line-height: var(--line-height-normal);
    color: var(--gray-500);
}

/* Output Panel */
.output-panel {
    flex: 0 0 auto; /* Don't flex grow, let height be controlled by JS */
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0; /* Prevent overflow */
    overflow: hidden;
}

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

.output-format-controls {
    margin-bottom: 24px;
}

/* Tab Content */
.tab-content {
    display: none;
}

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

/* Image Upload Styles */
.image-upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--border-radius-md);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--gray-50);
}

.image-upload-zone:hover {
    border-color: var(--blue-500);
    background: var(--blue-50, #eff6ff);
}

.image-upload-zone.dragover {
    border-color: var(--blue-500);
    background: var(--blue-50, #eff6ff);
    transform: scale(1.02);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-content svg {
    opacity: 0.6;
}

.upload-content p {
    font-size: var(--font-size-sm);
    color: var(--gray-600);
    margin: 0;
}

.link-text {
    color: var(--blue-500);
    font-weight: 500;
    cursor: pointer;
}

.link-text:hover {
    text-decoration: underline;
}

.upload-content small {
    font-size: var(--font-size-xs);
    color: var(--gray-400);
}

.image-preview-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-md);
    padding: 12px;
    background: var(--gray-50);
}

.image-preview {
    max-width: 100%;
    max-height: 120px;
    border-radius: var(--border-radius-sm);
    object-fit: contain;
}

.remove-image-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.remove-image-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.select-input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-md);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 400;
    line-height: var(--line-height-normal);
    color: var(--gray-900);
    background: var(--white);
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.select-input:focus {
    border-color: var(--blue-500);
}

/* Custom Color Picker */
.custom-color-picker {
    position: fixed;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-md);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    padding: 16px;
    width: 220px;
    z-index: 1000;
    font-family: var(--font-family);
}

.color-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.color-picker-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--gray-900);
}

.color-picker-close {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: var(--gray-400);
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.color-picker-close:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

.color-spectrum-container {
    position: relative;
    margin-bottom: 12px;
}

.color-spectrum {
    width: 100%;
    height: 120px;
    border-radius: var(--border-radius-sm);
    cursor: crosshair;
    border: 1px solid var(--gray-200);
}

.color-picker-cursor {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    transform: translate(-50%, -50%);
}

.color-hue-slider {
    position: relative;
    margin-bottom: 12px;
}

.hue-slider {
    width: 100%;
    height: 16px;
    appearance: none;
    background: linear-gradient(
        to right,
        #ff0000 0%,
        #ffff00 16.66%,
        #00ff00 33.33%,
        #00ffff 50%,
        #0000ff 66.66%,
        #ff00ff 83.33%,
        #ff0000 100%
    );
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    border: 1px solid var(--gray-200);
}

.hue-slider::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    border: 2px solid white;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.hue-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    border: 2px solid white;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.color-palette {
    margin-bottom: 12px;
}

.palette-colors {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.palette-color {
    width: 24px;
    height: 24px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: all 0.15s ease;
}

.palette-color:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.color-input-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.current-color-display {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.color-hex-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    color: var(--gray-900);
    background: var(--white);
    transition: border-color 0.15s ease;
}

.color-hex-input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.color-hex-input::placeholder {
    color: var(--gray-400);
}

/* Make color previews more interactive */
.color-preview {
    cursor: pointer;
    transition: all 0.15s ease;
}

.color-preview:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Responsive Design */
@media (max-width: 1280px) {
    .app-container {
        width: 100%;
        max-width: none;
    }
    
    .main-content {
        padding: 24px;
        gap: 24px;
    }
    
    .controls-panel {
        width: 350px;
    }
}

@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }
    
    .controls-panel,
    .right-panels,
    .preview-panel,
    .output-panel {
        width: 100%;
        min-height: auto; /* Reset fixed height for mobile */
    }
    
    .preview-area {
        flex: 0 0 400px; /* Fixed height with no growing or shrinking */
        height: 400px; /* Keep consistent height */
    }
    
    .preview-content {
        max-width: 550px;
        max-height: 400px;
        min-height: 280px;
    }
    
    #canvas {
        max-width: 100%;
        max-height: 100%;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 16px;
    }
    
    .main-content {
        padding: 16px;
        gap: 16px;
    }
    
    .logo-text {
        font-size: 16px; /* Smaller font size on small screens */
    }
    
    .actions {
        gap: 8px;
    }
    
    .export-button span,
    .clear-button span {
        display: none;
    }
    
    .preview-area {
        flex: 0 0 400px; /* Fixed height with no growing or shrinking */
        height: 400px; /* Keep consistent height */
        padding: 12px;
    }
    
    .preview-content {
        max-width: 100%;
        max-height: 480px; /* Adjusted to account for smaller padding */
        min-height: 200px;
    }
    
    #canvas {
        max-width: 100%;
        max-height: 100%;
    }
}

/* Hidden Elements */
.hidden {
    display: none !important;
}

/* Default color previews */
.bg-preview {
    background-color: #3B82F6;
}

.text-preview {
    background-color: #111827;
}

/* Focus States for Accessibility */
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--blue-500);
    outline-offset: 2px;
}

/* Smooth transitions */
* {
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

/* Loading animation for generate button */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.control-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: end;
}

@media (max-width: 768px) {
    .control-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}
