@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* Custom variables - Premium CAPPES Palette */
:root {
    /* CAPPES Premium Brand Colors */
    --primary: #3d2817;
    --primary-light: #8B6F47;
    --primary-dark: #2d1f11;
    --secondary: #D4AF37;
    --accent: #F4D03F;

    /* Neutral Colors - Premium */
    --gray-50: #FAF8F5;
    --gray-100: #F5F3F0;
    --gray-200: #E8E6E3;
    --gray-300: #D4D2CF;
    --gray-400: #B8B6B3;
    --gray-500: #8A8886;
    --gray-600: #5A5856;
    --gray-700: #433F3D;
    --gray-800: #2D2A28;
    --gray-900: #1A1816;

    /* Status Colors */
    --success: #2D7A4F;
    --error: #C53030;
    --warning: #D4860C;
}

/* Base styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.5;
    color: var(--gray-800);
    background-color: var(--gray-50);
}

/* Form container animations */
#form-container {
    animation: slideInUp 0.6s ease-out;
}

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

/* Step transition animations */
.step-enter {
    animation: stepEnter 0.5s ease-out;
}

.step-exit {
    animation: stepExit 0.3s ease-in;
}

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

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

/* Progress indicators */
.step-indicator {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.step-indicator.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    box-shadow: 0 4px 12px rgba(201, 169, 98, 0.4);
    transform: scale(1.1);
    color: #ffffff !important;
}

.step-indicator.active svg {
    color: #ffffff !important;
}

.step-indicator.completed {
    background: var(--secondary);
    box-shadow: 0 4px 12px rgba(201, 169, 98, 0.3);
    color: #ffffff !important;
}

.step-indicator.completed svg {
    color: #ffffff !important;
}

.step-indicator::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;
}

.step-indicator.active::before {
    left: 100%;
}

/* Form fields */
.form-field {
    position: relative;
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-label.required::after {
    content: '*';
    color: var(--error);
    margin-left: 0.25rem;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-300);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s ease;
    background-color: white;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.form-input:disabled {
    background-color: var(--gray-100);
    color: var(--gray-500);
    cursor: not-allowed;
}

.form-input.error {
    border-color: var(--error);
    background-color: #fef2f2;
}

.form-input.success {
    border-color: var(--success);
    background-color: #f0fdf4;
}

/* Select styling */
.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Textarea styling */
.form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* File upload styling */
.file-upload {
    position: relative;
    display: inline-block;
    cursor: pointer;
    width: 100%;
}

.file-upload-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    background-color: #f9fafb;
    transition: all 0.2s ease;
    cursor: pointer;
}

.file-upload-label:hover {
    border-color: #059669;
    background-color: #f0fdf4;
}

.file-upload.has-file .file-upload-label {
    border-color: #10b981;
    background-color: #f0fdf4;
}

.file-preview {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background-color: var(--gray-100);
    border-radius: 0.5rem;
    margin-top: 0.5rem;
}

.file-preview-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 0.375rem;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.file-preview-info {
    flex: 1;
    min-width: 0;
}

.file-preview-name {
    font-weight: 500;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview-size {
    font-size: 0.75rem;
    color: var(--gray-800);
}

.file-remove-btn {
    padding: 0.5rem;
    color: var(--error);
    hover:color: var(--error);
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.file-remove-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

/* Camera capture */
.camera-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.camera-btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--gray-800);
}

.camera-btn-primary:hover {
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
    transform: translateY(-1px);
}

.camera-btn-secondary {
    background-color: var(--gray-200);
    color: var(--gray-800);
}

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

/* Error messages */
.error-message {
    animation: errorSlideIn 0.3s ease-out;
}

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

/* Success indicators */
.field-success {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--success);
}

/* Loading states */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 0.875rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--gray-800);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: white;
    color: var(--gray-800);
    border: 2px solid var(--gray-300);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--gray-400);
    background-color: var(--gray-50);
}

.btn-danger {
    background-color: var(--error);
    color: var(--gray-800);
}

.btn-danger:hover:not(:disabled) {
    background-color: #dc2626;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}

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

.btn-success:hover:not(:disabled) {
    background-color: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

/* Cards and containers */
.card {
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem 1.5rem 0;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 0 1.5rem 1.5rem;
    background-color: var(--gray-50);
}

/* Grid layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

@media (max-width: 768px) {
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Pain mapping integration */
.pain-mapping-container {
    background: linear-gradient(135deg, var(--gray-50), white);
    border-radius: 1rem;
    padding: 1.5rem;
    border: 2px solid var(--gray-200);
}

.pain-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.pain-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    background-color: var(--error);
    color: var(--gray-800);
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.pain-intensity {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 0.125rem 0.375rem;
    border-radius: 0.75rem;
    font-weight: 700;
}

/* Measurement guide */
.measurement-guide {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: 0.75rem;
    padding: 1rem;
    margin: 1rem 0;
}

.measurement-guide h4 {
    color: #92400e;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.measurement-guide p {
    color: #a16207;
    font-size: 0.875rem;
    margin: 0;
}

/* Photo instructions */
.photo-instructions {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border-radius: 0.75rem;
    padding: 1rem;
    margin: 1rem 0;
}

.photo-instructions h4 {
    color: #1e40af;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.photo-instructions ul {
    color: #1d4ed8;
    font-size: 0.875rem;
    margin: 0;
    padding-left: 1.25rem;
}

.photo-instructions li {
    margin-bottom: 0.25rem;
}

/* Address autocomplete */
.address-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: white;
    border: 2px solid var(--gray-300);
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
}

.address-suggestion {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-200);
    transition: background-color 0.2s ease;
}

