:root {
    --primary: #6c63ff;
    --primary-dark: #5a52d5;
    --secondary: #ff6584;
    --dark: #2a2a3c;
    --light: #f8f9fa;
    --gray: #e9ecef;
    --text: #333;
    --text-light: #6c757d;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

.dark-mode {
    --primary: #7d76ff;
    --primary-dark: #6c63ff;
    --secondary: #ff7b95;
    --dark: #1a1a2e;
    --light: #2d3047;
    --gray: #3a3c52;
    --text: #f8f9fa;
    --text-light: #adb5bd;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--light) 0%, var(--gray) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: var(--transition);
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--primary);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: var(--transition);
    z-index: 100;
}

.theme-toggle:hover {
    transform: rotate(30deg);
    background: var(--primary-dark);
}

.container {
    width: 100%;
    max-width: 450px;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.dark-mode .container {
    background: var(--dark);
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.header {
    text-align: center;
    margin-bottom: 25px;
}

.header h1 {
    color: var(--primary);
    font-size: 28px;
    margin-bottom: 5px;
    font-weight: 700;
}

.header p {
    color: var(--text-light);
    font-size: 14px;
}

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

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 500;
    font-size: 14px;
}

.input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.input-container i {
    position: absolute;
    left: 15px;
    color: var(--text-light);
    z-index: 1;
}

.input-container input {
    width: 100%;
    padding: 15px 15px 15px 45px;
    border: 2px solid var(--gray);
    border-radius: 12px;
    font-size: 16px;
    transition: var(--transition);
    background: white;
    color: var(--text);
}

.dark-mode .input-container input {
    background: var(--light);
    border-color: var(--gray);
    color: var(--text);
}

.input-container input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.2);
}

.size-options {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.size-option {
    flex: 1;
    text-align: center;
    padding: 10px;
    border: 2px solid var(--gray);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    color: var(--text-light);
}

.dark-mode .size-option {
    border-color: var(--gray);
    color: var(--text-light);
}

.size-option.active {
    border-color: var(--primary);
    background: rgba(108, 99, 255, 0.1);
    color: var(--primary);
    font-weight: 500;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.btn {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(108, 99, 255, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 99, 255, 0.4);
}

.btn-secondary {
    background: var(--gray);
    color: var(--text);
}

.dark-mode .btn-secondary {
    background: var(--gray);
    color: var(--text);
}

.btn-secondary:hover {
    background: #d1d1d1;
    transform: translateY(-2px);
}

.dark-mode .btn-secondary:hover {
    background: #4a4c5e;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.qr-container {
    text-align: center;
    margin: 20px 0;
    padding: 20px;
    border-radius: 15px;
    background: var(--gray);
    transition: var(--transition);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.dark-mode .qr-container {
    background: var(--light);
}

.placeholder-text {
    color: var(--text-light);
    font-style: italic;
    margin-top: 10px;
}

#imgBox {
    width: 200px;
    margin: 0 auto;
    border-radius: 10px;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.5s ease, margin 0.3s ease, opacity 0.5s ease;
    background: white;
    padding: 10px;
    opacity: 0;
}

#imgBox.show-img {
    max-height: 400px; /* Adjusted for larger QR codes */
    margin: 15px auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    opacity: 1;
}

#qrImage {
    width: 100%;
    transition: transform 0.3s ease;
    display: block;
}

#imgBox.show-img #qrImage:hover {
    transform: scale(1.05);
}

.footer {
    text-align: center;
    margin-top: 20px;
    color: var(--text-light);
    font-size: 14px;
}

.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--dark);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
}

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

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Responsive Design */
@media (max-width: 480px) {
    .container {
        padding: 20px;
    }
    
    .header h1 {
        font-size: 24px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .size-options {
        flex-direction: column;
    }
}
