/* ===== Reset y base ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body { height: 100%; }

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #1e1e2e;
    color: #e4e4f1;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ===== Layout ===== */
.app-container {
    max-width: 540px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
.app-header {
    background: linear-gradient(135deg, #1e1e2e 0%, #2a2a3e 100%);
    padding: 20px;
    border-bottom: 2px solid #a78bfa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-mark {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: contain;
    display: block;
    box-shadow: 0 4px 14px rgba(167, 139, 250, 0.35);
}

.logo-text h1 {
    font-size: 22px;
    font-weight: 700;
    color: #a78bfa;
    letter-spacing: 1px;
    line-height: 1;
}

.logo-text span {
    font-size: 12px;
    color: #9090a8;
    font-weight: 500;
}

.header-subtitle {
    font-size: 11px;
    color: #6b6b80;
    margin-top: 8px;
    text-align: center;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ===== Section header ===== */
.section-header {
    font-size: 13px;
    font-weight: 700;
    color: #a78bfa;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 10px 0 4px;
    margin: 8px 0 4px;
    border-bottom: 1px solid #3a3a52;
}

.section-header:first-child {
    margin-top: 0;
}

/* ===== Form ===== */
.form-container {
    flex: 1;
    padding: 16px 20px 24px;
}

.field-group {
    margin-bottom: 18px;
}

.field-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #c4c4d8;
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}

.required {
    color: #f87171;
    margin-left: 2px;
}

.hint {
    color: #6b6b80;
    font-weight: 400;
    font-size: 11px;
    margin-left: 4px;
}

.field-help {
    display: block;
    font-size: 11px;
    color: #6b6b80;
    margin-bottom: 6px;
    margin-top: -4px;
    font-style: italic;
}

/* ===== Inputs ===== */
input[type="text"],
input[type="date"],
input[type="time"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    background: #2a2a3e;
    border: 1.5px solid #3a3a52;
    border-radius: 8px;
    color: #e4e4f1;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s, background 0.2s;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #a78bfa;
    background: #2f2f44;
}

textarea {
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
}

select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23a78bfa' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

input[type="date"], input[type="time"] {
    color-scheme: dark;
}

/* Inline text input (for "Otros" radio) */
.inline-text-input {
    flex: 1;
    padding: 6px 10px !important;
    font-size: 14px !important;
    margin-left: 8px;
    background: #1e1e2e !important;
    min-width: 0;
}

/* ===== Photo group ===== */
.photo-group {
    background: #252538;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid #3a3a52;
}

.photo-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 4px;
}

.photo-buttons-single .photo-button {
    min-height: 54px;
}

.photo-help {
    margin: 6px 2px 0;
    color: #9090a8;
    font-size: 12px;
    line-height: 1.35;
}

.photo-button {
    padding: 14px 8px;
    background: #1e1e2e;
    border: 2px dashed #a78bfa;
    border-radius: 10px;
    color: #a78bfa;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    font-family: inherit;
    text-align: center;
}

.photo-button:active {
    transform: scale(0.97);
    background: #2a2a3e;
}

.photo-button-camera {
    border-style: solid;
    background: #a78bfa;
    color: #1e1e2e;
}

.photo-button-camera:active {
    background: #9579e8;
}

.photo-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    min-height: 24px;
}

.photo-count {
    font-size: 13px;
    color: #a78bfa;
    font-weight: 600;
}

.photo-count:empty { display: none; }

.clear-button {
    background: transparent;
    border: 1px solid #f87171;
    color: #f87171;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.clear-button:active {
    background: rgba(248, 113, 113, 0.1);
}

/* ===== Preview grid ===== */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 6px;
    margin-top: 12px;
}

.preview-grid:empty { margin-top: 0; }

.preview-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    background: #1e1e2e;
    border: 1px solid #3a3a52;
}

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

.preview-thumb-num {
    position: absolute;
    top: 2px;
    left: 2px;
    background: rgba(167, 139, 250, 0.9);
    color: #1e1e2e;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
}

