/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: hsl(0 0% 100%);
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid hsl(0 0% 89.8%);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: hsl(0 0% 3.9%);
}

.modal-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: hsl(0 0% 45.1%);
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: hsl(0 0% 96.1%);
    color: hsl(0 0% 3.9%);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 24px;
    border-top: 1px solid hsl(0 0% 89.8%);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: hsl(0 0% 3.9%);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid hsl(0 0% 89.8%);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: hsl(0 0% 3.9%);
    background: hsl(0 0% 100%);
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: hsl(0 0% 9%);
    box-shadow: 0 0 0 3px hsla(0, 0%, 0%, 0.05);
}

.form-help {
    font-size: 13px;
    color: hsl(0 0% 45.1%);
    margin-top: 6px;
}

.alert {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-warning {
    background: hsla(38, 92%, 50%, 0.1);
    color: hsl(38, 92%, 40%);
    border: 1px solid hsl(38, 92%, 50%);
}

.alert svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.alert strong {
    font-weight: 600;
}

.api-key-display {
    margin-top: 20px;
}

.api-key-display label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: hsl(0 0% 3.9%);
    margin-bottom: 8px;
}

.api-key-display-value {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: hsl(0 0% 96.1%);
    border: 1px solid hsl(0 0% 89.8%);
    border-radius: 8px;
}

.api-key-display-value code {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: hsl(0 0% 3.9%);
    word-break: break-all;
}

.api-key-display-value .copy-btn {
    flex-shrink: 0;
}

/* Empty and Loading States */
.empty-state {
    text-align: center;
    padding: 24px;
    color: hsl(0 0% 45.1%);
}

.empty-state svg {
    width: 32px;
    height: 32px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state p:first-of-type {
    font-size: 14px;
    font-weight: 500;
    color: hsl(0 0% 3.9%);
    margin-bottom: 4px;
}

.empty-state-text {
    font-size: 13px;
    color: hsl(0 0% 45.1%);
}

.loading-message {
    text-align: center;
    padding: 48px 24px;
    color: hsl(0 0% 45.1%);
    font-size: 14px;
}

.error-message {
    text-align: center;
    padding: 48px 24px;
    color: hsl(0, 84%, 60%);
    font-size: 14px;
    background: hsla(0, 84%, 60%, 0.1);
    border-radius: 8px;
}

/* Animations for API key items */
.api-key-item {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Log Modal Styles (from logs.css) */
.log-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.log-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.log-modal {
    background: hsl(0 0% 100%);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: scale(0.95);
    transition: transform 0.2s;
    border: 1px solid hsl(0 0% 89.8%);
}

.log-modal-overlay.show .log-modal {
    transform: scale(1);
}

.log-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid hsl(0 0% 89.8%);
}

.log-modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: hsl(0 0% 3.9%);
    margin: 0;
}

.log-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    color: hsl(0 0% 45.1%);
    transition: background 0.15s, color 0.15s;
}

.log-modal-close:hover {
    background: hsl(0 0% 96.1%);
    color: hsl(0 0% 3.9%);
}

.log-modal-close svg {
    width: 1rem;
    height: 1rem;
}

.log-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(80vh - 60px);
}

/* Create API Key Form */
.create-key-form {
    margin: 20px 0;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }

    to {
        opacity: 1;
        max-height: 200px;
    }
}

/* Image Zoom Modal */
.image-zoom-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

