/* ============================================
   QR Code Generator - Custom Styles
   ============================================ */

/* ============================================
   Root Variables for Theming
   ============================================ */
:root {
    --primary-color: #0d6efd;
    --primary-hover: #0b5ed7;
    --success-color: #198754;
    --success-hover: #157347;
    --danger-color: #dc3545;
    --light-bg: #f8f9fa;
    --border-color: #dee2e6;
    --text-muted: #6c757d;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-md: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --transition-speed: 0.3s;
}

/* ============================================
   Global Styles
   ============================================ */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f7fa;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* ============================================
   Navigation Enhancements
   ============================================ */
.navbar {
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    font-size: 1.25rem;
    transition: transform var(--transition-speed) ease;
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.nav-link {
    transition: color var(--transition-speed) ease;
}

.nav-link:hover {
    color: rgba(255, 255, 255, 0.85) !important;
}

/* ============================================
   Card Enhancements
   ============================================ */
.card {
    border: none;
    border-radius: 12px;
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
    padding: 1rem 1.25rem;
    font-weight: 600;
}

/* ============================================
   Data Type Selector Buttons
   ============================================ */
.data-type-btn {
    text-align: left;
    padding: 0.875rem 1.25rem;
    font-size: 1rem;
    font-weight: 500;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: all var(--transition-speed) ease;
    background-color: white;
    color: #212529;
}

.data-type-btn:hover {
    background-color: var(--light-bg);
    border-color: var(--primary-color);
    transform: translateX(5px);
}

.data-type-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

.data-type-btn i {
    font-size: 1.25rem;
    vertical-align: middle;
}

/* ============================================
   Form Sections
   ============================================ */
.form-section {
    display: none;
    animation: fadeIn 0.4s ease-in;
}

.form-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Form Controls
   ============================================ */
.form-control,
.form-select {
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 0.625rem 0.875rem;
    transition: border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

/* Accessible focus states */
.form-control:focus-visible,
.form-select:focus-visible,
.btn:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-label.fw-bold {
    color: #212529;
}

/* Form text and help text */
.form-text {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ============================================
   Color Picker Inputs
   ============================================ */
input[type="color"] {
    height: 45px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: border-color var(--transition-speed) ease;
}

input[type="color"]:hover {
    border-color: var(--primary-color);
}

input[type="color"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

/* ============================================
   Gradient Controls
   ============================================ */
.gradient-controls {
    display: none;
    padding: 1rem;
    background-color: var(--light-bg);
    border-radius: 8px;
    margin-top: 1rem;
    animation: slideDown 0.3s ease;
}

.gradient-controls.active {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

/* ============================================
   QR Code Preview Container
   ============================================ */
#qr-preview-container {
    min-height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 3px dashed var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    transition: all var(--transition-speed) ease;
}

#qr-preview-container:hover {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

#qr-preview-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    animation: zoomIn 0.4s ease;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.placeholder-text {
    color: var(--text-muted);
    text-align: center;
}

.placeholder-text i {
    opacity: 0.5;
}

.placeholder-text p {
    font-size: 1.1rem;
    margin-top: 1rem;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    border-radius: 8px;
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
    border: none;
}

.btn-primary {
    background-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
    transform: translateY(-2px);
}

.btn-success {
    background-color: var(--success-color);
    box-shadow: 0 2px 8px rgba(25, 135, 84, 0.2);
}

.btn-success:hover {
    background-color: var(--success-hover);
    box-shadow: 0 4px 12px rgba(25, 135, 84, 0.3);
    transform: translateY(-2px);
}

.btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 1.125rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================
   Alerts and Messages
   ============================================ */
.alert {
    border-radius: 8px;
    border: none;
    padding: 1rem 1.25rem;
    animation: slideInDown 0.3s ease;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.alert-danger {
    background-color: #f8d7da;
    color: #842029;
}

.alert-info {
    background-color: #cff4fc;
    color: #055160;
}

/* ============================================
   Sticky Sidebar
   ============================================ */
.sticky-top {
    position: sticky;
    z-index: 1020;
}

/* ============================================
   Loading Spinner
   ============================================ */
#generation-status {
    padding: 1.5rem;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

/* ============================================
   Footer
   ============================================ */
.footer {
    background-color: white;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

/* ============================================
   Responsive Design Adjustments
   ============================================ */

/* Tablets and below */
@media (max-width: 991.98px) {
    .sticky-top {
        position: relative;
        top: 0 !important;
    }
    
    .card {
        margin-bottom: 1.5rem;
    }
    
    #qr-preview-container {
        min-height: 250px;
    }
}

/* Mobile devices */
@media (max-width: 767.98px) {
    .display-5 {
        font-size: 2rem;
    }
    
    .lead {
        font-size: 1rem;
    }
    
    .data-type-btn {
        font-size: 0.95rem;
        padding: 0.75rem 1rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1.25rem;
        font-size: 1rem;
    }
    
    #qr-preview-container {
        min-height: 200px;
        padding: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
}

/* Small mobile devices */
@media (max-width: 575.98px) {
    .navbar-brand {
        font-size: 1rem;
    }
    
    .navbar-brand i {
        font-size: 1.25rem;
    }
    
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* ============================================
   Accessibility Enhancements
   ============================================ */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .form-control,
    .form-select {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .navbar,
    .footer,
    .btn,
    .card-header {
        display: none;
    }
    
    #qr-preview-container {
        border: none;
        background: white;
    }
    
    .card {
        box-shadow: none;
        page-break-inside: avoid;
    }
}

/* ============================================
   Custom Scrollbar (Webkit browsers)
   ============================================ */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--light-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   Utility Classes
   ============================================ */
.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hover-lift {
    transition: transform var(--transition-speed) ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
}

/* ============================================
   Form Validation Styles
   ============================================ */
.is-invalid {
    border-color: var(--danger-color) !important;
}

.invalid-feedback {
    display: block;
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.is-valid {
    border-color: var(--success-color) !important;
}

.valid-feedback {
    display: block;
    color: var(--success-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}
