/* Kasseta AI Photo – clean professional style matching kasseta.ee */

.kasseta-ai-wrapper {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 8px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1a1a1a;
    background: transparent;
    box-sizing: border-box;
}

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

.kasseta-ai-header h2 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 600;
    color: #1e3a5f;
}

.kasseta-ai-lang-switch {
    display: flex;
    gap: 4px;
}

.lang-btn {
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.lang-btn.active {
    background: #1e3a5f;
    color: #fff;
    border-color: #1e3a5f;
}

.kasseta-ai-credits-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #f1f5f9;
    border-radius: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.credits-label {
    color: #475569;
}

#kasseta-credits-count {
    font-size: 1.2rem;
    color: #1e3a5f;
}

.free-badge {
    background: #dcfce7;
    color: #166534;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.kasseta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background 0.15s, transform 0.1s;
    text-decoration: none;
}

.kasseta-btn-primary {
    background: #1e3a5f;
    color: #fff;
}

.kasseta-btn-primary:hover {
    background: #16304f;
}

.kasseta-btn-secondary {
    background: #e2e8f0;
    color: #1e293b;
}

.kasseta-btn-secondary:hover {
    background: #cbd5e1;
}

.kasseta-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Upload zone */
.kasseta-ai-upload-zone {
    position: relative;
    border: 2px dashed #94a3b8;
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    overflow: hidden;
}

.kasseta-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
    font-size: 0;
}

.kasseta-ai-upload-zone:hover,
.kasseta-ai-upload-zone.dragover {
    border-color: #1e3a5f;
    background: #eff6ff;
}

.dropzone-inner svg {
    color: #64748b;
    margin-bottom: 12px;
}

.dropzone-inner p {
    margin: 0;
    color: #475569;
}

/* Preview */
.kasseta-ai-preview {
    margin-top: 24px;
}

.preview-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

@media (max-width: 600px) {
    .preview-images {
        grid-template-columns: 1fr;
    }
}

.preview-col {
    text-align: center;
}

.preview-col .label {
    display: block;
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 6px;
}

.preview-col img {
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f1f5f9;
}

.preview-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.kasseta-status {
    margin-top: 12px;
    text-align: center;
    min-height: 24px;
    color: #475569;
    font-size: 0.9rem;
    word-break: break-word;
    max-width: 100%;
    padding: 0 8px;
}

.kasseta-status.error {
    color: #b91c1c;
    background: #fef2f2;
    padding: 10px 12px;
    border-radius: 8px;
}

.kasseta-status.processing {
    color: #1e3a5f;
}

/* Progress bar */
.kasseta-progress {
    margin: 16px auto 8px;
    max-width: 360px;
    text-align: center;
}

.kasseta-progress-track {
    height: 10px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.kasseta-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #1e3a5f, #3b82f6);
    border-radius: 999px;
    transition: width 0.4s ease;
}

.kasseta-progress-text {
    margin-top: 6px;
    font-size: 0.85rem;
    color: #475569;
    font-weight: 600;
}

/* Modal */
.kasseta-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 16px;
}

.kasseta-modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    max-width: 640px;
    width: 100%;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: #64748b;
}

.packs-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-top: 20px;
}

.pack-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px 14px;
    text-align: center;
    position: relative;
    background: #f8fafc;
}

.pack-card.popular {
    border-color: #1e3a5f;
    background: #eff6ff;
}

.popular-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e3a5f;
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
}

.pack-name {
    font-weight: 600;
    margin-bottom: 6px;
}

.pack-credits {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.pack-photos {
    font-size: 0.85rem;
    color: #334155;
    margin-bottom: 8px;
}

.pack-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e3a5f;
    margin-bottom: 12px;
}

.login-notice {
    color: #b91c1c;
    margin-bottom: 16px;
}


.img-meta {
    margin-top: 6px;
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.35;
}

.mode-hints {
    margin: 12px 0 8px;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #475569;
}

.mode-hints p {
    margin: 4px 0;
}

.mode-hints strong {
    color: #1e3a5f;
}


/* ========== Professional animations ========== */

@keyframes kasseta-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

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

@keyframes kasseta-spin {
    to { transform: rotate(360deg); }
}

@keyframes kasseta-fade-in {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes kasseta-slide-up {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes kasseta-progress-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.35); }
    50% { box-shadow: 0 0 12px 2px rgba(59, 130, 246, 0.45); }
}

@keyframes kasseta-dots {
    0%, 20% { content: "."; }
    40% { content: ".."; }
    60%, 100% { content: "..."; }
}

.kasseta-ai-wrapper.is-processing .kasseta-btn-primary:not(:disabled) {
    pointer-events: none;
}

.kasseta-ai-wrapper.is-processing #kasseta-original {
    filter: brightness(0.97);
}

/* Result skeleton while processing */
.preview-col.result-col {
    position: relative;
    min-height: 120px;
}

.result-skeleton {
    display: none;
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    overflow: hidden;
    background: #e2e8f0;
    border: 1px solid #e2e8f0;
}

.result-skeleton.is-visible {
    display: block;
    animation: kasseta-fade-in 0.35s ease;
}

.result-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.55) 50%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: kasseta-shimmer 1.4s ease-in-out infinite;
}

.result-skeleton-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 1;
    color: #64748b;
    font-size: 0.9rem;
}