.preview-thumb-delete {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(248, 113, 113, 0.95);
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.preview-thumb-delete:active {
    background: #e85959;
    transform: scale(0.9);
}

/* ===== Radio group ===== */
.radio-group {
    display: flex;
    gap: 8px;
}

.radio-group-vertical {
    flex-direction: column;
    gap: 6px;
}

.radio-group-horizontal {
    flex-direction: row;
}

.radio-option {
    cursor: pointer;
    margin-bottom: 0 !important;
    flex: 1;
}

.radio-group-vertical .radio-option {
    flex: none;
}

.radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.radio-label {
    display: block;
    padding: 10px 14px;
    background: #2a2a3e;
    border: 1.5px solid #3a3a52;
    border-radius: 8px;
    text-align: left;
    font-weight: 500;
    color: #c4c4d8;
    transition: all 0.15s;
    font-size: 14px;
}

.radio-group-horizontal .radio-label {
    text-align: center;
    font-weight: 600;
}

.radio-option input[type="radio"]:checked + .radio-label {
    background: #a78bfa;
    border-color: #a78bfa;
    color: #1e1e2e;
    font-weight: 700;
}

.radio-with-input {
    display: flex;
    align-items: center;
}

.radio-with-input .radio-label {
    flex-shrink: 0;
}

/* ===== Checkbox group ===== */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.checkbox-option {
    cursor: pointer;
    display: flex;
    align-items: center;
    margin-bottom: 0 !important;
}

.checkbox-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    accent-color: #a78bfa;
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-label {
    font-weight: 500;
    color: #c4c4d8;
    font-size: 14px;
}

.checkbox-label em {
    color: #6b6b80;
    font-size: 12px;
    font-style: italic;
}

.checkbox-with-input {
    flex-wrap: wrap;
}

/* ===== Submit ===== */
.submit-button {
    width: 100%;
    padding: 16px;
    margin-top: 12px;
    background: #a78bfa;
    color: #1e1e2e;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 14px rgba(167, 139, 250, 0.25);
}

.submit-button:active:not(:disabled) {
    transform: scale(0.98);
    background: #9579e8;
}

.submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== Status / messages ===== */
.status-message {
    margin-top: 16px;
    padding: 14px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
}

.status-message.success {
    background: rgba(74, 222, 128, 0.15);
    border: 1px solid #4ade80;
    color: #4ade80;
}

.status-message.error {
    background: rgba(248, 113, 113, 0.15);
    border: 1px solid #f87171;
    color: #f87171;
}

/* ===== Footer ===== */
.app-footer {
    text-align: center;
    padding: 20px;
    font-size: 11px;
    color: #6b6b80;
    border-top: 1px solid #2a2a3e;
}

/* ===== Loading overlay ===== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(30, 30, 46, 0.95);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-content {
    text-align: center;
    padding: 30px;
}

.loading-spinner {
    width: 56px;
    height: 56px;
    margin: 0 auto 20px;
    border: 4px solid #2a2a3e;
    border-top-color: #a78bfa;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-content p {
    font-size: 16px;
    color: #e4e4f1;
    margin-bottom: 8px;
}

.loading-progress {
    font-size: 13px !important;
    color: #a78bfa !important;
    font-family: 'Consolas', monospace;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(30, 30, 46, 0.3);
    border-top-color: #1e1e2e;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.hidden { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 380px) {
    .form-container { padding: 12px 16px 20px; }
    .logo-text h1 { font-size: 20px; }
    .photo-group { padding: 10px; }
}

/* ===== Video previews ===== */
.preview-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-thumb-type {
    position: absolute;
    bottom: 2px;
    left: 2px;
    background: rgba(30, 30, 46, 0.85);
    color: #fff;
    font-size: 13px;
    padding: 1px 5px;
    border-radius: 4px;
}

.error-hint {
    color: #ff9b9b;
    font-weight: 600;
}


.preview-thumb-size {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: rgba(30, 30, 46, 0.85);
    color: #fff;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 4px;
}
