:root {
    --bg-color: #000000;
    --card-bg: #1C1C1E;
    --text-primary: #FFFFFF;
    --text-secondary: #8E8E93;
    --border-color: #333333;
    --system-blue: #0A84FF;
    --system-red: #FF453A;
    --system-green: #30D158;
    --system-yellow: #FFD60A;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    font-size: 16px;
    line-height: 1.5;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

h1, h2, h3 {
    font-weight: 600;
    margin-bottom: 0.5em;
}

h1 {
    font-size: 1.8rem;
    text-align: center;
    margin-top: 20px;
    margin-bottom: 24px;
}

.card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    border: 0.5px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    position: relative;
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.input-group .description {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.3;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="date"],
textarea,
select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 12px 16px;
    background-color: #2C2C2E;
    border: 1px solid #3A3A3C;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--system-blue);
}

button {
    background-color: var(--system-blue);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 9999px;
    font-size: 1.1rem;
    font-weight: 600;
    width: 100%;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.1s ease;
}

button:active {
    opacity: 0.8;
    transform: scale(0.98);
}

button.destructive {
    background-color: var(--system-red);
}

button.secondary {
    background-color: #2C2C2E;
    color: var(--system-blue);
}

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

#vin-search-container {
    text-align: center;
}

#vin-input {
    font-family: monospace;
    font-size: 1.3rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.invalid-vin {
    border-color: var(--system-red) !important;
}

.error-text {
    color: var(--system-red);
    font-size: 0.85rem;
    margin-top: 8px;
    display: none;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    padding: 24px 0;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    -webkit-overflow-scrolling: touch;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    padding: 24px;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    align-self: center;
    margin: auto;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.glass-card {
    background: rgba(28, 28, 30, 0.8) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
}

.close-apple-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8E8E93;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.1s ease;
    padding: 0;
    z-index: 10;
}

.close-apple-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
}

.close-apple-btn:active {
    transform: scale(0.92);
}

.close-apple-btn svg {
    width: 16px;
    height: 16px;
}

/* Car Profile */
.car-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.car-image {
    width: 100%;
    max-height: 250px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 16px;
    background-color: #2C2C2E;
}

.car-title {
    font-size: 1.5rem;
    text-align: center;
}

.car-specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.spec-item {
    background-color: #2C2C2E;
    padding: 12px;
    border-radius: 10px;
}

.spec-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.spec-value {
    font-size: 1.1rem;
    font-weight: 500;
}

.odo-updater {
    display: flex;
    gap: 10px;
    align-items: center;
}

.odo-updater input {
    flex: 1;
}

.odo-updater button {
    width: auto;
    padding: 12px 20px;
}

/* Status Indicator */
.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.status-green { background-color: var(--system-green); }
.status-yellow { background-color: var(--system-yellow); }
.status-red { background-color: var(--system-red); }

/* Service Records List */
.service-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.service-item {
    background-color: #2C2C2E;
    border-radius: 12px;
    padding: 16px;
    position: relative;
    overflow: hidden;
}

.service-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.service-item.green::before { background-color: var(--system-green); }
.service-item.yellow::before { background-color: var(--system-yellow); }
.service-item.red::before { background-color: var(--system-red); }
.service-item.blue::before { background-color: var(--system-blue); }
.service-item.planned::before { background-color: #FF9500 !important; }



.service-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.service-part {
    font-weight: 600;
    font-size: 1.1rem;
}

.service-date {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.service-details {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    width: 100%;
}

.service-notes {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-top: 8px;
    width: 100%;
    word-wrap: break-word;
}

.service-wear {
    margin-top: 10px;
    font-size: 0.85rem;
    font-weight: 500;
}

.wear-bar-container {
    height: 6px;
    background-color: #3A3A3C;
    border-radius: 3px;
    margin-top: 6px;
    overflow: hidden;
}

.wear-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease, background-color 0.5s ease;
}

hr {
    border: none;
    border-top: 0.5px solid var(--border-color);
    margin: 20px 0;
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: rgba(28, 28, 30, 0.95);
    color: white;
    padding: 12px 24px;
    border-radius: 9999px;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2000;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.manage-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: 1px solid var(--system-blue);
    color: var(--system-blue);
    width: auto;
    padding: 6px 14px;
    font-size: 0.9rem;
}

header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 20px);
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.1);
}
header h1 {
    margin: 0;
    font-size: 1.2rem;
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary);
}
.app-logo svg {
    width: 28px;
    height: 28px;
    fill: #FFFFFF;
}
.app-logo .logo-text {
    font-size: 1.4rem;
    font-weight: 400;
    letter-spacing: -0.5px;
    color: #FFFFFF;
}
.logo-accent {
    color: #D4AF37;
    font-weight: 700;
}

