/* ==========================================
   TWIBBON GENERATOR - SHADCN STYLE
   Color Palette: #F5A337 (Amber) & #0D726C (Teal)
   ========================================== */

/* CSS Variables */
:root {
    /* Brand Colors */
    --primary: #0D726C;
    --primary-foreground: #ffffff;
    --primary-hover: #095752;

    --secondary: #F5A337;
    --secondary-foreground: #1a1a1a;
    --secondary-hover: #e6932a;

    /* Neutral Colors */
    --background: #ffffff;
    --foreground: #0f172a;

    --card: #ffffff;
    --card-foreground: #0f172a;

    --muted: #f1f5f9;
    --muted-foreground: #64748b;
    --accent-muted: #e7eff6;

    --border: #e2e8f0;
    --input: #e2e8f0;
    --ring: #0D726C;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    /* Radius */
    --radius: 0.5rem;
    --radius-lg: 0.75rem;

    /* Transitions */
    --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Base */
html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--foreground);
    background-color: var(--muted);
    min-height: 100vh;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 70px);
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Site Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--background);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.875rem 1.5rem;
    gap: 1rem;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--foreground);
    font-size: 1.125rem;
    font-weight: 600;
}

.logo-img {
    height: 40px;
    width: auto;
}

.logo:hover {
    opacity: 0.8;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.nav-link:hover {
    color: var(--foreground);
    background-color: var(--muted);
}

.nav-link svg {
    width: 16px;
    height: 16px;
}

/* Main */
.main {
    flex: 1;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .content-grid {
        grid-template-columns: 1fr 320px;
        align-items: start;
    }
}

@media (min-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr 360px;
    }
}

/* Card */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
}

.card-title svg {
    color: var(--muted-foreground);
}

.card-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Canvas Section */
.canvas-section {
    position: sticky;
    top: 1.5rem;
}

.canvas-section .card {
    padding: 1rem;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 5;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--muted);
    cursor: move;
}

.canvas-wrapper:active {
    cursor: move;
}

.canvas-wrapper.has-image {
    cursor: move;
}

#canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Canvas Upload Overlay */
.canvas-upload-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    cursor: pointer;
    transition: all var(--transition);
    z-index: 10;
}

.canvas-upload-overlay:hover {
    background: rgba(255, 255, 255, 0.98);
}

.canvas-upload-overlay:hover .upload-icon {
    transform: scale(1.05);
    color: var(--primary);
}

.canvas-upload-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.canvas-upload-overlay.dragover {
    background: rgba(13, 114, 108, 0.1);
    border: 2px dashed var(--primary);
}

.canvas-upload-overlay.dragover .upload-icon {
    transform: scale(1.1);
    color: var(--primary);
    background: rgba(13, 114, 108, 0.15);
}

.upload-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
    padding: 2rem;
}

.upload-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: var(--muted);
    border-radius: 50%;
    color: var(--muted-foreground);
    transition: all var(--transition);
}

.upload-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--foreground);
}

.upload-hint {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}

/* Controls Section */
.controls-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Tabs - Mobile Only (Shadcn Style) */
.tabs-list {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: stretch;
    gap: 0.25rem;
    background-color: var(--accent-muted);
    padding: 0.25rem;
    border-radius: var(--radius-lg);
    height: 2.5rem;
}

.tab-trigger {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    height: 100%;
    padding: 0 0.75rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    background-color: transparent;
    border: none;
    border-radius: calc(var(--radius-lg) - 4px);
    cursor: pointer;
    transition: all var(--transition);
}

.tab-trigger:hover {
    color: var(--foreground);
}

.tab-trigger:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

.tab-trigger.active {
    color: var(--foreground);
    background-color: var(--background);
    box-shadow: var(--shadow-sm);
}

.tabs-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Desktop: Show all tabs content, hide tab triggers */
@media (min-width: 768px) {
    .tabs-list {
        display: none;
    }

    .tab-panel {
        display: block !important;
    }
}

/* Delete Photo Button */
.btn-delete-photo {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-md);
}

.btn-delete-photo:hover {
    background: #fef2f2;
    border-color: #ef4444;
    color: #ef4444;
}

.btn-delete-photo.hidden {
    opacity: 0;
    pointer-events: none;
}

/* File Input (hidden) */
.file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.file-upload-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    transition: color var(--transition);
}

.file-upload:hover .file-upload-content {
    color: var(--primary);
}

.file-name {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    text-align: center;
}

/* Slider */
.slider-container {
    width: 100%;
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--muted);
    border-radius: 999px;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--secondary);
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 0 0 3px var(--background), var(--shadow-md);
    transition: transform var(--transition);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.slider::-webkit-slider-thumb:active {
    cursor: grabbing;
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--secondary);
    border: none;
    border-radius: 50%;
    cursor: grab;
    box-shadow: 0 0 0 3px var(--background), var(--shadow-md);
}

.slider::-moz-range-track {
    background: var(--muted);
    height: 6px;
    border-radius: 999px;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.6875rem;
    color: var(--muted-foreground);
}

.zoom-value {
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: ui-monospace, monospace;
    color: var(--primary);
    background: rgba(13, 114, 108, 0.1);
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius);
}

/* Position Control */
.position-control {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.position-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}

.position-value {
    font-size: 0.8125rem;
    font-weight: 600;
    font-family: ui-monospace, monospace;
    color: var(--primary);
    background: rgba(13, 114, 108, 0.1);
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius);
    min-width: 48px;
    text-align: center;
}

.btn-reset-small {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-reset-small:hover {
    background: var(--muted);
    border-color: var(--primary);
    color: var(--primary);
}

.hint {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    text-align: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    height: 36px;
    padding: 0 1rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-lg {
    height: 44px;
    padding: 0 1.5rem;
    font-size: 0.9375rem;
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-outline {
    background: transparent;
    color: var(--foreground);
    border: 1px solid var(--border);
    width: 100%;
}

.btn-outline:hover {
    background: var(--muted);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-sm {
    height: 32px;
    padding: 0 0.75rem;
    font-size: 0.8125rem;
}

/* Toggle Button */
.btn-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.75rem;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-toggle:hover {
    border-color: var(--primary);
}

.btn-toggle.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-foreground);
}

.toggle-label {
    pointer-events: none;
}

/* Mosaic Controls */
.mosaic-controls {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity var(--transition);
}

.mosaic-controls.active {
    opacity: 1;
    pointer-events: auto;
}

.mosaic-actions {
    display: flex;
    gap: 0.5rem;
}

.mosaic-actions .btn {
    flex: 1;
}

.mosaic-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem;
    background: rgba(13, 114, 108, 0.05);
    border-radius: var(--radius);
    color: var(--primary);
}

.mosaic-hint svg {
    flex-shrink: 0;
}

/* Mosaic Mode Canvas */
.canvas-wrapper.mosaic-mode {
    cursor: crosshair;
}

.canvas-wrapper.mosaic-mode:active {
    cursor: crosshair;
}

/* Mosaic Active Indicator */
#mosaicCard.mosaic-active {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

/* Footer */
.footer {
    margin-top: 3rem;
    padding: 1.5rem 0;
    text-align: center;
    border-top: 1px solid var(--border);
}

.footer p {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    z-index: 1000;
    opacity: 0;
    transition: all 300ms ease;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: var(--foreground);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--background);
}

.toast-icon {
    color: #22c55e;
}

/* Focus */
*:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
}

/* Selection */
::selection {
    background: rgba(13, 114, 108, 0.2);
}

/* Responsive */
@media (max-width: 767px) {
    .canvas-section {
        position: relative;
        top: 0;
    }
}