.result-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #cbd5e1;
    border-top-color: #1e3a5f;
    border-radius: 50%;
    animation: kasseta-spin 0.8s linear infinite;
}

#kasseta-result.is-ready {
    animation: kasseta-fade-in 0.5s ease;
}

/* Enhanced progress bar */
.kasseta-progress {
    margin: 18px auto 10px;
    max-width: 420px;
    text-align: center;
    animation: kasseta-slide-up 0.3s ease;
}

.kasseta-progress-track {
    height: 12px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.kasseta-progress-bar {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, #1e3a5f 0%, #3b82f6 50%, #60a5fa 100%);
    background-size: 200% 100%;
    animation: kasseta-shimmer 2s linear infinite, kasseta-progress-glow 2s ease infinite;
    transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.kasseta-progress-text {
    margin-top: 8px;
    font-size: 0.9rem;
    color: #1e3a5f;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.kasseta-progress-label {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 4px;
    animation: kasseta-pulse 1.6s ease-in-out infinite;
}

/* Status processing pulse */
.kasseta-status.processing {
    color: #1e3a5f;
    font-weight: 500;
    animation: kasseta-pulse 1.5s ease-in-out infinite;
}

/* Soft hover on upload zone */
.kasseta-ai-upload-zone {
    transition: border-color 0.25s, background 0.25s, transform 0.2s, box-shadow 0.25s;
}

.kasseta-ai-upload-zone:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(30, 58, 95, 0.08);
}

.kasseta-ai-upload-zone.dragover {
    transform: scale(1.01);
    box-shadow: 0 8px 24px rgba(30, 58, 95, 0.12);
}

/* Buttons micro-interaction */
.kasseta-btn {
    transition: background 0.15s, transform 0.12s, box-shadow 0.15s, opacity 0.15s;
}

.kasseta-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.25);
}

.kasseta-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.kasseta-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Preview images enter */
.kasseta-ai-preview {
    animation: kasseta-slide-up 0.35s ease;
}

.preview-col img {
    transition: opacity 0.3s ease, filter 0.3s ease;
}


.kasseta-btn-compress {
    background: #ecfdf5 !important;
    color: #065f46 !important;
    border: 1px solid #a7f3d0;
}

.kasseta-btn-compress:hover {
    background: #d1fae5 !important;
}


.kasseta-btn-colorize {
    background: linear-gradient(135deg, #7c3aed, #db2777) !important;
    color: #fff !important;
}

.kasseta-btn-colorize:hover:not(:disabled) {
    background: linear-gradient(135deg, #6d28d9, #be185d) !important;
}


/* Access code + history */
.kasseta-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.code-help {
    font-size: 0.9rem;
    color: #64748b;
    margin: 0 0 14px;
    line-height: 1.4;
}

.code-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.code-tab {
    flex: 1;
    padding: 8px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: #475569;
}

.code-tab.active {
    background: #1e3a5f;
    color: #fff;
    border-color: #1e3a5f;
}

.code-msg {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #065f46;
    min-height: 1.2em;
}

.code-msg.error {
    color: #b91c1c;
}

.kasseta-modal-wide {
    max-width: 720px;
}

.history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    max-height: 60vh;
    overflow-y: auto;
}

.history-item {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.2s;
}

.history-item:hover {
    box-shadow: 0 4px 14px rgba(30,58,95,0.12);
}

.history-item img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    display: block;
    background: #f1f5f9;
}

.history-item .hi-meta {
    padding: 6px 8px;
    font-size: 0.75rem;
    color: #64748b;
}

.history-item a {
    display: block;
    text-align: center;
    font-size: 0.8rem;
    padding: 4px;
    color: #1e3a5f;
    font-weight: 600;
    text-decoration: none;
}

.history-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #94a3b8;
}


.kasseta-btn .btn-cost {
    display: block;
    font-size: 0.72rem;
    font-weight: 500;
    opacity: 0.85;
    margin-top: 2px;
    letter-spacing: 0.02em;
}
.kasseta-btn-primary {
    flex-direction: column;
    line-height: 1.2;
    padding: 10px 18px;
}


.kasseta-queue {
    margin: 12px 0 16px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e3a5f;
}

.kasseta-btn-sm {
    padding: 4px 10px !important;
    font-size: 0.8rem !important;
}

.queue-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.queue-item {
    position: relative;
    width: 88px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.queue-item:hover {
    box-shadow: 0 2px 10px rgba(30,58,95,0.12);
}

.queue-item.is-active {
    border-color: #1e3a5f;
    box-shadow: 0 0 0 2px rgba(30,58,95,0.2);
}

.queue-item.is-done {
    border-color: #10b981;
}

.queue-item img {
    width: 88px;
    height: 72px;
    object-fit: cover;
    display: block;
}

.queue-item .qi-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(15,23,42,0.75);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}

.queue-item .qi-remove:hover {
    background: #b91c1c;
}

.queue-item .qi-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: 0.65rem;
    text-align: center;
    padding: 2px;
    background: rgba(16,185,129,0.9);
    color: #fff;
    font-weight: 600;
}

.queue-hint {
    margin: 8px 0 0;
    font-size: 0.8rem;
    color: #64748b;
}


.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    justify-content: center;
}