.menu-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}
.menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}
.menu-toggle svg {
    width: 28px;
    height: 28px;
    stroke: var(--text-primary);
}

/* Glassmorphism Drawer */
.glass-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}
.glass-overlay.active {
    opacity: 1;
    visibility: visible;
}

.glass-drawer {
    position: fixed;
    top: 0; right: -320px; bottom: 0;
    width: 300px;
    background: rgba(28, 28, 30, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 2001;
    transform: translateX(0);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 0.5px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.glass-overlay.active .glass-drawer {
    transform: translateX(-320px);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.1);
}
.drawer-title {
    font-size: 1.2rem;
    font-weight: 600;
}
.drawer-close {
    background: none;
    border: none;
    cursor: pointer;
    width: auto;
    padding: 8px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.drawer-close svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

.drawer-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.drawer-nav a {
    display: block;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 500;
    padding: 8px 0;
    transition: color 0.2s ease, opacity 0.2s ease;
}
.drawer-nav a:hover, .drawer-nav a:active {
    opacity: 0.7;
}
.drawer-nav a.active {
    color: var(--system-blue);
}

.drawer-footer {
    padding: 16px 24px;
    border-top: 0.5px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}
.drawer-footer .info-block {
    margin-bottom: 10px;
}
.drawer-footer .info-block strong {
    display: block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.drawer-footer .info-block a, .drawer-footer .info-block span {
    font-size: 0.95rem;
    color: var(--text-primary);
    text-decoration: none;
}
.drawer-footer .version {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 16px;
}


/* Garage List Styles */
.garage-list {
    list-style: none;
    padding: 0;
}

.garage-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background-color: #2C2C2E;
    border-radius: 12px;
    margin-bottom: 12px;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.1s ease;
    border: 0.5px solid var(--border-color);
}

.garage-item:hover {
    background-color: #3A3A3C;
}

.garage-item:active {
    transform: scale(0.99);
}

.garage-thumb {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    object-fit: cover;
    background-color: #1C1C1E;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    border: 0.5px solid #444;
}

.garage-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.garage-thumb svg {
    width: 24px;
    height: 24px;
    fill: var(--text-secondary);
}

.garage-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.garage-vin {
    font-weight: 600;
    color: var(--system-blue);
    font-size: 1rem;
    margin-bottom: 2px;
}

.garage-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Swipe logic for Garage Items */
.swipe-container {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 12px;
    background-color: var(--system-red); /* Delete button background */
    touch-action: pan-y; /* Allow vertical scroll but handle horizontal swipe */
}

.swipe-content {
    position: relative;
    z-index: 2;
    background-color: var(--card-bg);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

/* Override garage-item margin when inside swipe-container */
.swipe-content .garage-item {
    margin-bottom: 0;
    border-color: transparent;
}

.swipe-actions {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1; /* Behind content by default */
}

.delete-swipe-btn {
    width: 100%;
    height: 100%;
    background-color: var(--system-red);
    color: white;
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 0;
    position: relative;
    z-index: 10; /* High z-index to stay above background layers */
    pointer-events: auto; /* Ensure it catches clicks */
}

.delete-swipe-btn:active {
    background-color: #D73830;
}

/* Camera Upload Button Styles */
.file-upload-container {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 10px;
}

.camera-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background-color: #2C2C2E;
    border-radius: 16px;
    color: var(--system-blue);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    border: 0.5px solid var(--border-color);
}

.camera-button:hover {
    background-color: #3A3A3C;
}

.camera-button:active {
    transform: scale(0.92);
}

.camera-button svg {
    width: 32px;
    height: 32px;
}

.file-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.upload-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#file-name-display {
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Custom Modern File Upload Component */
.custom-file-input-wrapper {
    position: relative;
    width: 100%;
    margin-top: 6px;
    margin-bottom: 6px;
}

.custom-file-input-wrapper input[type="file"].custom-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 5;
}

.custom-file-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px dashed rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    text-align: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.custom-file-input-wrapper:hover .custom-file-dropzone,
.custom-file-input-wrapper input[type="file"].custom-file-input:focus + .custom-file-dropzone,
.custom-file-dropzone.dragover {
    background: rgba(10, 132, 255, 0.08);
    border-color: var(--system-blue);
    box-shadow: 0 0 16px rgba(10, 132, 255, 0.15);
}

.custom-file-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(10, 132, 255, 0.12);
    color: var(--system-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.custom-file-input-wrapper:hover .custom-file-icon {
    transform: translateY(-2px) scale(1.05);
    background: rgba(10, 132, 255, 0.2);
}

.custom-file-icon svg {
    width: 22px;
    height: 22px;
}

.custom-file-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.custom-file-subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* Preview Grid for selected attachments */
.custom-file-preview-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.custom-file-preview-grid:empty {
    display: none;
}

.custom-file-preview-item {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: filePreviewFadeIn 0.2s ease-out;
}

@keyframes filePreviewFadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.custom-file-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.custom-file-preview-item .remove-file-btn {
    position: absolute;
    top: 3px;
    right: 3px;
    background: rgba(255, 59, 48, 0.9);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.custom-file-preview-item .remove-file-btn:hover {
    transform: scale(1.15);
    background: rgba(255, 69, 58, 1);
}

.custom-file-preview-item .file-name-tag {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 0.65rem;
    padding: 2px 4px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Landing Page */
.landing-section {
    text-align: center;
    padding: 40px 0;
    animation: fadeIn 0.4s ease-out;
}

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

.hero-title {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 16px;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
    line-height: 1.4;
}

.feature-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 40px;
}

@media (min-width: 600px) {
    .feature-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.feature-card {
    background-color: var(--card-bg);
    border: 0.5px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    text-align: left;
}

.feature-card h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.feature-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.lockout-alert {
    background: rgba(255, 69, 58, 0.1);
    color: #FF453A;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 15px;
    text-align: center;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

#app-loader {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #000000;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.6s ease-in-out;
}

#app-loader .spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: app-spinner 0.8s ease-in-out infinite;
}

@keyframes app-spinner {
    to { transform: rotate(360deg); }
}

/* Dashboard Accordion Profile */
.summary-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background-color: #1C1C1E;
    border-radius: 12px;
    border: 0.5px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}
.summary-bar:hover { background-color: #2C2C2E; }
.summary-bar:active { transform: scale(0.99); }
.summary-thumb {
    width: 50px; height: 50px;
    border-radius: 10px;
    background-color: #2C2C2E;
    border: 0.5px solid #444;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.summary-thumb img { width: 100%; height: 100%; object-fit: cover; }
.chevron-icon { transition: transform 0.3s ease; }
.chevron-icon.open { transform: rotate(180deg); }

.accordion-content {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s ease, opacity 0.4s ease;
    opacity: 0;
    overflow: hidden;
}
.accordion-content.expanded {
    grid-template-rows: 1fr;
    opacity: 1;
}
.accordion-inner {
    overflow: hidden;
    min-height: 0;
}

/* Privacy iOS Slide-Up Sheet */
.sheet-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}
.sheet-overlay.active {
    opacity: 1;
    visibility: visible;
}

.slide-up-sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    max-height: 90vh;
    background: rgba(28, 28, 30, 0.9);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: 20px 20px 0 0;
    z-index: 3001;
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    border-top: 0.5px solid rgba(255, 255, 255, 0.1);
}
.sheet-overlay.active .slide-up-sheet {
    transform: translateY(0);
}

.sheet-header {
    display: flex;
    flex-direction: column;
    padding: 18px 24px;
    border-bottom: 0.5px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 10;
}
.sheet-handle {
    display: none !important;
}
.sheet-header .close-apple-btn {
    margin: 0 !important;
    position: static !important;
}
.sheet-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.sheet-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
}
.sheet-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}
.sheet-close:active {
    background: rgba(255, 255, 255, 0.2);
}
.sheet-close svg {
    width: 18px;
    height: 18px;
    stroke: #FFFFFF;
}