.image-zoom-modal.show {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.zoom-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-content img {
    max-width: 100%;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.zoom-close {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10000;
}

.zoom-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.zoom-close svg {
    width: 24px;
    height: 24px;
}

/* Zoomable cursor */
.zoomable {
    cursor: zoom-in;
    transition: transform 0.2s ease;
}

.zoomable:hover {
    transform: scale(1.02);
}

@media (max-width: 768px) {
    .zoom-close {
        top: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }

    .zoom-close svg {
        width: 20px;
        height: 20px;
    }

    .image-zoom-modal {
        padding: 1rem;
    }
}

.form-card {
    background: hsl(0 0% 98%);
    border: 1px solid hsl(0 0% 89.8%);
    border-radius: 12px;
    padding: 20px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 16px;
}

/* Success Banner */
.api-key-success-banner {
    margin-bottom: 24px;
    padding: 16px;
    background: hsla(142, 76%, 36%, 0.1);
    border: 1px solid hsl(142, 76%, 36%);
    border-radius: 12px;
}

.alert-success {
    background: none;
    border: none;
    padding: 0;
    margin-bottom: 16px;
    color: hsl(142, 76%, 30%);
}

.new-api-key-display label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: hsl(0 0% 3.9%);
    margin-bottom: 8px;
}

/* Messages */
.messages {
    margin-bottom: 20px;
}

.messages .alert {
    margin-bottom: 12px;
}

.alert-error {
    background: hsla(0, 84%, 60%, 0.1);
    color: hsl(0, 84%, 50%);
    border: 1px solid hsl(0, 84%, 60%);
}

/* Color Picker Panel */
.color-picker-panel {
    background: hsl(0 0% 98%);
    border: 1px solid hsl(0 0% 89.8%);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.color-picker-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: hsl(0 0% 3.9%);
    margin-bottom: 12px;
}

.color-picker-label svg {
    width: 18px;
    height: 18px;
}

.color-picker-options {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.color-preset {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 2px solid hsl(0 0% 89.8%);
    border-radius: 8px;
    background: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-preset:hover {
    transform: scale(1.1);
    border-color: hsl(217, 91%, 50%);
}

.color-preset.active {
    border-color: hsl(217, 91%, 50%);
    border-width: 3px;
    box-shadow: 0 0 0 2px hsla(217, 91%, 50%, 0.1);
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.transparent-pattern {
    background: repeating-conic-gradient(#f0f0f0 0% 25%, #ffffff 0% 50%) 0 0/16px 16px;
}

.color-picker-custom {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.custom-color-label {
    font-size: 13px;
    font-weight: 500;
    color: hsl(0 0% 45.1%);
}

.custom-color-input {
    width: 40px;
    height: 40px;
    border: 2px solid hsl(0 0% 89.8%);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-color-input:hover {
    transform: scale(1.1);
    border-color: hsl(217, 91%, 50%);
}

/* Image Loading Placeholder */
.image-loading-placeholder {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
            #e0e0e0 0%,
            #f0f0f0 20%,
            #e0e0e0 40%,
            #e0e0e0 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: inherit;
    z-index: 1;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.comparison-item img {
    position: relative;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.comparison-item.image-loaded img {
    opacity: 1;
}

.comparison-item.image-loaded .image-loading-placeholder {
    display: none;
}

@media (max-width: 768px) {
    .color-picker-panel {
        padding: 16px;
    }

    .color-preset {
        width: 36px;
        height: 36px;
    }

    .color-swatch {
        width: 28px;
        height: 28px;
    }

    .custom-color-input {
        width: 36px;
        height: 36px;
    }

    .color-picker-custom {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }
}
/* Capture Collage Button */
.capture-collage-btn {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: rgba(26, 115, 232, 0.9);
    backdrop-filter: blur(10px);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    opacity: 0;
}

.comparison-row:hover .capture-collage-btn {
    opacity: 1;
}

.capture-collage-btn:hover {
    background: rgba(26, 115, 232, 1);
    transform: scale(1.1);
}

.capture-collage-btn:active {
    transform: scale(0.95);
}

.capture-collage-btn svg {
    width: 20px;
    height: 20px;
}

.capture-collage-btn.capturing {
    background: rgba(52, 168, 83, 0.9);
    pointer-events: none;
}

.capture-collage-btn.capturing svg {
    animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* Static Capture Button (Always Visible) */
.capture-collage-btn-static {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: hsl(217, 91%, 50%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

.capture-collage-btn-static:hover {
    background: hsl(217, 91%, 45%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.4);
}

.capture-collage-btn-static:active {
    transform: translateY(0);
}

.capture-collage-btn-static svg {
    width: 18px;
    height: 18px;
}

.capture-collage-btn-static.capturing {
    background: hsl(142, 76%, 36%);
    pointer-events: none;
}

/* Comparison Row Wrapper */
.comparison-row-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.capture-btn-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
}

.comparison-row-wrapper .comparison-row {
    margin-bottom: 0;
    flex: 1;
}

/* Capture Button Overlay */
.capture-collage-btn-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsl(217, 91%, 50%);
    color: white;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
    opacity: 0;
    pointer-events: none;
}

.comparison-item:hover .capture-collage-btn-overlay {
    opacity: 1;
    pointer-events: auto;
}

.capture-collage-btn-overlay:hover {
    background: hsl(217, 91%, 45%);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.capture-collage-btn-overlay:active {
    transform: scale(0.95);
}

.capture-collage-btn-overlay svg {
    width: 20px;
    height: 20px;
}

.capture-collage-btn-overlay.capturing {
    background: hsl(142, 76%, 36%);
    pointer-events: none;
    opacity: 1;
}
