:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
    --gauge-safe: #198754;
    --gauge-caution: #ffc107;
    --gauge-danger: #dc3545;
}

/* Dark theme variables */
[data-bs-theme="dark"] {
    --bs-body-bg: #1a1a1a;
    --bs-body-color: #ffffff;
    --bs-card-bg: #2d2d2d;
    --bs-border-color: #404040;
}

/* Custom navbar styling */
.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
}

.navbar .form-switch .form-check-input {
    width: 3rem;
    height: 1.5rem;
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.navbar .form-switch .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

.navbar .form-switch .form-check-input:checked {
    background-color: rgba(255, 255, 255, 0.85);
    border-color: rgba(255, 255, 255, 0.85);
}

.navbar .form-switch .form-check-input:checked:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.35);
}

.navbar .form-switch .form-check-label {
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-left: 0.5rem;
}

/* Wizard steps styling */
.wizard-step {
    min-height: 400px;
}

.nav-pills .nav-link {
    color: var(--bs-secondary);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    font-weight: 500;
}

.nav-pills .nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

.nav-pills .nav-link.completed {
    background-color: var(--success-color);
    color: white;
}

/* Card enhancements */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    background-color: var(--bs-light);
    border-bottom: 1px solid var(--bs-border-color);
    font-weight: 600;
}

[data-bs-theme="dark"] .card-header {
    background-color: var(--bs-dark);
}

/* Fix bg-light in dark mode for payload total and other elements */
[data-bs-theme="dark"] .bg-light {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: var(--bs-body-color);
}

/* Safety Gauge Styling */
.safety-gauge {
    position: relative;
    width: 200px;
    height: 120px;
    margin: 2rem auto 4rem;
    background: conic-gradient(
        from 180deg,
        var(--gauge-danger) 0deg,
        var(--gauge-danger) 60deg,
        var(--gauge-caution) 60deg,
        var(--gauge-caution) 120deg,
        var(--gauge-safe) 120deg,
        var(--gauge-safe) 180deg
    );
    border-radius: 100px 100px 0 0;
    overflow: hidden;
}

.gauge-inner {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 0;
    background: var(--bs-body-bg);
    border-radius: 80px 80px 0 0;
}

.gauge-needle {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 2px;
    height: 60px;
    background: var(--bs-dark);
    transform-origin: bottom center;
    transform: translateX(-50%) rotate(0deg);
    transition: transform 0.5s ease-in-out;
    z-index: 2;
}

.gauge-center {
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 10px;
    height: 10px;
    background: var(--bs-dark);
    border-radius: 50%;
    transform: translateX(-50%);
    z-index: 3;
}

.gauge-score {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-size: 2rem;
    font-weight: bold;
    color: var(--bs-body-color);
}

.gauge-score small {
    display: block;
    font-size: 0.875rem;
    font-weight: normal;
    color: var(--bs-secondary);
}

/* Analysis Results */
.analysis-item {
    border-left: 4px solid var(--bs-secondary);
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--bs-light);
    border-radius: 0 0.375rem 0.375rem 0;
}

.analysis-item.safe {
    border-color: var(--success-color);
    background: rgba(25, 135, 84, 0.1);
}

.analysis-item.warning {
    border-color: var(--warning-color);
    background: rgba(255, 193, 7, 0.1);
}

.analysis-item.danger {
    border-color: var(--danger-color);
    background: rgba(220, 53, 69, 0.1);
}

[data-bs-theme="dark"] .analysis-item {
    background: rgba(255, 255, 255, 0.05);
}

