* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: #333;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%; /* Prevent iOS text size adjust */
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(to right, #2c3e50, #4a6491);
    color: white;
    padding: 30px 40px;
    text-align: center;
    border-bottom: 5px solid #3498db;
}

header h1 {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

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

.generator-container {
    display: flex;
    flex-wrap: wrap;
    padding: 30px;
    gap: 30px;
}

.input-section, .output-section {
    flex: 1;
    min-width: 300px;
    background-color: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

.input-section h2, .output-section h2 {
    font-size: 1.8rem;
    margin-bottom: 25px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #2c3e50;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

#qr-content {
    width: 100%;
    min-height: 150px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    resize: vertical;
    transition: border-color 0.3s;
    -webkit-appearance: none; /* Remove iOS styling */
}

#qr-content:focus {
    border-color: #3498db;
    outline: none;
}

.char-count {
    text-align: right;
    margin-top: 8px;
    font-size: 0.9rem;
    color: #666;
}

.presets {
    margin-bottom: 25px;
}

.presets p {
    font-weight: 600;
    margin-bottom: 12px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.preset-btn {
    padding: 12px 16px;
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px; /* Mobile touch target */
    min-width: 44px;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.preset-btn:hover {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

.settings {
    margin-bottom: 30px;
}

.settings h3 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
}

.setting-group {
    flex: 1;
    min-width: 200px;
}

.setting-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    touch-action: manipulation;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

input[type="color"] {
    width: 60px;
    height: 44px;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
    touch-action: manipulation;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 30px;
}

.btn-primary, .btn-secondary, .btn-tertiary {
    padding: 16px 25px;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 1;
    min-width: 180px;
    min-height: 54px; /* Better touch target */
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.btn-primary {
    background: linear-gradient(to right, #3498db, #2c3e50);
    color: white;
}

.btn-primary:hover, .btn-primary:active {
    transform: translateY(-2px);
    box-shadow: 0 7px 14px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background-color: #27ae60;
    color: white;
}

.btn-secondary:hover:not(:disabled), .btn-secondary:active:not(:disabled) {
    background-color: #219653;
    transform: translateY(-2px);
    box-shadow: 0 7px 14px rgba(39, 174, 96, 0.3);
}

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

.btn-tertiary {
    background-color: #e74c3c;
    color: white;
}

.btn-tertiary:hover, .btn-tertiary:active {
    background-color: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 7px 14px rgba(231, 76, 60, 0.3);
}

.qr-preview-container {
    background-color: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 350px;
    margin-bottom: 25px;
    border: 2px dashed #ddd;
    position: relative;
}

.qr-placeholder {
    text-align: center;
    color: #7f8c8d;
}

.qr-placeholder i {
    font-size: 5rem;
    margin-bottom: 20px;
    color: #bdc3c7;
}

.qr-placeholder p {
    font-size: 1.2rem;
    margin: 5px 0;
}

.qr-placeholder .mobile-hint {
    font-size: 0.9rem;
    color: #3498db;
    font-style: italic;
    margin-top: 10px;
    display: none;
}

.qr-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    background-color: white;
    display: block;
}

.qr-info {
    background-color: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
}

.qr-info h3 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-weight: 600;
    color: #7f8c8d;
    font-size: 0.9rem;
}

.info-value {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1.1rem;
    word-break: break-word;
}

.instructions {
    background-color: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
}

.instructions h3 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.instructions ol {
    padding-left: 20px;
}

.instructions li {
    margin-bottom: 10px;
    padding-left: 10px;
}

footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 25px;
    margin-top: 30px;
}

footer p {
    margin-bottom: 10px;
}

.footer-links a {
    color: #3498db;
    text-decoration: none;
    margin: 0 10px;
    transition: color 0.3s;
    display: inline-block;
    padding: 5px;
}

.footer-links a:hover {
    color: #5dade2;
    text-decoration: underline;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    background-color: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 90%;
}

.loading-spinner i {
    font-size: 3rem;
    color: #3498db;
    margin-bottom: 20px;
}

.loading-spinner p {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
}

/* Mobile-specific styles */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    header {
        padding: 20px 15px;
    }
    
    header h1 {
        font-size: 2rem;
        gap: 10px;
    }
    
    .generator-container {
        padding: 15px;
        gap: 20px;
    }
    
    .input-section, .output-section {
        padding: 20px 15px;
        min-width: 100%;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .btn-primary, .btn-secondary, .btn-tertiary {
        min-width: 100%;
        margin-bottom: 10px;
        padding: 18px 20px;
    }
    
    .qr-preview-container {
        min-height: 280px;
        padding: 20px;
    }
    
    .qr-placeholder .mobile-hint {
        display: block;
    }
    
    .preset-buttons {
        justify-content: center;
    }
    
    .preset-btn {
        flex: 1;
        min-width: 0;
        justify-content: center;
        padding: 12px 10px;
        font-size: 0.9rem;
    }
    
    .setting-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .setting-group {
        min-width: 100%;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    footer {
        padding: 20px 15px;
    }
    
    .footer-links a {
        display: block;
        margin: 5px 0;
    }
    
    /* iOS Safari specific fixes */
    @supports (-webkit-touch-callout: none) {
        textarea, input {
            font-size: 16px; /* Prevents iOS zoom */
        }
        
        .qr-image {
            -webkit-user-drag: none;
        }
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    header h1 {
        font-size: 1.7rem;
    }
    
    .input-section h2, .output-section h2 {
        font-size: 1.5rem;
    }
    
    #qr-content {
        min-height: 120px;
        font-size: 16px; /* Prevents iOS zoom */
    }
    
    .qr-image {
        max-height: 250px;
    }
    
    .loading-spinner {
        padding: 30px 20px;
    }
}

/* Prevent text selection on interactive elements */
button, .preset-btn, .btn-primary, .btn-secondary, .btn-tertiary {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Improve focus states for accessibility */
button:focus, input:focus, textarea:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Animation for QR code appearance */
@keyframes qrAppear {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.qr-image {
    animation: qrAppear 0.3s ease-out;
}