.sheet-content {
    padding: 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}
.sheet-content h3 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-top: 24px;
    margin-bottom: 8px;
}
.sheet-content h3:first-child {
    margin-top: 0;
}
.sheet-content a {
    color: var(--system-blue);
    text-decoration: none;
}

/* Desktop Optimizations & Visual Depth */
@media (min-width: 1024px) {
    header {
        padding-left: calc((100% - 1200px) / 2 + 20px);
        padding-right: calc((100% - 1200px) / 2 + 20px);
    }
    .container {
        max-width: 1200px;
        margin: 0 auto;
    }
    
    #vin-search-container {
        max-width: 600px;
        margin: 0 auto 40px auto !important;
    }
    
    .feature-grid {
        gap: 30px;
    }
    
    .feature-card {
        background-color: #1C1C1E;
    }

    .slide-up-sheet {
        max-width: 1200px;
        left: 50%;
        right: auto;
        transform: translateX(-50%) translateY(100%);
    }
    .sheet-overlay.active .slide-up-sheet {
        transform: translateX(-50%) translateY(0);
    }
}

/* Icon Buttons for Service Records */
.icon-btn {
    background: transparent;
    border: none;
    color: #8E8E93;
    padding: 8px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.icon-btn svg {
    width: 18px;
    height: 18px;
}
.icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}
.icon-btn.delete-icon-btn:hover {
    color: #FF3B30;
}

