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

:root {
    --primary-color: #4A90D9;
    --primary-hover: #357ABD;
    --secondary-color: #95A5A6;
    --secondary-hover: #7F8C8D;
    --danger-color: #E74C3C;
    --danger-hover: #C0392B;
    --success-color: #27AE60;
    --warning-color: #F39C12;
    --bg-color: #F5F7FA;
    --card-bg: #FFFFFF;
    --text-color: #2C3E50;
    --text-muted: #7F8C8D;
    --border-color: #E1E8ED;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --modal-overlay: rgba(0, 0, 0, 0.6);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    padding: 20px 0;
    position: relative;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Help Button */
.btn-help {
    position: absolute;
    top: 20px;
    right: 0;
    width: 36px;
    height: 36px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    background: var(--card-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.1s;
}

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

.btn-help:hover .help-icon {
    color: white;
}

.help-icon {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
}

main {
    flex: 1;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 1.2rem;
    margin-bottom: 16px;
    color: var(--text-color);
}

.hidden {
    display: none !important;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group input[type="file"] {
    width: 100%;
    padding: 12px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    background: var(--bg-color);
}

#photo-preview {
    margin-top: 12px;
    text-align: center;
}

#photo-preview img,
#saved-photo {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    margin-bottom: 10px;
}

#photo-preview-container {
    margin: 16px 0;
    text-align: center;
}

/* Button Styles */
.btn {
    display: inline-block;
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    width: 100%;
}

.btn:active {
    transform: scale(0.98);
}

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

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

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: var(--danger-hover);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
    width: auto;
}

/* Saved Location Display */
#location-display {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    text-align: center;
}

.time-stamp {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Location Coordinates Display */
.location-coords {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 12px;
    padding: 8px 12px;
    background: rgba(74, 144, 217, 0.1);
    border-radius: 6px;
    display: inline-block;
}

/* Map Container */
.map-container {
    width: 100%;
    height: 200px;
    margin-top: 16px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border-color);
}

/* Footer */
footer {
    text-align: center;
    padding: 20px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.privacy-notice {
    display: inline-block;
    background: linear-gradient(135deg, #2C3E50 0%, #34495E 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Photo wrapper with overlay button */
.photo-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.photo-wrapper img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    display: block;
    transition: opacity 0.2s;
}

.btn-remove-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background-color: rgba(231, 76, 60, 0.9);
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.1s, outline 0.1s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.btn-remove-overlay:focus {
    outline: 2px solid var(--primary-color, #4A90D9);
    background-color: rgba(192, 57, 43, 1);
}

.btn-remove-overlay:hover {
    background-color: rgba(192, 57, 43, 1);
    transform: scale(1.1);
}

.btn-remove-overlay:active {
    transform: scale(0.95);
}

/* Install Guide Styles */
.install-instructions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.install-option {
    background: var(--bg-color, #F5F7FA);
    border-radius: 8px;
    padding: 12px 16px;
}

.install-option summary {
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
    list-style: none;
}

.install-option summary::-webkit-details-marker {
    display: none;
}

.install-option summary::before {
    content: "▶ ";
    display: inline-block;
    transition: transform 0.2s;
}

.install-option[open] summary::before {
    transform: rotate(90deg);
}

.install-option ol {
    margin-top: 12px;
    margin-left: 24px;
    color: var(--text-color, #2C3E50);
}

.install-option ol li {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* Hidden Input */
.hidden-input {
    display: none;
}

/* Photo Action Buttons */
.photo-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-photo-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    font-size: 1.1rem;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--secondary-hover);
}

/* Elapsed Time Display */
.elapsed-time-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, #357ABD 100%);
    color: white;
    text-align: center;
}

.elapsed-time-card h2 {
    color: white;
    font-size: 1rem;
    margin-bottom: 8px;
}

.elapsed-time-display {
    padding: 16px 0;
}

.elapsed-time-value {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 2px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', monospace;
    display: block;
}

.parked-at-text {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 8px;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-overlay);
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    max-width: 90%;
    max-height: 90%;
    width: 400px;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background-color: var(--text-muted);
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.modal-close-btn:hover {
    background-color: var(--danger-color);
}

.modal-content h2 {
    margin-bottom: 20px;
    padding-right: 30px;
}

/* Help Modal Styles */
.help-content {
    margin-bottom: 20px;
}

.help-steps {
    list-style: none;
    counter-reset: step-counter;
}

.help-steps li {
    margin-bottom: 16px;
    padding-left: 0;
}

.help-steps li strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 4px;
    color: var(--text-color);
}

.help-steps li p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Install Guide Section in Help Modal */
.install-guide-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.install-guide-section h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--text-color);
}

.help-footer {
    display: flex;
    justify-content: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* Zoom Modal Styles */
.zoom-modal .modal-overlay {
    background-color: rgba(0, 0, 0, 0.9);
}

.zoom-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.zoom-content .modal-close-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    background-color: rgba(255, 255, 255, 0.3);
}

.zoom-content .modal-close-btn:hover {
    background-color: var(--danger-color);
}

.zoom-image-container {
    max-width: 100%;
    max-height: 100%;
    overflow: auto;
    touch-action: manipulation;
    -webkit-overflow-scrolling: touch;
}

#zoom-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

#zoom-image.zoomed {
    cursor: zoom-out;
    max-width: none;
    max-height: none;
}

.photo-wrapper:hover img {
    opacity: 0.95;
}

/* Responsive adjustments */
@media (max-width: 360px) {
    .container {
        padding: 12px;
    }
    
    header h1 {
        font-size: 1.6rem;
    }
    
    .card {
        padding: 16px;
    }

    .elapsed-time-value {
        font-size: 2.2rem;
    }

    .btn-help {
        width: 32px;
        height: 32px;
    }

    .help-icon {
        font-size: 1rem;
    }
}
