/**
 * QRFix AI Generator Styles
 * AI-Powered QR Code Generator UI
 * 
 * @package QRFix
 * @version 1.0.0
 */

/* ============================================
   CSS VARIABLES
============================================ */
:root {
    --qrfix-primary: #4A3AFF;
    --qrfix-primary-light: #897FFF;
    --qrfix-primary-dark: #3829CC;
    --qrfix-gradient: linear-gradient(180deg, #4A3AFF, #897FFF);
    --qrfix-bg: #f6f4ff;
    --qrfix-text: #1b1633;
    --qrfix-text-light: #6b7280;
    --qrfix-white: #ffffff;
    --qrfix-success: #10b981;
    --qrfix-error: #ef4444;
    --qrfix-warning: #f59e0b;
    --qrfix-border: rgba(122, 57, 255, 0.18);
    --qrfix-shadow: 0 8px 30px rgba(107, 46, 240, 0.06);
    --qrfix-radius: 14px;
    --qrfix-transition: 0.2s ease;
}

/* ============================================
   ANIMATIONS
============================================ */
@keyframes revealUp {
    from {
        transform: translateY(10px);
        opacity: 0;
    }

    to {
        transform: none;
        opacity: 1;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

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

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

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

@keyframes progressBar {
    0% {
        width: 0%;
    }

    100% {
        width: 100%;
    }
}

/* ============================================
   AI HERO SECTION
============================================ */
.ai-hero {
    padding: 84px 20px 120px;
    background: radial-gradient(600px 300px at 50% 40%, rgba(138, 100, 255, 0.10), transparent 40%),
        linear-gradient(180deg, #f6f4ff, #fff 60%);
    text-align: center;
}

.ai-hero .container {
    max-width: 900px;
    margin: 0 auto;
}

.ai-title {
    font-weight: 700;
    font-size: 49px;
    line-height: 1.05;
    margin: 0 0 10px;
    color: var(--qrfix-text);
    opacity: 0;
    animation: revealUp 0.6s ease 0.08s forwards;
    text-transform: none !important;
}



.ai-lead {
    margin: 8px 0 32px;
    color: #000;
    font-size: 20px;
    opacity: 0;
    animation: revealUp 0.6s ease 0.16s forwards;
}

/* ============================================
   AI INPUT FORM
============================================ */
.ai-prompt {
    margin: 0;
}

.ai-input-wrap {
    width: 780px;
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    border: 2px solid var(--qrfix-border);
    border-radius: var(--qrfix-radius);
    padding: 10px;
    box-shadow: var(--qrfix-shadow);
    background: var(--qrfix-white);
    opacity: 0;
    animation: revealUp 0.6s ease 0.22s forwards;
    transition: border-color var(--qrfix-transition), box-shadow var(--qrfix-transition);
}

.ai-input-wrap:focus-within {
    border-color: var(--qrfix-primary);
    box-shadow: 0 8px 40px rgba(74, 58, 255, 0.15);
}

.ai-input {
    flex: 1;
    border: 0 !important;
    outline: 0;
    font-size: 16px;
    padding: 16px 18px;
    border-radius: 10px;
    background: transparent;
    color: #111;
    font-family: inherit;
}

.ai-input::placeholder {
    color: var(--qrfix-text-light);
}

.btn-generate {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 10px;
    border: 0;
    cursor: pointer;
    background: var(--qrfix-gradient);
    color: var(--qrfix-white);
    font-weight: 700;
    font-size: 15px;
    font-family: inherit;
    box-shadow: 0 8px 20px rgba(74, 58, 255, 0.18);
    transition: transform var(--qrfix-transition), box-shadow var(--qrfix-transition);
}

.btn-generate:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 14px 28px rgba(74, 58, 255, 0.25);
}

.btn-generate:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

.btn-generate:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-generate .spark {
    transition: transform 0.25s;
}

.btn-generate:hover:not(:disabled) .spark {
    transform: rotate(18deg) scale(1.15);
    opacity: 0.95;
}

.btn-generate .spinner {
    animation: spin 1s linear infinite;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   URL INPUT SECTION
============================================ */
.ai-url-section {
    max-width: 780px;
    margin: 20px auto 0;
    opacity: 0;
    animation: revealUp 0.6s ease 0.3s forwards;
}

.ai-url-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--qrfix-white);
    border: 2px solid var(--qrfix-border);
    border-radius: 10px;
    padding: 8px 12px;
}

.ai-url-wrap label {
    font-size: 13px;
    font-weight: 600;
    color: var(--qrfix-text-light);
    white-space: nowrap;
}

.ai-url-input {
    flex: 1;
    border: 0;
    outline: 0;
    font-size: 14px;
    padding: 8px;
    background: transparent;
    color: var(--qrfix-text);
}

/* ============================================
   USAGE INDICATOR
============================================ */
.ai-usage-bar {
    max-width: 780px;
    margin: 24px auto 0;
    opacity: 0;
    animation: revealUp 0.6s ease 0.35s forwards;
}

.usage-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}

.usage-text {
    color: var(--qrfix-text-light);
}

.usage-count {
    font-weight: 700;
    color: var(--qrfix-primary);
}

.usage-track {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.usage-progress {
    height: 100%;
    background: var(--qrfix-gradient);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.usage-progress.warning {
    background: linear-gradient(90deg, var(--qrfix-warning), #fbbf24);
}

.usage-progress.danger {
    background: linear-gradient(90deg, var(--qrfix-error), #f87171);
}

/* ============================================
   RESULT SECTION
============================================ */
.ai-result-section {
    max-width: 900px;
    margin: 40px auto 0;
    display: none;
}

.ai-result-section.visible {
    display: block;
    animation: fadeIn 0.4s ease;
}

.result-container {
    background: var(--qrfix-white);
    border: 2px solid var(--qrfix-border);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--qrfix-shadow);
}

/* Loading State */
.result-loading {
    text-align: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #e5e7eb;
    border-top-color: var(--qrfix-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loading-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--qrfix-text);
    margin-bottom: 8px;
}

.loading-subtext {
    font-size: 14px;
    color: var(--qrfix-text-light);
}

.loading-progress {
    max-width: 300px;
    margin: 20px auto 0;
}

.progress-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--qrfix-gradient);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    color: var(--qrfix-text-light);
    margin-top: 8px;
}

/* Success State */
.result-success {
    text-align: center;
}

.result-image-wrap {
    max-width: 400px;
    margin: 0 auto 30px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.result-image {
    width: 100%;
    height: auto;
    display: block;
}

.result-prompt {
    font-size: 14px;
    color: var(--qrfix-text-light);
    margin-bottom: 24px;
    padding: 12px 20px;
    background: #f9fafb;
    border-radius: 8px;
    display: inline-block;
}

.result-prompt strong {
    color: var(--qrfix-text);
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.result-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--qrfix-transition);
    border: 2px solid transparent;
    font-family: inherit;
}

.result-btn.primary {
    background: var(--qrfix-gradient);
    color: var(--qrfix-white);
}

.result-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(74, 58, 255, 0.25);
}

.result-btn.secondary {
    background: var(--qrfix-white);
    color: var(--qrfix-primary);
    border-color: var(--qrfix-primary);
}

.result-btn.secondary:hover {
    background: var(--qrfix-primary);
    color: var(--qrfix-white);
}

.result-btn.success {
    background: var(--qrfix-success);
    color: var(--qrfix-white);
    border-color: var(--qrfix-success);
}

.result-btn.success:disabled {
    opacity: 1;
    cursor: default;
}

/* Dynamic Badge */
.dynamic-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 14px;
    color: #065f46;
}

