/* Advanced QR Code Generator - Modern Responsive CSS */
:root {
    --primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-dark: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    --secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    --warning: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    --danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --info: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    --dark: #1a202c;
    --light: #f7fafc;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border: #e2e8f0;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
}

.tool-page {
    padding: 2rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
    min-height: calc(100vh - 140px);
}

/* Tool Header */
.tool-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 3rem 2rem;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.tool-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><rect x="10" y="10" width="5" height="5" fill="%23ffffff" opacity="0.1"/><rect x="30" y="20" width="3" height="3" fill="%23ffffff" opacity="0.1"/><rect x="60" y="15" width="4" height="4" fill="%23ffffff" opacity="0.1"/><rect x="80" y="35" width="6" height="6" fill="%23ffffff" opacity="0.1"/><rect x="20" y="60" width="5" height="5" fill="%23ffffff" opacity="0.1"/></svg>') repeat;
    animation: qrFloat 15s ease-in-out infinite;
    pointer-events: none;
}

@keyframes qrFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-2%, -1%) rotate(1deg); }
    50% { transform: translate(2%, -2%) rotate(-1deg); }
    75% { transform: translate(-1%, 2%) rotate(0.5deg); }
}

.tool-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.tool-header h1 i {
    color: #f093fb;
    font-size: 2.25rem;
}

.tool-description {
    font-size: 1.2rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin: 0 auto;
}

/* Main Container */
.qr-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Input Section */
.input-section {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border-top: 4px solid #667eea;
}

.input-header {
    padding: 2rem;
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    border-bottom: 2px solid var(--border);
}

.input-header h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.input-header h2 i {
    color: #667eea;
}

