/* ========================================
   QR Code Generator - Modern Design
   ======================================== */

/* CSS Variables */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #06b6d4;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1e293b;
    --light: #f8fafc;
    --gray: #94a3b8;
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.25);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

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

body {
    font-family: 'Kanit', 'Poppins', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #4facfe 100%);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    min-height: 100vh;
    color: var(--dark);
    overflow-x: hidden;
    position: relative;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Animated Background Blobs */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: blobFloat 20s ease-in-out infinite;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    top: -10%;
    left: -10%;
    animation-delay: 0s;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: linear-gradient(45deg, #48dbfb, #0abde3);
    bottom: -10%;
    right: -10%;
    animation-delay: -5s;
}

.blob-3 {
    width: 350px;
    height: 350px;
    background: linear-gradient(45deg, #ff9ff3, #f368e0);
    top: 40%;
    left: 60%;
    animation-delay: -10s;
}

@keyframes blobFloat {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(30px, -50px) scale(1.1);
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
    }
}

/* Main Container */
.main-container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Content Grid - 2 Columns */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    align-items: start;
}

.right-panel {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.right-panel .card {
    margin-bottom: 0;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo i {
    font-size: 3rem;
    animation: pulse 2s ease-in-out infinite;
}

.site-logo {
    height: 55px;
    width: auto;
    object-fit: contain;
    border-radius: 8px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

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

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Cards */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255,255,255,0.2);
}

.card-header i {
    font-size: 1.5rem;
    color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.card-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--dark);
    flex: 1;
}

/* Form Styles */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 10px;
    color: var(--dark);
    font-size: 0.95rem;
}

.form-group label i {
    margin-right: 8px;
    color: var(--primary);
}

.form-group input[type="url"],
.form-group input[type="text"] {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 14px;
    background: rgba(255,255,255,0.2);
    font-family: inherit;
    font-size: 1rem;
    color: var(--dark);
    transition: all 0.3s ease;
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary);
    background: rgba(255,255,255,0.3);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.form-group input::placeholder {
    color: rgba(30, 41, 59, 0.5);
}

.input-hint {
    display: block;
    margin-top: 8px;
    font-size: 0.85rem;
    color: rgba(30, 41, 59, 0.6);
}