.dynamic-badge .badge-icon {
    font-size: 18px;
}

.dynamic-badge .badge-text {
    color: #047857;
}

.dynamic-badge a {
    color: var(--qrfix-primary);
    font-weight: 600;
    text-decoration: none;
}

.dynamic-badge a:hover {
    text-decoration: underline;
}

/* Error State */
.result-error {
    text-align: center;
    padding: 40px 20px;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.error-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--qrfix-error);
    margin-bottom: 8px;
}

.error-message {
    font-size: 14px;
    color: var(--qrfix-text-light);
    margin-bottom: 20px;
}

/* ============================================
   PROMPT SUGGESTIONS
============================================ */
.ai-suggestions {
    max-width: 780px;
    margin: 24px auto 0;
    opacity: 0;
    animation: revealUp 0.6s ease 0.4s forwards;
}

.suggestions-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--qrfix-text-light);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.suggestion-chip {
    padding: 8px 16px;
    background: var(--qrfix-white);
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 13px;
    color: var(--qrfix-text);
    cursor: pointer;
    transition: all var(--qrfix-transition);
}

.suggestion-chip:hover {
    background: var(--qrfix-primary);
    color: var(--qrfix-white);
    border-color: var(--qrfix-primary);
    transform: translateY(-2px);
}

/* ============================================
   LOGIN PROMPT
============================================ */
.ai-login-prompt {
    max-width: 500px;
    margin: 40px auto 0;
    text-align: center;
    background: var(--qrfix-white);
    border: 2px solid var(--qrfix-border);
    border-radius: var(--qrfix-radius);
    padding: 30px;
    box-shadow: var(--qrfix-shadow);
    opacity: 0;
    animation: revealUp 0.6s ease 0.3s forwards;
}