/* Archived Service Records */
.service-item.record-archived {
    opacity: 0.65;
}

.service-item.record-archived::before {
    background-color: #3A3A3C !important;
}

.service-item.record-archived .service-wear {
    opacity: 0.5;
    filter: grayscale(100%);
}

/* About Sheet Icons & Steps */
.about-step {
    display: flex;
    gap: 20px;
    margin-bottom: 28px;
    align-items: flex-start;
}
.about-step-icon {
    width: 48px;
    height: 48px;
    background: rgba(10, 132, 255, 0.1);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--system-blue);
}
.about-step-icon svg {
    width: 24px;
    height: 24px;
}
.about-step-content {
    flex: 1;
}
.about-step-content h4 {
    color: var(--text-primary);
    margin-bottom: 6px;
    font-size: 1.1rem;
    font-weight: 600;
}
.about-step-content p {
    color: #8E8E93;
    font-size: 0.95rem;
    line-height: 1.5;
}

.info-trigger {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    width: auto;
    flex-shrink: 0;
    transition: color 0.2s ease;
}
.info-trigger:hover {
    color: var(--text-primary);
}

/* Pull to Refresh */
#ptr-indicator {
    position: fixed;
    top: -60px;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    pointer-events: none;
    transition: transform 0.2s ease-out, opacity 0.1s ease;
    opacity: 0;
}

#ptr-indicator .spinner-wrapper {
    background: rgba(45, 45, 48, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 50%;
    padding: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    border: 0.5px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

#ptr-indicator .spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--system-blue);
    border-radius: 50%;
    animation: ptr-spin 0.8s linear infinite;
}

@keyframes ptr-spin {
    to { transform: rotate(360deg); }
}

body.ptr-pulling #ptr-indicator {
    opacity: 1;
}

body.ptr-refreshing #ptr-indicator {
    opacity: 1;
    top: 20px;
    transition: top 0.3s ease;
}

.ptr-element {
    transition: transform 0.2s ease-out;
    will-change: transform;
}

/* AI Summary Styles */
#ai-response-content {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-top: 10px;
    color: #e0e0e0;
}

#ai-summary-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    background: #4b5563 !important;
}

/* Apple-style Toggle Switch (Global) */
.ios-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.ios-switch input {
    opacity: 0; width: 0; height: 0;
}
.ios-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #39393d;
    transition: .3s;
    border-radius: 24px;
}
.ios-slider:before {
    position: absolute;
    content: "";
    height: 20px; width: 20px;
    left: 2px; bottom: 2px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
input:checked + .ios-slider {
    background-color: #34c759;
}
input:checked + .ios-slider:before {
    transform: translateX(20px);
}

/* Service Branding on Records */
.service-bg-logo {
    position: absolute;
    top: 50%;
    right: -20px;
    transform: translateY(-50%);
    width: 180px;
    height: 180px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center right;
    opacity: 0.12;
    filter: grayscale(1);
    pointer-events: none;
    z-index: 0;
}

.service-item.has-service {
    border-left: 4px solid var(--system-blue) !important;
}

.service-info-trigger {
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--system-blue);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 10;
    background: rgba(0, 122, 255, 0.1);
    border-radius: 50%;
}

.service-info-trigger:hover {
    opacity: 1;
    transform: scale(1.1);
    background: rgba(0, 122, 255, 0.2);
}

.service-info-trigger svg {
    width: 16px;
    height: 16px;
}

/* VIN Barcode Scan Button */
.vin-scan-btn {
    background: transparent;
    border: none;
    color: #0A84FF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    width: auto;
    flex-shrink: 0;
    border-radius: 10px;
    transition: background-color 0.2s ease, transform 0.15s ease;
}
.vin-scan-btn:hover {
    background-color: rgba(10, 132, 255, 0.12);
}
.vin-scan-btn:active {
    transform: scale(0.88);
    background-color: rgba(10, 132, 255, 0.2);
}

/* Scanner line sweep animation */
@keyframes scanLine {
    0%   { top: 10%; }
    50%  { top: 85%; }
    100% { top: 10%; }
}

