/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #7bb3d3 0%, #5c97b8 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    background: white;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.1rem;
    color: #666;
}

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.profile-count {
    background: #f0f0f0;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: #666;
}

/* Form Styles */
form {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.form-section {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.form-section h2 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-group {
    flex: 1;
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #7bb3d3;
    box-shadow: 0 0 0 3px rgba(123, 179, 211, 0.1);
}

/* Native Camera Section for Mobile */
.native-camera-section {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e1f0f7 100%);
    border-radius: 15px;
    border: 2px solid #7bb3d3;
    margin: 20px 0;
}

.camera-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.native-camera-section h3 {
    color: #333;
    font-size: 1.5rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.native-camera-section p {
    color: #666;
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 25px;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.native-camera-btn {
    background: linear-gradient(135deg, #7bb3d3 0%, #5c97b8 100%);
    color: white;
    border: none;
    padding: 18px 36px;
    border-radius: 25px;
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(123, 179, 211, 0.3);
    margin-bottom: 15px;
    min-height: 56px;
    width: 100%;
    max-width: 280px;
}

.native-camera-btn:hover,
.native-camera-btn:active {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(123, 179, 211, 0.4);
}

.native-camera-btn:active {
    transform: translateY(0);
}

.help-text {
    font-size: 0.85rem !important;
    color: #7bb3d3 !important;
    font-style: italic;
    margin-bottom: 0 !important;
    margin-top: 10px !important;
}

/* Pulse animation for camera icon */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Photo preview styling for native camera */
.photo-preview {
    margin-top: 25px;
    text-align: center;
    background: white;
    padding: 20px;
    border-radius: 15px;
    border: 2px solid #4caf50;
}

.photo-preview img {
    width: 100%;
    max-width: 300px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    margin-bottom: 15px;
}

.photo-preview h4 {
    color: #4caf50;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.photo-preview p {
    color: #666;
    font-size: 0.9rem;
    margin: 0;
}

/* Success state after photo taken */
.photo-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-color: #4caf50;
}

.retake-native-btn {
    margin-top: 15px;
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 20px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.retake-native-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

/* FIXED: Camera Section - Enhanced for mobile */
.camera-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.camera-container {
    position: relative;
    width: 100%;
    margin: 0 auto 20px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    /* FIXED: Remove fixed aspect ratio that was causing black bars */
}

#video {
    width: 100%;
    height: auto;
    display: block;
    /* FIXED: Better object-fit for mobile */
    object-fit: cover;
    /* FIXED: Ensure minimum height but allow natural aspect ratio */
    min-height: 240px;
    max-height: 400px;
}

.camera-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* File Upload */
.upload-section {
    text-align: center;
    margin: 20px 0;
}

.file-upload {
    position: relative;
    display: inline-block;
}

.file-upload input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-label {
    display: inline-block;
    padding: 12px 24px;
    background: #7bb3d3;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.file-upload-label:hover {
    background: #5c97b8;
}

/* LEGO Preview */
.lego-preview {
    background: #f0f8ff;
    border: 2px solid #7bb3d3;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-top: 20px;
}

.lego-loading {
    padding: 20px;
}

.lego-result img {
    max-width: 300px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    margin-bottom: 15px;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #7bb3d3, #5c97b8);
    width: 0;
    transition: width 0.3s ease;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
    line-height: 1.5;
}

.btn-primary {
    background: #7bb3d3;
    color: white;
}

.btn-primary:hover {
    background: #5c97b8;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(123, 179, 211, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.3);
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.2rem;
    width: 100%;
}

.btn-icon {
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: #7bb3d3;
    color: white;
}

.btn-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Checkbox */
.checkbox-group {
    margin: 20px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.checkbox-label:hover {
    background: #e1f0f7;
    border-color: #7bb3d3;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 12px;
    width: 20px;
    height: 20px;
}

/* Spinners */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #7bb3d3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

.spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #7bb3d3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loading States */
.submit-loading {
    text-align: center;
    padding: 20px;
}

/* Messages */
.success-message,
.error-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.success-content,
.error-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.success-content h2 {
    color: #28a745;
    margin-bottom: 15px;
}

.error-content h3 {
    color: #dc3545;
    margin-bottom: 15px;
}

.success-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    font-weight: 600;
    z-index: 1000;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Gallery Styles */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.profile-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.profile-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

.profile-photos {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.photo-container {
    flex: 1;
    position: relative;
}

.photo-container img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.photo-placeholder {
    width: 100%;
    height: 120px;
    background: #f8f9fa;
    border: 2px dashed #ccc;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
}

.photo-placeholder span {
    font-size: 2rem;
    margin-bottom: 5px;
}

.photo-label {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

.profile-info h3 {
    font-size: 1.3rem;
    margin-bottom: 5px;
    color: #333;
}

.company-position {
    color: #7bb3d3;
    font-weight: 600;
    margin-bottom: 5px;
}

.email {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.profile-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #999;
}

.email-status {
    background: #d4edda;
    color: #155724;
    padding: 2px 6px;
    border-radius: 10px;
}

.profile-actions {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 5px;
}

/* Empty Gallery */
.empty-gallery {
    text-align: center;
    padding: 60px 20px;
}

.empty-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    display: inline-block;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.empty-content h2 {
    color: #666;
    margin-bottom: 15px;
}

/* Statistics Panel */
.stats-panel {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    margin-top: 30px;
}

.stats-panel h3 {
    margin-bottom: 20px;
    color: #333;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: #7bb3d3;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 15px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-header h2 {
    margin: 0;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 25px;
}

.modal-actions {
    padding: 20px 25px;
    border-top: 2px solid #f0f0f0;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

/* Profile Detail Page */
.back-nav {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.photos-showcase {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
    justify-content: center;
    flex-wrap: wrap;
}

.photo-showcase-item {
    text-align: center;
    max-width: 300px;
}

.photo-frame {
    position: relative;
    margin-bottom: 15px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.profile-photo-large,
.lego-photo-large {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

.photo-placeholder-large {
    width: 100%;
    height: 300px;
    background: #f8f9fa;
    border: 2px dashed #ccc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
}

.photo-placeholder-large span {
    font-size: 3rem;
    margin-bottom: 10px;
}

.photo-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.profile-info-detailed {
    background: white;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.info-section {
    padding: 25px;
    border-bottom: 2px solid #f0f0f0;
}

.info-section:last-child {
    border-bottom: none;
}

.info-section h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.4rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.info-item label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-item p {
    font-size: 1.1rem;
    color: #333;
    font-weight: 500;
}

.survey-responses {
    space-y: 20px;
}

.survey-item {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #7bb3d3;
}

.survey-item h4 {
    color: #7bb3d3;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.survey-item p {
    color: #555;
    line-height: 1.6;
}

.settings-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.enabled {
    background: #d4edda;
    color: #155724;
}

.status-badge.disabled {
    background: #f8d7da;
    color: #721c24;
}

.ai-details {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.ai-details label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #555;
}

.prompt-display {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin-bottom: 15px;
}

.prompt-display p {
    margin: 0;
    color: #333;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

.profile-actions-bar {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.profile-detail {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.profile-photos-large {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.photo-large {
    text-align: center;
}

.photo-large img {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    margin-bottom: 10px;
}

.photo-large p {
    font-weight: 600;
    color: #333;
}

.profile-details {
    flex: 1;
}

.detail-section {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.detail-section h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.2rem;
}

.detail-section p {
    margin-bottom: 8px;
    color: #555;
}

.survey-response {
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #7bb3d3;
}

.survey-response p:first-child {
    font-weight: 600;
    color: #7bb3d3;
    margin-bottom: 8px;
}

.survey-response p:last-child {
    margin-bottom: 0;
    color: #333;
}

/* HubSpot Integration Styles */
.hubspot-info {
    background: #e8f4f8;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: center;
}

.hubspot-info p {
    margin: 10px 0;
    color: #7bb3d3;
}

.hubspot-integration-info {
    display: grid;
    gap: 30px;
    margin-bottom: 40px;
}

.integration-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.integration-card h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.integration-card p {
    color: #666;
    margin-bottom: 25px;
    font-size: 1.1rem;
}

.feature-list {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #7bb3d3;
}

.feature-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.feature-item h3 {
    color: #333;
    margin: 0 0 8px 0;
    font-size: 1.2rem;
}

.feature-item p {
    color: #666;
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.hubspot-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.properties-list {
    display: grid;
    gap: 15px;
}

.property-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #28a745;
}

.property-item code {
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #495057;
    font-weight: bold;
}

.property-item span:last-child {
    color: #666;
    font-size: 0.9rem;
    margin-left: 15px;
    flex: 1;
    text-align: right;
}

/* FIXED: Mobile Camera Optimizations */
@media (max-width: 768px) {
    /* Prevent zoom on form inputs */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    textarea,
    select {
        font-size: 16px !important; /* Prevents zoom on iOS */
        transform: translateZ(0); /* Force hardware acceleration */
    }
    
    /* Optimized form layout for mobile */
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    /* Mobile-specific adjustments for native camera */
    .native-camera-section {
        padding: 25px 15px;
        margin: 15px 0;
    }
    
    .camera-icon {
        font-size: 3rem;
        margin-bottom: 15px;
    }
    
    .native-camera-section h3 {
        font-size: 1.3rem;
        margin-bottom: 12px;
    }
    
    .native-camera-section p {
        font-size: 0.95rem;
        margin-bottom: 20px;
    }
    
    .native-camera-btn {
        padding: 16px 32px;
        font-size: 1.2rem;
        max-width: 100%;
    }
    
    /* FIXED: Enhanced camera section for mobile selfies */
    .camera-section {
        background: #f8f9fa;
        border-radius: 12px;
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .camera-container {
        /* FIXED: Remove aspect-ratio constraint that was causing issues */
        max-width: 100%;
        margin: 0 auto 20px;
        border-radius: 12px;
        overflow: hidden;
        background: #000;
        /* Let the video determine the container size naturally */
    }
    
    #video {
        width: 100%;
        height: auto;
        object-fit: cover;
        /* FIXED: Mirror effect for selfie preview - moved to JavaScript for better control */
        display: block;
        /* FIXED: Better mobile video handling */
        min-height: 200px;
        max-height: 60vh; /* Don't take up more than 60% of screen height */
    }
    
    /* Mobile-friendly camera controls */
    .camera-controls {
        display: flex;
        justify-content: center;
        gap: 15px;
        flex-wrap: wrap;
        padding: 0 10px;
    }
    
    .camera-controls .btn {
        flex: 1;
        min-width: 120px;
        max-width: 200px;
        padding: 14px 20px;
        font-size: 1.1rem;
        border-radius: 25px;
        font-weight: 600;
    }
    
    /* Enhanced file upload for mobile */
    .file-upload-label {
        display: inline-block;
        padding: 14px 28px;
        background: #7bb3d3;
        color: white;
        border-radius: 25px;
        cursor: pointer;
        transition: all 0.3s ease;
        font-size: 1.1rem;
        font-weight: 600;
        box-shadow: 0 4px 15px rgba(123, 179, 211, 0.3);
    }
    
    .file-upload-label:active {
        transform: scale(0.95);
    }
    
    /* Mobile-optimized buttons */
    .btn {
        padding: 14px 28px;
        font-size: 1.1rem;
        border-radius: 25px;
        font-weight: 600;
        min-height: 48px; /* Touch target size */
        transition: all 0.2s ease;
    }
    
    .btn:active {
        transform: scale(0.95);
    }
    
    .btn-large {
        padding: 18px 36px;
        font-size: 1.3rem;
        width: 100%;
        min-height: 56px;
        border-radius: 28px;
        box-shadow: 0 6px 20px rgba(123, 179, 211, 0.3);
    }
    
    /* Enhanced form sections for mobile scrolling */
    .form-section {
        margin-bottom: 35px;
        padding: 20px;
        background: white;
        border-radius: 15px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    }
    
    .form-section h2 {
        font-size: 1.4rem;
        margin-bottom: 20px;
        padding-bottom: 10px;
        border-bottom: 2px solid #f0f0f0;
    }
    
    /* Mobile textarea optimization */
    textarea {
        min-height: 80px;
        resize: vertical;
        font-size: 16px;
        line-height: 1.5;
    }
    
    /* Loading states optimized for mobile */
    .submit-loading {
        text-align: center;
        padding: 30px 20px;
        background: white;
        border-radius: 15px;
        margin: 20px 0;
    }
    
    .spinner {
        width: 50px;
        height: 50px;
        border: 5px solid #f3f3f3;
        border-top: 5px solid #7bb3d3;
        border-radius: 50%;
        animation: spin 1s linear infinite;
        margin: 0 auto 20px;
    }
    
    /* Error message mobile optimization */
    .error-message {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.9);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1000;
        padding: 20px;
    }
    
    .error-content {
        background: white;
        padding: 30px 25px;
        border-radius: 20px;
        text-align: center;
        max-width: 350px;
        width: 100%;
        box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    }
    
    /* FIXED: Camera error styling */
    .camera-error {
        text-align: center;
        padding: 25px 20px;
        background: #fff3cd;
        border: 2px solid #ffeaa7;
        border-radius: 12px;
        color: #856404;
        margin: 15px 0;
    }
    
    .camera-error p {
        margin-bottom: 10px;
        font-size: 1rem;
        line-height: 1.4;
    }
    
    /* Smooth scrolling for mobile */
    html {
        scroll-behavior: smooth;
    }
    
    /* Form focus states for mobile */
    .form-group input:focus,
    .form-group textarea:focus {
        outline: none;
        border-color: #7bb3d3;
        box-shadow: 0 0 0 3px rgba(123, 179, 211, 0.15);
        transform: translateY(-2px);
    }
    
    .focused {
        transform: translateY(-2px) !important;
        transition: transform 0.3s ease;
    }
    
    /* Checkbox styling for mobile */
    .checkbox-label {
        display: flex;
        align-items: center;
        cursor: pointer;
        font-size: 1rem;
        padding: 18px 20px;
        background: #f8f9fa;
        border-radius: 12px;
        border: 2px solid #e0e0e0;
        transition: all 0.3s ease;
        min-height: 48px;
    }
    
    .checkbox-label:active {
        transform: scale(0.98);
    }
    
    .checkbox-label input[type="checkbox"] {
        margin-right: 15px;
        width: 22px;
        height: 22px;
        transform: scale(1.1);
    }
    
    /* Viewport height fix for mobile browsers */
    .container {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
    
    /* Safe area adjustments for newer phones */
    @supports (padding-top: env(safe-area-inset-top)) {
        .container {
            padding-top: max(20px, env(safe-area-inset-top));
            padding-bottom: max(20px, env(safe-area-inset-bottom));
            padding-left: max(20px, env(safe-area-inset-left));
            padding-right: max(20px, env(safe-area-inset-right));
        }
    }
}

/* iPhone specific camera optimizations */
@media (max-width: 480px) {
    .container {
        padding: 15px 10px;
    }
    
    .header {
        padding: 25px 20px;
        margin-bottom: 25px;
    }
    
    .header h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .form-section {
        padding: 18px 15px;
        margin-bottom: 25px;
    }
    
    .camera-container {
        margin-bottom: 15px;
    }
    
    #video {
        min-height: 180px;
        max-height: 50vh; /* Even smaller on iPhone */
    }
    
    .camera-controls .btn {
        min-width: 100px;
        padding: 12px 16px;
        font-size: 1rem;
    }
    
    .btn-large {
        padding: 16px 30px;
        font-size: 1.2rem;
        min-height: 52px;
    }
    
    .native-camera-section {
        padding: 20px 12px;
    }
    
    .camera-icon {
        font-size: 2.5rem;
    }
    
    .native-camera-section h3 {
        font-size: 1.2rem;
    }
    
    .native-camera-btn {
        padding: 14px 28px;
        font-size: 1.1rem;
    }
}

/* Landscape mobile optimization - FIXED */
@media (max-width: 768px) and (orientation: landscape) {
    #video {
        max-height: 70vh; /* Use more height in landscape */
        min-height: 150px;
    }
    
    /* Reduce vertical spacing in landscape */
    .camera-section {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .form-section {
        margin-bottom: 25px;
    }
    
    .header {
        padding: 20px;
        margin-bottom: 20px;
    }
}

/* High DPI screen optimizations for camera */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .photo-preview img,
    #video {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* FIXED: Better video element handling for different devices */
@supports (-webkit-appearance: none) {
    /* iOS Safari specific fixes */
    #video {
        -webkit-appearance: none;
        -webkit-playsinline: true;
    }
}

/* Responsive Design - Continue with existing responsive styles */
@media (max-width: 768px) {
    .hubspot-actions {
        flex-direction: column;
    }
    
    .feature-item {
        flex-direction: column;
        text-align: center;
    }
    
    .property-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .property-item span:last-child {
        text-align: left;
        margin-left: 0;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .profile-photos {
        flex-direction: column;
    }
    
    .photos-showcase {
        flex-direction: column;
        align-items: center;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .profile-actions-bar {
        flex-direction: column;
    }
    
    .success-actions {
        flex-direction: column;
    }
    
    .header-actions {
        flex-direction: column;
        gap: 15px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .modal-content {
        margin: 10px;
        max-height: 95vh;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .back-nav {
        flex-direction: column;
    }
    
    .profile-detail {
        gap: 20px;
    }
    
    .profile-photos-large {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .profile-card {
        padding: 15px;
    }
    
    .photo-container img {
        height: 100px;
    }
    
    .photo-placeholder {
        height: 100px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .modal-actions {
        padding: 15px;
    }
    
    .profile-info-detailed .info-section {
        padding: 20px 15px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    .header {
        box-shadow: none;
        border-bottom: 2px solid #333;
    }
    
    .back-nav,
    .profile-actions-bar,
    .header-actions,
    .camera-controls,
    .photo-actions {
        display: none !important;
    }
    
    .profile-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #333;
    }
    
    .photos-showcase {
        flex-direction: row;
        justify-content: space-around;
    }
    
    .photo-showcase-item {
        max-width: 250px;
    }
    
    .btn {
        display: none;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Loading States */
.loading {
    text-align: center;
    padding: 40px;
}

.loading p {
    margin-top: 15px;
    color: #666;
}

/* Focus States for Accessibility */
.btn:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #7bb3d3;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .btn-primary {
        background: #000;
        border: 2px solid #000;
    }
    
    .btn-secondary {
        background: #444;
        border: 2px solid #444;
    }
    
    .profile-card {
        border: 2px solid #333;
    }
    
    .form-group input,
    .form-group textarea {
        border: 2px solid #333;
    }
}

/* 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;
    }
    
    .spinner {
        animation: none;
        border: 4px solid #7bb3d3;
    }
}