/* Variables */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #34d399;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
}

/* Reset & Base */
.qr-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Header */
.qr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.qr-page-title {
    color: var(--gray-800);
    font-size: 28px;
    font-weight: 700;
    margin: 0;
}

.qr-header p {
    color: var(--gray-500);
    font-size: 14px;
    margin: 0;
    font-style: italic;
}

/* Grid Layout */
.qr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

/* Empty State */
.qr-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--gray-50);
    border-radius: 16px;
    margin-top: 24px;
}

.qr-empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.qr-empty-state h3 {
    color: var(--gray-700);
    font-size: 24px;
    margin-bottom: 8px;
    font-weight: 600;
}

.qr-empty-state p {
    color: var(--gray-500);
    font-size: 16px;
    margin: 0;
}

/* Create Button */
.qr-create-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.qr-create-button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
}

.qr-create-button .icon {
    font-size: 18px;
}

/* Card Styles */
.qr-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.qr-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Card Header */
.qr-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.qr-card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

/* QR Code Section */
.qr-code-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--gray-50);
    border-radius: 12px;
    margin-bottom: 20px;
}

.qr-code-image {
    width: 180px;
    height: 180px;
    object-fit: contain;
    padding: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* URL Section */
.qr-url-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.qr-url-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.qr-url-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-500);
}

.qr-url-value {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--primary);
    word-break: break-all;
}

/* Stats Section */
.qr-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 16px;
    background: var(--gray-50);
    border-radius: 12px;
    margin-bottom: 20px;
}

.qr-stat-item {
    text-align: center;
    padding: 12px;
    background: white;
    border-radius: 8px;
}

.qr-stat-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--gray-900);
    line-height: 1;
    margin-bottom: 4px;
}

.qr-stat-label {
    font-size: 13px;
    color: var(--gray-500);
}

/* Buttons */
.qr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    min-width: 100px;
}

.qr-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.qr-btn-primary {
    background: var(--primary);
    color: white;
}

.qr-btn-primary:hover {
    background: var(--primary-dark);
}

.qr-btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.qr-btn-secondary:hover {
    background: var(--gray-200);
}

.qr-btn-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.qr-btn-danger:hover {
    background: #fecaca;
}

/* Copy Button */
.copy-btn {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    background: var(--gray-100);
    border-radius: 6px;
    font-size: 12px;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.copy-btn:hover {
    background: var(--gray-200);
}

.copy-btn.copied {
    background: var(--success);
    color: white;
}

/* Modal */
.qr-modal {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.5) !important;
    z-index: 999999 !important;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.qr-modal[style*="block"] {
    display: block !important;
}

.qr-modal.show {
    opacity: 1 !important;
    display: block !important;
}

/* Body modal open state */
body.modal-open {
    overflow: hidden !important;
}

/* Ensure modal is always on top */
.qr-modal {
    z-index: 999999 !important;
}

.qr-modal * {
    box-sizing: border-box;
}

.qr-modal-content {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 90% !important;
    max-width: 600px !important;
    max-height: 90vh !important;
    background: white !important;
    border-radius: 16px !important;
    overflow-y: auto !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
    z-index: 1000000 !important;
}

/* Modal Header */
.qr-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    top: 0;
    background: white;
    z-index: 1;
}

.qr-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
}

.qr-close-modal {
    font-size: 24px;
    color: var(--gray-500);
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
    padding: 4px;
}

.qr-close-modal:hover {
    color: var(--gray-900);
}

/* Form */
.qr-form {
    padding: 24px;
}

.qr-form-group {
    margin-bottom: 20px;
}

.qr-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--gray-700);
}

.qr-form-group input[type="text"],
.qr-form-group input[type="url"],
.qr-form-group input[type="number"],
.qr-form-group textarea,
.qr-form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    color: var(--gray-900);
    transition: all 0.2s ease;
}

.qr-form-group input:focus,
.qr-form-group textarea:focus,
.qr-form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Color Input */
.qr-color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

input[type="color"] {
    -webkit-appearance: none;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    cursor: pointer;
}

.qr-color-preview {
    padding: 8px 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 13px;
    color: var(--gray-600);
    min-width: 80px;
    text-align: center;
}

/* File Input */
.qr-file-input {
    display: none;
}

.qr-file-label {
    display: inline-block;
    padding: 8px 16px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.qr-file-label:hover {
    background: var(--gray-200);
}

.qr-file-name {
    margin-left: 10px;
    font-size: 14px;
    color: var(--gray-500);
}

/* Form Actions */
.qr-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

/* Messages */
.qr-message {
    padding: 12px 16px;
    border-radius: 8px;
    margin: 16px 0;
    font-size: 14px;
}

.qr-success-message {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: var(--success);
}

.qr-error-message {
    background: var(--danger-light);
    border: 1px solid #fecaca;
    color: var(--danger);
}

/* Responsive */
@media screen and (max-width: 768px) {
    .qr-grid {
        grid-template-columns: 1fr;
    }

    .qr-modal-content {
        width: calc(100% - 32px);
        margin: 16px;
    }

    .qr-card {
        padding: 16px;
    }

    .qr-stats {
        grid-template-columns: 1fr;
    }

    .qr-actions {
        flex-direction: column;
    }

    .qr-btn {
        width: 100%;
    }
}

/* Loading Animation */
.loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid var(--gray-200);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Fade Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Statistics Summary Section */
.qr-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin: 32px 0;
}

.qr-summary-item {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 
                0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.qr-summary-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6 0%, #2563eb 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.qr-summary-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 
                0 4px 6px -2px rgba(0, 0, 0, 0.04);
}

.qr-summary-item:hover::before {
    opacity: 1;
}

.qr-summary-value {
    font-size: 32px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
    line-height: 1.2;
    font-feature-settings: "tnum" on, "lnum" on;
    background: linear-gradient(90deg, #1e293b 0%, #334155 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.qr-summary-label {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Icon indicators */
.qr-summary-item::after {
    font-size: 48px;
    position: absolute;
    right: 20px;
    bottom: -10px;
    opacity: 0.1;
    transition: all 0.3s ease;
}

.qr-summary-item:nth-child(1)::after {
    content: '📱';
}

.qr-summary-item:nth-child(2)::after {
    content: '📊';
}

.qr-summary-item:nth-child(3)::after {
    content: '🔗';
}

.qr-summary-item:hover::after {
    opacity: 0.15;
    transform: scale(1.1);
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .qr-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 480px) {
    .qr-summary {
        grid-template-columns: 1fr;
    }
    
    .qr-summary-item {
        padding: 20px;
    }
    
    .qr-summary-value {
        font-size: 28px;
    }
}

/* Optional: Add animation on load */
@keyframes slideUpFade {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.qr-summary-item {
    animation: slideUpFade 0.5s ease forwards;
}

.qr-summary-item:nth-child(1) {
    animation-delay: 0.1s;
}

.qr-summary-item:nth-child(2) {
    animation-delay: 0.2s;
}

.qr-summary-item:nth-child(3) {
    animation-delay: 0.3s;
}