.analysis-item h6 {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.analysis-item .value {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    color: #2c3e50;
}

[data-bs-theme="dark"] .analysis-item .value {
    color: #ecf0f1;
}

.analysis-item .status {
    font-size: 0.875rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.analysis-item .status-detail {
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: var(--bs-secondary);
}

/* Propane tank editor */
.propane-tank-row {
    border: 1px solid var(--bs-border-color);
    background-color: var(--bs-body-bg);
    border-radius: 0.5rem;
}

[data-bs-theme="dark"] .propane-tank-row {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Section Headers for Grouped Results */
.section-header {
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    margin-top: 2rem;
}

.section-header:first-child {
    margin-top: 1rem;
}

.section-header h5 {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0;
    font-size: 1.1rem;
}

[data-bs-theme="dark"] .section-header {
    border-bottom-color: #4a90e2;
}

[data-bs-theme="dark"] .section-header h5 {
    color: #5ca0f2;
}

.section-header i {
    opacity: 0.8;
}

.section-header small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    font-weight: normal;
}

/* Payload Items */
.payload-item {
    display: flex;
    align-items: center;
    justify-content: between;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--bs-light);
    border-radius: 0.375rem;
    border: 1px solid var(--bs-border-color);
}

[data-bs-theme="dark"] .payload-item {
    background: rgba(255, 255, 255, 0.05);
}

.payload-item-name {
    flex: 1;
    font-weight: 500;
}

.payload-item-weight {
    margin-left: 1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.payload-item-remove {
    margin-left: 0.5rem;
}

/* Checklist Items */
.checklist-category {
    margin-bottom: 1.5rem;
}

.checklist-category h6 {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--bs-border-color);
    padding-bottom: 0.25rem;
}

.checklist-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.checklist-item:last-child {
    border-bottom: none;
}

.checklist-item input[type="checkbox"] {
    margin-right: 0.75rem;
    transform: scale(1.1);
}

.checklist-item label {
    flex: 1;
    margin-bottom: 0;
    cursor: pointer;
    user-select: none;
}

.checklist-item.completed label {
    text-decoration: line-through;
    opacity: 0.6;
}

/* Toast styling */
.toast {
    --bs-toast-max-width: 350px;
}

/* Form enhancements */
.form-label {
    font-weight: 500;
    margin-bottom: 0.375rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Units label styling */
.units-label {
    font-size: 0.875rem;
    color: var(--bs-secondary);
    font-weight: normal;
}

/* Button enhancements */
.btn {
    font-weight: 500;
    border-radius: 0.375rem;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Responsive design */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .safety-gauge {
        width: 150px;
        height: 90px;
        margin: 1.5rem auto 3rem;
    }
    
    .gauge-inner {
        top: 15px;
        left: 15px;
        right: 15px;
    }
    
    .gauge-needle {
        height: 45px;
    }
    
    .gauge-score {
        font-size: 1.5rem;
        bottom: -40px;
    }
    
    .nav-pills .nav-link {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
}

/* Animation utilities */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Utility classes */
.text-gradient {
    background: linear-gradient(45deg, var(--primary-color), var(--info-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-custom {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1) !important;
}

/* Enhanced share UI */
.share-url-display {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(13, 110, 253, 0.05);
    border-radius: 8px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.share-url-display input {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    background: white;
}

[data-bs-theme="dark"] .share-url-display input {
    background: #2d2d2d;
    color: #ffffff;
}

.load-section {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

[data-bs-theme="dark"] .load-section {
    background: #2d2d2d;
}

.import-export-section {
    padding: 1rem;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

[data-bs-theme="dark"] .import-export-section {
    background: #1a1a1a;
    border-color: #404040;
}

.share-section h6,
.load-section h6,
.import-export-section h6 {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

#shareStatus {
    border-left: 4px solid;
}

#shareStatus.alert-success {
    border-left-color: var(--success-color);
}

#shareStatus.alert-danger {
    border-left-color: var(--danger-color);
}

#shareStatus.alert-info {
    border-left-color: var(--info-color);
}

/* Share button enhanced styles */
#shareUrl {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#shareUrl:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

#shareUrl:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

#shareUrl:hover:before {
    left: 100%;
}

/* QR Code styling */
.qr-code-container {
    padding: 1.5rem 1rem;
    background: linear-gradient(to bottom, #f8f9fa, #ffffff);
    border-radius: 12px;
    border: 2px solid #e9ecef;
    margin-top: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] .qr-code-container {
    background: linear-gradient(to bottom, #2d2d2d, #1a1a1a);
    border-color: #404040;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

#shareQRCode {
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-bs-theme="dark"] #shareQRCode {
    background: white;
    padding: 1rem;
}

#shareQRCode canvas {
    display: none !important;
}

#shareQRCode img {
    display: block !important;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: 4px;
}

#toggleQRCode {
    transition: all 0.3s ease;
    width: 100%;
}

#toggleQRCode:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Ensure share buttons are clickable and above everything */
#shareUrl, #toggleQRCode, #copyShareUrlBtn, #loadShareBtn {
    position: relative;
    z-index: 1000 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* Debug styles to ensure visibility */
#shareUrl:active {
    background-color: #0056b3 !important;
    border-color: #0056b3 !important;
}

.share-section {
    position: relative;
    z-index: 100;
    pointer-events: auto;
}

.qr-code-container small {
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.8;
}

/* Print styles */
@media print {
    .navbar,
    .wizard-step:not(#step4),
    .btn,
    .toast-container {
        display: none !important;
    }
    
    .wizard-step#step4 {
        display: block !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
    
    .safety-gauge {
        margin-bottom: 1rem;
    }
}