/* ─── Wear Alert Modal ─────────────────────────────────── */
.wear-alert-modal-card {
    text-align: left;
}

.wear-alert-icon-row {
    display: flex;
    justify-content: flex-start;
}

.wear-alert-icon-wrap {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: rgba(255, 159, 10, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FF9F0A;
    flex-shrink: 0;
}

.wear-alert-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.1s ease, opacity 0.15s ease;
    border: none;
    text-align: left;
    justify-content: flex-start;
}

.wear-alert-btn:active {
    transform: scale(0.98);
    opacity: 0.85;
}

.wear-alert-btn-snooze-day {
    background: rgba(10, 132, 255, 0.15);
    color: var(--system-blue);
}

.wear-alert-btn-snooze-day:hover {
    background: rgba(10, 132, 255, 0.25);
}

.wear-alert-btn-snooze-week {
    background: rgba(48, 209, 88, 0.12);
    color: var(--system-green);
}

.wear-alert-btn-snooze-week:hover {
    background: rgba(48, 209, 88, 0.22);
}

.wear-alert-btn-never {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.wear-alert-btn-never:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* ─── Attachment Gallery ───────────────────────────── */
.attachment-thumb:hover img {
    transform: scale(1.08);
}

/* ─── Snooze & Warning Management Modal ─────────────────── */
.snooze-badge-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    background: rgba(255, 159, 10, 0.15);
    color: var(--system-yellow);
    border: 1px solid rgba(255, 159, 10, 0.3);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.snooze-badge-btn:hover {
    background: rgba(255, 159, 10, 0.25);
    border-color: rgba(255, 159, 10, 0.45);
    color: var(--system-yellow);
}

.snooze-count-badge {
    background: rgba(255, 214, 10, 0.2);
    color: var(--system-yellow);
    font-weight: 600;
    font-size: 0.7rem;
    padding: 1px 5px;
    border-radius: 4px;
}

.snooze-item-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
    max-height: 340px;
    overflow-y: auto;
    padding-right: 4px;
}

.snooze-item-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.snooze-item-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.15);
}

.snooze-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.snooze-item-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
}

.snooze-item-status {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.snooze-restore-btn {
    padding: 6px 12px;
    background: rgba(10, 132, 255, 0.15);
    color: var(--system-blue);
    border: 1px solid rgba(10, 132, 255, 0.3);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.18s ease;
}

.snooze-restore-btn:hover {
    background: rgba(10, 132, 255, 0.3);
    border-color: var(--system-blue);
    transform: scale(1.03);
}

.snooze-empty-state {
    text-align: center;
    padding: 24px 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ─── Mobile Popup Windows (95% x 95% ar ritināšanu un (x) aizvēršanas pogu) ─── */
.modal-content::-webkit-scrollbar,
.slide-up-sheet::-webkit-scrollbar {
    width: 6px;
}
.modal-content::-webkit-scrollbar-track,
.slide-up-sheet::-webkit-scrollbar-track {
    background: transparent;
}
.modal-content::-webkit-scrollbar-thumb,
.slide-up-sheet::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

@media (max-width: 768px) {
    .modal-overlay {
        padding: 0 !important;
        align-items: center !important;
        justify-content: center !important;
        overflow: hidden !important;
    }

    .modal-content,
    .slide-up-sheet {
        width: 95vw !important;
        width: 95% !important;
        height: 95vh !important;
        height: 95dvh !important;
        max-width: 95vw !important;
        max-height: 95vh !important;
        max-height: 95dvh !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
        position: relative !important;
        margin: auto !important;
        border-radius: 20px !important;
        padding: 24px 20px 24px 20px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
    }

    /* Pielāgojums slide-up lapām mobilajā */
    .sheet-overlay {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
    }

    .sheet-overlay .slide-up-sheet {
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        transform: translateY(20px) !important;
        transition: transform 0.3s ease, opacity 0.3s ease !important;
    }

    .sheet-overlay.active .slide-up-sheet {
        transform: translateY(0) !important;
    }

    /* (x) Aizvēršanas poga labajā augšējā stūrī */
    .close-apple-btn {
        position: sticky !important;
        top: 0 !important;
        align-self: flex-end !important;
        margin-top: -6px !important;
        margin-bottom: -32px !important;
        margin-right: -4px !important;
        z-index: 100 !important;
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        border-radius: 50% !important;
        background: rgba(44, 44, 46, 0.85) !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
    }

    .modal-content h2,
    .modal-content h3 {
        padding-right: 40px;
    }

    .close-apple-btn svg {
        width: 18px !important;
        height: 18px !important;
    }
}