/* Size Options */
.size-options {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.size-option {
    flex: 1;
    min-width: 80px;
    cursor: pointer;
}

.size-option input {
    display: none;
}

.size-label {
    display: block;
    text-align: center;
    padding: 12px 8px;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    color: var(--dark);
}

.size-option small {
    display: block;
    text-align: center;
    margin-top: 2px;
    font-size: 0.75rem;
    color: rgba(30, 41, 59, 0.6);
}

.size-option input:checked + .size-label {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    transform: scale(1.05);
}

.size-option:hover .size-label {
    border-color: var(--primary-light);
}

/* CAPTCHA */
.captcha-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.captcha-img {
    height: 80px;
    width: auto;
    border-radius: 10px;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.3);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.captcha-img:hover {
    transform: scale(1.02);
}

.btn-refresh {
    width: 45px;
    height: 45px;
    border: none;
    background: var(--primary);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-refresh:hover {
    background: var(--primary-dark);
    transform: rotate(180deg);
}

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

/* Buttons */
.button-group {
    display: flex;
    gap: 12px;
    margin-top: 25px;
}

.btn {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 14px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-preview {
    background: rgba(255,255,255,0.3);
    color: var(--dark);
    border: 2px solid rgba(255,255,255,0.4);
}

.btn-preview:hover {
    background: rgba(255,255,255,0.5);
    transform: translateY(-2px);
}

.btn-generate {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

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

.btn-download {
    background: var(--success);
    color: white;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-download:hover {
    background: #059669;
    transform: translateY(-2px);
    color: white;
}

.btn-new {
    background: rgba(255,255,255,0.3);
    color: var(--dark);
    border: 2px solid rgba(255,255,255,0.4);
}

.btn-new:hover {
    background: rgba(255,255,255,0.5);
}

/* Welcome Card */
.welcome-card {
    text-align: center;
}

.welcome-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.welcome-step {
    display: flex;
    align-items: center;
    gap: 15px;
    text-align: left;
    padding: 12px 15px;
    background: rgba(255,255,255,0.2);
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.3s ease;
}

.welcome-step:hover {
    background: rgba(255,255,255,0.3);
    transform: translateX(5px);
}

.step-num {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: var(--gradient-1);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.step-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.step-text strong {
    color: var(--dark);
    font-size: 1rem;
}

.step-text span {
    color: rgba(30, 41, 59, 0.7);
    font-size: 0.9rem;
}

.welcome-qr-icon {
    margin-top: 10px;
}

.welcome-qr-icon i {
    font-size: 5rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0.8;
    animation: pulse 2s ease-in-out infinite;
}

/* QR Preview */
.qr-preview-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    background: rgba(255,255,255,0.1);
    border-radius: 16px;
    border: 2px dashed rgba(255,255,255,0.3);
    position: relative;
}

#qrcode {
    padding: 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

#qrcode img {
    display: block;
    border-radius: 8px;
}

.qr-loading {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.preview-actions {
    margin-top: 20px;
    text-align: center;
}

/* Result Card */
.result-success {
    text-align: center;
    padding: 20px 0;
}

.result-success i {
    font-size: 4rem;
    color: var(--success);
    animation: scaleIn 0.5s ease;
}

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

.result-success h3 {
    font-size: 1.5rem;
    margin-top: 10px;
    color: var(--dark);
}

.result-success p {
    color: rgba(30, 41, 59, 0.7);
}

.result-details {
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 15px 20px;
    margin: 20px 0;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 500;
    color: rgba(30, 41, 59, 0.7);
}

.detail-value {
    font-weight: 600;
    color: var(--dark);
    word-break: break-all;
    text-align: right;
    max-width: 60%;
}

.result-image {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.result-image img {
    max-width: 100%;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-actions {
    display: flex;
    gap: 12px;
}

/* History */
.btn-refresh-history {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-refresh-history:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: rotate(180deg);
}

.history-loading {
    text-align: center;
    padding: 30px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255,255,255,0.2);
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.2);
    transition: all 0.3s ease;
    animation: slideInRight 0.4s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.history-item:hover {
    background: rgba(255,255,255,0.3);
    transform: translateX(5px);
}

.history-item img {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    object-fit: cover;
    background: white;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-url {
    font-weight: 600;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.95rem;
}

.history-meta {
    display: flex;
    gap: 15px;
    margin-top: 5px;
    font-size: 0.8rem;
    color: rgba(30, 41, 59, 0.6);
}

.history-meta i {
    margin-right: 4px;
}

.history-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 0.9rem;
}

.btn-view {
    background: var(--primary);
    color: white;
}

.btn-view:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.btn-dl {
    background: var(--success);
    color: white;
}

.btn-dl:hover {
    background: #059669;
    transform: scale(1.1);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: rgba(30, 41, 59, 0.5);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--dark);
    color: white;
    padding: 14px 28px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    z-index: 1000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast i {
    font-size: 1.2rem;
}

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

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

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
}

.footer i {
    margin-right: 5px;
}

/* Animations */
.animate-fade-in {
    animation: fadeIn 0.8s ease;
}

.animate-slide-up {
    animation: slideUp 0.6s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 960px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .main-container {
        padding: 20px 15px;
    }
    
    .logo h1 {
        font-size: 1.8rem;
    }
    
    .card {
        padding: 20px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .size-options {
        gap: 8px;
    }
    
    .size-option {
        min-width: 60px;
    }
    
    .size-label {
        padding: 10px 6px;
        font-size: 0.85rem;
    }
    
    .history-item {
        flex-wrap: wrap;
    }
    
    .history-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 10px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}
