:root {
    --primary-color: #4a6bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --background-color: #f8f9fa;
    --dark-color: #343a40;
    --light-color: #ffffff;
    --border-color: #dee2e6;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--dark-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

header p {
    color: var(--secondary-color);
}

.back-link {
    display: inline-block;
    color: var(--primary-color);
    text-decoration: none;
    margin-top: 0.5rem;
}

.back-link:hover {
    text-decoration: underline;
}

main {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}

.generator-section, .result-section, .stats-section {
    flex: 1;
    min-width: 300px;
    background-color: var(--light-color);
    border-radius: 10px;
    box-shadow: 0 4px 6px var(--shadow-color);
    padding: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

input[type="url"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
}

input[type="file"] {
    display: none;
}

.file-input-container {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.file-input-button {
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.file-input-button:hover {
    background-color: #3a59e0;
}

#file-name {
    margin-left: 1rem;
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.file-preview {
    margin-top: 1rem;
    max-width: 100px;
    max-height: 100px;
    overflow: hidden;
    border-radius: 5px;
    display: none;
}

.file-preview img {
    width: 100%;
    height: auto;
}

button, .action-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
    text-decoration: none;
    display: inline-block;
}

button:hover, .action-btn:hover {
    background-color: #3a59e0;
}

.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

#qrcode-display {
    margin-bottom: 1.5rem;
    text-align: center;
}

#qrcode-display img, .qr-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    box-shadow: 0 2px 4px var(--shadow-color);
}

.qr-info, .qr-redirect {
    margin-top: 1rem;
    text-align: center;
    color: var(--secondary-color);
}

.qr-redirect a {
    color: var(--primary-color);
    word-break: break-all;
}

.qr-actions, .stats-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.stats-section {
    width: 100%;
}

.qr-preview {
    text-align: center;
    margin-bottom: 2rem;
}

.qr-preview img {
    max-width: 200px;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stats-item {
    background-color: #f1f3f9;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.stats-label {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.stats-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.target-url {
    font-size: 1rem;
    word-break: break-all;
}

.target-url a {
    color: var(--primary-color);
    text-decoration: none;
}

.target-url a:hover {
    text-decoration: underline;
}

footer {
    text-align: center;
    margin-top: 3rem;
    color: var(--secondary-color);
}

/* Error message styling */
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
}

/* Responsive design */
@media (max-width: 768px) {
    main {
        flex-direction: column;
    }
    
    .generator-section, .result-section, .stats-section {
        width: 100%;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .qr-actions, .stats-actions {
        flex-direction: column;
    }
}