.login-icon {
    font-size: 40px;
    margin-bottom: 16px;
}

.login-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--qrfix-text);
    margin-bottom: 8px;
}

.login-text {
    font-size: 14px;
    color: var(--qrfix-text-light);
    margin-bottom: 20px;
}

.login-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.login-btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all var(--qrfix-transition);
}

.login-btn.primary {
    background: var(--qrfix-gradient);
    color: var(--qrfix-white);
}

.login-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(74, 58, 255, 0.25);
}

.login-btn.secondary {
    background: var(--qrfix-white);
    color: var(--qrfix-primary);
    border: 2px solid var(--qrfix-primary);
}

/* ============================================
   UPGRADE PROMPT
============================================ */
.ai-upgrade-prompt {
    max-width: 600px;
    margin: 40px auto 0;
    text-align: center;
    background: linear-gradient(135deg, #fef3c7, #fef9c3);
    border: 2px solid #fbbf24;
    border-radius: var(--qrfix-radius);
    padding: 30px;
}

.upgrade-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.upgrade-title {
    font-size: 20px;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 8px;
}

.upgrade-text {
    font-size: 14px;
    color: #a16207;
    margin-bottom: 20px;
}

.upgrade-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: var(--qrfix-white);
    border-radius: 10px;
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
    transition: all var(--qrfix-transition);
}

.upgrade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.35);
}

/* ============================================
   HISTORY SECTION - SLIDER
============================================ */
.ai-history-section {
    max-width: 1000px;
    margin: 60px auto 0;
    padding: 0 20px;
}

.history-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--qrfix-text);
    margin-bottom: 24px;
    text-align: center;
}

/* Slider Wrapper - Contains arrows and slider */
.history-slider-wrapper {
    position: relative;
    padding: 0 60px;
}

/* Navigation Arrows - Positioned absolutely */
.slider-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--qrfix-border);
    background: var(--qrfix-white);
    color: var(--qrfix-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 10;
}

.slider-prev {
    left: 0;
}

.slider-next {
    right: 0;
}

.slider-nav:hover:not(:disabled) {
    background: var(--qrfix-primary);
    color: var(--qrfix-white);
    border-color: var(--qrfix-primary);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(74, 58, 255, 0.25);
}

.slider-nav:active:not(:disabled) {
    transform: translateY(-50%) scale(0.95);
}

.slider-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Slider Container */
.history-slider {
    overflow: hidden;
    /* Critical for flex children */
}

/* Scrollable Track */
.history-slider-track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 8px 4px 16px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: grab;
}