.address-suggestion:hover {
    background-color: var(--gray-50);
}

.address-suggestion:last-child {
    border-bottom: none;
}

/* Consent checkboxes */
.consent-group {
    background-color: #f9fafb;
    border: 2px solid #d1fae5;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin: 1rem 0;
}

.consent-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.consent-item:last-child {
    margin-bottom: 0;
}

.consent-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.125rem;
    flex-shrink: 0;
}

.consent-label {
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--gray-800);
}

.consent-required {
    color: var(--error);
}

/* Summary section */
.summary-section {
    background-color: white;
    border: 2px solid var(--gray-200);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.summary-title {
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.summary-content {
    color: var(--gray-800);
    font-size: 0.875rem;
    line-height: 1.5;
}

.summary-edit-btn {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.summary-edit-btn:hover {
    background-color: rgba(5, 150, 105, 0.1);
}

/* Mobile optimizations */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .file-upload-label {
        padding: 1.5rem 1rem;
    }
    
    .camera-container {
        max-width: 100%;
    }
    
    .btn {
        padding: 0.875rem 1rem;
        font-size: 1rem;
    }
    
    .grid-2 .form-field:nth-child(odd) {
        margin-bottom: 0.75rem;
    }
}

/* Dark mode support (if needed) */
@media (prefers-color-scheme: dark) {
    :root {
        --gray-50: #1f2937;
        --gray-100: #374151;
        --gray-200: #4b5563;
        --gray-300: #6b7280;
        --gray-400: #9ca3af;
        --gray-500: #d1d5db;
        --gray-600: #e5e7eb;
        --gray-700: #f3f4f6;
        --gray-800: #f9fafb;
        --gray-900: #ffffff;
    }
}

/* Print styles */
@media print {
    .fixed,
    .camera-container,
    .file-upload,
    button {
        display: none !important;
    }
    
    .form-container {
        box-shadow: none !important;
        border: 1px solid #ccc;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        border: 1px solid #ccc !important;
        background: white !important;
    }
}

/* Camera container */
.camera-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.camera-video {
    width: 100%;
    border-radius: 0.5rem;
    background-color: var(--gray-900);
}

.camera-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.camera-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

/* ========================================
   FORCE DARK TEXT COLORS - HIGHEST PRIORITY 
   ======================================== */
.text-gray-500,
.text-gray-600, 
.text-gray-700,
.text-white,
label,
span,
p,
.form-label,
.summary-content,
.consent-label,
option,
select option {
    color: #1f2937 !important;
}

/* Exceptions for elements that should stay their original colors */
.bg-red-500 .text-white,
.bg-green-500 .text-white,
.bg-blue-500 .text-white,
.pain-tag .text-white,
.toast.text-white,
#loading-overlay .text-white,
#success-modal .text-white,
#error-modal .text-white,
#next-btn,
#next-btn span,
#next-btn #next-btn-text,
.intensity-display {
    color: inherit !important;
}

/* Intensity color indicators - specific overrides */
.intensity-display.text-green-600.bg-green-100 {
    color: #059669 !important;
    background-color: #dcfce7 !important;
}

.intensity-display.text-yellow-600.bg-yellow-100 {
    color: #ca8a04 !important;
    background-color: #fefce8 !important;
}

.intensity-display.text-orange-600.bg-orange-100 {
    color: #ea580c !important;
    background-color: #ffedd5 !important;
}

.intensity-display.text-red-600.bg-red-100 {
    color: #dc2626 !important;
    background-color: #fee2e2 !important;
}

/* General intensity indicator styles */
.intensity-display {
    display: inline-block !important;
    padding: 4px 12px !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-weight: bold !important;
}

/* Fix input text color when typing */
.form-input,
.form-select,
.form-textarea,
input[type="text"],
input[type="email"],
input[type="tel"],
select,
textarea {
    color: #1f2937 !important;
}

/* Fix 'Próximo' button background and text color */
#next-btn,
.bg-gradient-to-r.from-primary.to-secondary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light)) !important;
    color: white !important;
}