.input-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.input-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Form Groups */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group label i {
    color: #667eea;
    width: 16px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.875rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: var(--transition);
    background: white;
    color: var(--text-primary);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input:invalid {
    border-color: #ef4444;
}

.form-group input:invalid:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Content Type Selector */
.content-type-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.type-option {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: white;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.type-option:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    color: #667eea;
}

.type-option.active {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.type-option i {
    display: block;
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

/* Advanced Options */
.advanced-options {
    background: white;
    border-radius: var(--radius);
    border: 2px solid var(--border);
    overflow: hidden;
    margin-top: 1rem;
}

.advanced-header {
    padding: 1rem 1.5rem;
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: var(--text-primary);
}

.advanced-header i {
    color: #667eea;
    transition: var(--transition);
}

.advanced-content {
    padding: 1.5rem;
    display: none;
}

.advanced-content.show {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

/* Color Pickers */
.color-picker-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.color-picker {
    width: 50px;
    height: 40px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
}

.color-picker:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Buttons */
.btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-outline {
    background: white;
    color: var(--text-primary);
    border: 2px solid var(--border);
}

.btn-outline:hover {
    border-color: #667eea;
    color: #667eea;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn.loading {
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Output Section */
.output-section {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border-top: 4px solid #22c55e;
}

.output-header {
    padding: 2rem;
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    border-bottom: 2px solid var(--border);
}

.output-header h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.output-header h2 i {
    color: #22c55e;
}

.output-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.output-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* QR Preview */
.qr-preview {
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    min-height: 300px;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.qr-preview.empty {
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    color: var(--text-secondary);
    font-style: italic;
}

.qr-preview.generated {
    background: white;
    border-color: #22c55e;
}

.qr-preview canvas {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.qr-info {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.qr-placeholder {
    width: 200px;
    height: 200px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1rem;
    color: var(--text-secondary);
}

.qr-placeholder i {
    font-size: 3rem;
    opacity: 0.5;
}

/* QR Actions */
.qr-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.qr-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat-item {
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
    border: 2px solid var(--border);
}

.stat-item .label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.stat-item .value {
    display: block;
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 600;
}

/* Templates Section */
.templates-section {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    border-top: 4px solid #f59e0b;
    margin-bottom: 2rem;
}

.templates-header {
    padding: 2rem;
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    border-bottom: 2px solid var(--border);
}

.templates-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.templates-header h3 i {
    color: #f59e0b;
}

.templates-content {
    padding: 2rem;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.template-card {
    padding: 1.5rem;
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    border-radius: var(--radius);
    border: 2px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.template-card:hover {
    border-color: #f59e0b;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.template-card h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.template-card h4 i {
    color: #f59e0b;
}

.template-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* History Section */
.history-section {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    border-top: 4px solid #3b82f6;
    margin-bottom: 2rem;
}

.history-header {
    padding: 2rem;
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    border-bottom: 2px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.history-header h3 i {
    color: #3b82f6;
}

.history-content {
    padding: 2rem;
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.history-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-qr {
    width: 40px;
    height: 40px;
    background: white;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
}

.history-info {
    flex: 1;
}

.history-info .type {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.history-info .content {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-top: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.history-info .date {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .qr-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .tool-header h1 {
        font-size: 2.25rem;
    }
    
    .templates-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .content-type-selector {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
}

@media (max-width: 768px) {
    .tool-page {
        padding: 1rem;
    }
    
    .tool-header {
        padding: 2rem 1rem;
        margin-bottom: 2rem;
    }
    
    .tool-header h1 {
        font-size: 2rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .tool-header h1 i {
        font-size: 2rem;
    }
    
    .tool-description {
        font-size: 1.1rem;
    }
    
    .input-header,
    .output-header,
    .input-content,
    .output-content {
        padding: 1.5rem;
    }
    
    .qr-container {
        gap: 1.5rem;
    }
    
    .qr-preview {
        min-height: 250px;
        padding: 1.5rem;
    }
    
    .qr-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .qr-actions .btn {
        justify-content: center;
    }
    
    .content-type-selector {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .type-option {
        padding: 0.5rem;
    }
    
    .type-option i {
        font-size: 1rem;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .templates-grid {
        grid-template-columns: 1fr;
    }
    
    .qr-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .templates-header,
    .templates-content,
    .history-header,
    .history-content {
        padding: 1.5rem;
    }
    
    .history-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .history-info .content {
        max-width: 150px;
    }
}

@media (max-width: 480px) {
    .tool-header {
        padding: 1.5rem 1rem;
    }
    
    .tool-header h1 {
        font-size: 1.75rem;
    }
    
    .tool-header h1 i {
        font-size: 1.5rem;
    }
    
    .tool-description {
        font-size: 1rem;
    }
    
    .input-header h2,
    .output-header h2 {
        font-size: 1.25rem;
    }
    
    .input-header,
    .output-header,
    .input-content,
    .output-content {
        padding: 1rem;
    }
    
    .qr-preview {
        min-height: 200px;
        padding: 1rem;
    }
    
    .qr-placeholder {
        width: 150px;
        height: 150px;
    }
    
    .qr-placeholder i {
        font-size: 2rem;
    }
    
    .content-type-selector {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.25rem;
    }
    
    .type-option {
        padding: 0.375rem;
        font-size: 0.75rem;
    }
    
    .type-option i {
        font-size: 0.875rem;
        margin-bottom: 0.125rem;
    }
    
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
    
    .qr-stats {
        grid-template-columns: 1fr;
    }
    
    .stat-item {
        padding: 0.75rem;
    }
    
    .templates-header,
    .templates-content,
    .history-header,
    .history-content {
        padding: 1rem;
    }
    
    .template-card {
        padding: 1rem;
    }
    
    .history-item {
        padding: 0.75rem;
    }
    
    .history-info .content {
        max-width: 120px;
    }
    
    .history-qr {
        width: 30px;
        height: 30px;
    }
}

/* Animation for QR generation */
@keyframes qrGenerate {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.qr-preview canvas.generated {
    animation: qrGenerate 0.5s ease-out;
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .tool-header {
        background: white !important;
        color: black !important;
        box-shadow: none;
        border: 2px solid #ccc;
    }
    
    .input-section,
    .advanced-options,
    .templates-section,
    .history-section {
        display: none;
    }
    
    .output-section {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
    
    .qr-preview {
        background: white !important;
        border: 1px solid #ccc;
    }
    
    .qr-actions .btn:not(.btn-outline) {
        display: none;
    }
}