.history-slider-track::-webkit-scrollbar {
    display: none;
}

.history-slider-track:active {
    cursor: grabbing;
}

/* Individual Slide */
.history-slide {
    flex: 0 0 180px;
    min-width: 180px;
    max-width: 180px;
}

/* History Card Item */
.history-item {
    width: 100%;
    background: var(--qrfix-white);
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: all var(--qrfix-transition);
    cursor: pointer;
}

.history-item:hover {
    border-color: var(--qrfix-primary);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(74, 58, 255, 0.15);
}

.history-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    background: #f5f5f5;
}

.history-info {
    padding: 12px;
}

.history-prompt {
    font-size: 12px;
    color: var(--qrfix-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.history-date {
    font-size: 11px;
    color: var(--qrfix-text-light);
    margin-top: 4px;
}

/* Dot Pagination */
.slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.slider-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: none;
    background: #d1d5db;
    cursor: pointer;
    padding: 0;
    transition: all 0.3s ease;
}

.slider-dot:hover {
    background: var(--qrfix-primary-light);
    transform: scale(1.2);
}

.slider-dot.active {
    background: var(--qrfix-primary);
    transform: scale(1.2);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .history-slider-wrapper {
        padding: 0 50px;
    }

    .slider-nav {
        width: 36px;
        height: 36px;
    }

    .slider-nav svg {
        width: 16px;
        height: 16px;
    }

    .history-slide {
        flex: 0 0 150px;
        min-width: 150px;
        max-width: 150px;
    }

    .history-image {
        height: 150px;
    }

    .history-slider-track {
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .history-slider-wrapper {
        padding: 0 40px;
    }

    .slider-nav {
        width: 32px;
        height: 32px;
    }

    .history-slide {
        flex: 0 0 140px;
        min-width: 140px;
        max-width: 140px;
    }

    .history-image {
        height: 140px;
    }

    .slider-dots {
        margin-top: 16px;
    }

    .slider-dot {
        width: 8px;
        height: 8px;
    }
}

/* ============================================
   TOAST NOTIFICATIONS
============================================ */
.ai-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 24px;
    background: var(--qrfix-text);
    color: var(--qrfix-white);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    animation: scaleIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-toast.success {
    background: var(--qrfix-success);
}

.ai-toast.error {
    background: var(--qrfix-error);
}

.ai-toast.warning {
    background: var(--qrfix-warning);
}

/* ============================================
   RESPONSIVE DESIGN
============================================ */
@media (max-width: 900px) {
    .ai-title {
        font-size: 36px;
    }

    .ai-input-wrap {
        padding: 8px;
    }

    .ai-input {
        padding: 12px 14px;
        font-size: 15px;
    }

    .btn-generate {
        padding: 10px 16px;
    }

    .result-container {
        padding: 24px;
    }

    .result-image-wrap {
        max-width: 300px;
    }

    .result-actions {
        flex-direction: column;
        align-items: center;
    }

    .result-btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }
}

@media (max-width: 600px) {
    .ai-hero {
        padding: 60px 16px 80px;
    }

    .ai-title {
        font-size: 28px;
    }

    .ai-lead {
        font-size: 15px;
    }

    .ai-input-wrap {
        flex-direction: column;
        gap: 10px;
    }

    .ai-input {
        width: 100%;
        text-align: center;
    }

    .btn-generate {
        width: 100%;
        justify-content: center;
    }

    .login-buttons {
        flex-direction: column;
    }

    .login-btn {
        width: 100%;
        text-align: center;
    }

    .history-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* ============================================
   UTILITIES
============================================ */
.hidden {
    display: none !important;
}

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

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-1 {
    margin-bottom: 8px !important;
}

.mb-2 {
    margin-bottom: 16px !important;
}

.mb-3 {
    margin-bottom: 24px !important;
}

.mt-0 {
    margin-top: 0 !important;
}

.mt-1 {
    margin-top: 8px !important;
}

.mt-2 {
    margin-top: 16px !important;
}

.mt-3 {
    margin-top: 24px !important;
}