/* Trailer Inspection PWA - Styles */

:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #f8f9fa;
}

/* Navbar */
.navbar {
    z-index: 1030;
}

/* Fixed tabs below navbar */
.fixed-tabs {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    z-index: 1020;
    background: #fff;
    border-bottom: 1px solid #dee2e6;
}

.fixed-tabs .nav-link {
    border-radius: 0;
    padding: 12px 8px;
    font-size: 14px;
}

.fixed-tabs .nav-link.active {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.fixed-tabs .nav-link:not(.active) {
    color: #495057;
}

/* Tab content area */
.tab-content {
    margin-top: 110px;
    padding-bottom: 20px;
    min-height: calc(100vh - 110px);
}

/* Survey screens */
.survey-screen {
    animation: fadeIn 0.3s ease-in-out;
}

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

/* Cards */
.card {
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: none;
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
}

/* Form elements */
.form-select, .form-control {
    padding: 12px 16px;
    font-size: 16px;
    border-radius: 8px;
    border: 2px solid #e9ecef;
}

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

.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
}

/* Buttons */
.btn {
    border-radius: 8px;
    font-weight: 600;
    padding: 12px 24px;
    transition: all 0.2s ease;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

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

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

/* Button groups for Yes/No options */
.btn-group .btn {
    flex: 1;
}

.btn-group .btn-outline-primary.active,
.btn-group .btn-check:checked + .btn-outline-primary {
    background-color: var(--primary-color);
    color: #fff;
}

/* Photo preview */
#photo-preview {
    min-height: 60px;
}

#photo-preview img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
}

.photo-item {
    position: relative;
}

.photo-item .btn-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(220, 53, 69, 0.9);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    padding: 0;
    line-height: 24px;
    cursor: pointer;
}

.photo-item .btn-remove:hover {
    background: rgba(220, 53, 69, 1);
}

/* Existing damages list */
.damage-item {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 4px solid var(--warning-color);
}

.damage-item.clickable {
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.damage-item.clickable:hover {
    background: #e9ecef;
}

.damage-item.clickable:active {
    transform: scale(0.98);
}

.damage-item.new-damage {
    border-left-color: var(--danger-color);
    background: #fff5f5;
}

.damage-item .damage-type {
    font-weight: 600;
    color: #333;
}

.damage-item .damage-position {
    color: #666;
    font-size: 14px;
}

/* Damage photos in modal */
.damage-photo {
    transition: transform 0.2s ease;
}

.damage-photo:hover {
    transform: scale(1.05);
}

/* Loading overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

#loading-overlay.d-none {
    display: none !important;
}

/* Toast styling */
.toast {
    min-width: 280px;
}

/* Offline indicator */
.offline-indicator {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--warning-color);
    color: #333;
    text-align: center;
    padding: 8px;
    font-size: 14px;
    font-weight: 600;
    z-index: 1025;
}

.offline-indicator.d-none {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn-group .btn {
        border-radius: 8px !important;
        margin-bottom: 8px;
    }

    .btn-group .btn:last-child {
        margin-bottom: 0;
    }
}

/* PWA install prompt */
.install-prompt {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: #333;
    color: #fff;
    padding: 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 9998;
}

.install-prompt.d-none {
    display: none !important;
}

/* Install Banner */
.install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    color: #fff;
    padding: 12px 16px;
    z-index: 9998;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.install-banner.d-none {
    display: none !important;
}

.install-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto;
}

.install-banner-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.install-banner-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.install-banner-text strong {
    font-size: 14px;
}

.install-banner-text span {
    font-size: 12px;
    opacity: 0.9;
}

.install-banner-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.install-banner-actions .btn-outline-light {
    padding: 4px 8px;
    border: none;
    background: rgba(255,255,255,0.1);
}

.install-banner-actions .btn-outline-light:hover {
    background: rgba(255,255,255,0.2);
}

/* iOS-specific install instructions */
.ios-instructions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
}

.ios-instructions .step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.ios-instructions .step-number {
    width: 20px;
    height: 20px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    flex-shrink: 0;
}

/* Adjust tab content when banner is visible */
body.install-banner-visible .tab-content {
    padding-bottom: 80px;
}

/* Success animation */
@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.success-animation {
    animation: successPulse 0.5s ease-in-out;
}
