inou/static/input.css

739 lines
12 KiB
CSS

/* ========================================
INOU INPUT SCREEN
Modern health data input with voice, camera, text
======================================== */
/* Container */
.input-container {
max-width: 480px;
margin: 0 auto;
padding: 24px 20px 32px;
min-height: 100vh;
min-height: 100dvh; /* Dynamic viewport for mobile */
display: flex;
flex-direction: column;
}
/* Header */
.input-header {
text-align: center;
margin-bottom: 28px;
}
.input-header h1 {
font-size: 1.75rem;
font-weight: 600;
color: var(--text);
margin: 0 0 6px;
letter-spacing: -0.02em;
}
.input-subtitle {
font-size: 1rem;
color: var(--text-muted);
font-weight: 300;
margin: 0;
}
/* ========================================
SEGMENTED CONTROL
======================================== */
.segment-control {
display: flex;
background: var(--bg);
border: 1px solid var(--border);
border-radius: 12px;
padding: 4px;
margin-bottom: 24px;
gap: 4px;
}
.segment-btn {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
padding: 12px 16px;
background: transparent;
border: none;
border-radius: 8px;
font-family: inherit;
font-size: 0.95rem;
font-weight: 500;
color: var(--text-muted);
cursor: pointer;
transition: all 0.2s ease;
}
.segment-btn:hover {
color: var(--text);
}
.segment-btn.active {
background: var(--bg-card);
color: var(--accent);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.segment-icon {
width: 20px;
height: 20px;
flex-shrink: 0;
}
/* ========================================
MODE PANELS
======================================== */
.mode-panels {
flex: 1;
position: relative;
}
.mode-panel {
display: none;
animation: fadeIn 0.25s ease;
}
.mode-panel.active {
display: block;
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(8px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
/* ========================================
TEXT INPUT PANEL
======================================== */
.text-input-wrap {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 12px;
overflow: hidden;
transition: border-color 0.2s, box-shadow 0.2s;
}
.text-input-wrap:focus-within {
border-color: var(--accent);
box-shadow: 0 0 0 3px var(--accent-light);
}
.text-input {
width: 100%;
min-height: 140px;
padding: 16px;
font-family: inherit;
font-size: 1rem;
line-height: 1.6;
color: var(--text);
background: transparent;
border: none;
resize: none;
outline: none;
}
.text-input::placeholder {
color: var(--text-subtle);
}
.text-input-footer {
display: flex;
align-items: center;
justify-content: space-between;
padding: 12px 16px;
border-top: 1px solid var(--border);
background: var(--bg);
}
.char-count {
font-size: 0.8rem;
color: var(--text-subtle);
}
.input-hints {
display: flex;
gap: 6px;
}
.hint-tag {
font-size: 0.75rem;
padding: 4px 8px;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 12px;
color: var(--text-muted);
}
/* ========================================
VOICE INPUT PANEL
======================================== */
.voice-container {
display: flex;
flex-direction: column;
align-items: center;
padding: 32px 16px;
}
/* Mic Button */
.mic-btn {
position: relative;
width: 96px;
height: 96px;
border-radius: 50%;
background: var(--bg-card);
border: 2px solid var(--border);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s ease;
}
.mic-btn:hover {
border-color: var(--accent);
transform: scale(1.02);
}
.mic-btn.listening {
border-color: var(--accent);
background: var(--accent-light);
}
.mic-icon {
width: 36px;
height: 36px;
color: var(--text-muted);
transition: color 0.2s;
}
.mic-btn.listening .mic-icon {
color: var(--accent);
}
/* Pulse Animation */
.mic-pulse {
position: absolute;
inset: -8px;
border-radius: 50%;
border: 2px solid var(--accent);
opacity: 0;
transform: scale(1);
pointer-events: none;
}
.mic-btn.listening .mic-pulse {
animation: pulse 1.5s ease-out infinite;
}
@keyframes pulse {
0% {
opacity: 0.6;
transform: scale(1);
}
100% {
opacity: 0;
transform: scale(1.4);
}
}
/* Status Text */
.mic-status {
margin-top: 16px;
font-size: 0.95rem;
color: var(--text-muted);
font-weight: 400;
text-align: center;
}
.mic-btn.listening + .mic-status {
color: var(--accent);
font-weight: 500;
}
/* Transcript Area */
.transcript-area {
width: 100%;
margin-top: 24px;
padding: 16px;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 12px;
min-height: 100px;
display: none;
}
.transcript-area.has-content {
display: block;
}
.transcript-text {
font-size: 1rem;
line-height: 1.6;
color: var(--text);
margin: 0;
}
.transcript-interim {
font-size: 1rem;
line-height: 1.6;
color: var(--text-subtle);
font-style: italic;
margin: 4px 0 0;
}
/* Voice Unsupported */
.voice-unsupported {
text-align: center;
padding: 32px;
color: var(--text-muted);
}
.voice-unsupported svg {
color: var(--text-subtle);
margin-bottom: 12px;
}
.voice-unsupported p {
margin: 0;
font-size: 1rem;
}
.voice-fallback-hint {
margin-top: 8px !important;
font-size: 0.9rem !important;
color: var(--text-subtle) !important;
}
/* ========================================
CAMERA/SCAN PANEL
======================================== */
.camera-container {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 12px;
overflow: hidden;
min-height: 360px;
}
/* Camera Start State */
.camera-start {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 48px 24px;
min-height: 360px;
}
.camera-start-btn {
display: flex;
flex-direction: column;
align-items: center;
gap: 12px;
padding: 24px 32px;
background: var(--accent-light);
border: 2px dashed var(--accent);
border-radius: 16px;
color: var(--accent);
font-family: inherit;
font-size: 1rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
}
.camera-start-btn:hover {
background: var(--accent);
border-style: solid;
color: white;
}
.camera-start-btn:hover svg {
stroke: white;
}
.camera-hint {
margin-top: 16px;
font-size: 0.9rem;
color: var(--text-muted);
text-align: center;
max-width: 280px;
}
/* Camera Viewfinder */
.camera-viewfinder {
position: relative;
background: #000;
}
#camera-video {
width: 100%;
height: auto;
display: block;
max-height: 400px;
object-fit: cover;
}
.viewfinder-overlay {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
pointer-events: none;
}
.viewfinder-frame {
width: 85%;
height: 70%;
border: 2px solid rgba(255, 255, 255, 0.5);
border-radius: 8px;
}
/* Camera Controls */
.camera-controls {
position: absolute;
bottom: 0;
left: 0;
right: 0;
display: flex;
align-items: center;
justify-content: space-around;
padding: 20px;
background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
}
.camera-ctrl-btn {
width: 44px;
height: 44px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.2);
border: none;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: background 0.2s;
}
.camera-ctrl-btn svg {
width: 22px;
height: 22px;
color: white;
}
.camera-ctrl-btn:hover {
background: rgba(255, 255, 255, 0.3);
}
/* Capture Button */
.capture-btn {
width: 72px;
height: 72px;
border-radius: 50%;
background: white;
border: 4px solid rgba(255, 255, 255, 0.3);
cursor: pointer;
padding: 4px;
transition: transform 0.1s;
}
.capture-btn:hover {
transform: scale(1.05);
}
.capture-btn:active {
transform: scale(0.95);
}
.capture-btn-inner {
width: 100%;
height: 100%;
border-radius: 50%;
background: white;
border: 2px solid #ddd;
}
/* Photo Preview */
.photo-preview {
padding: 16px;
}
#preview-img {
width: 100%;
height: auto;
border-radius: 8px;
max-height: 300px;
object-fit: contain;
background: var(--bg);
}
.preview-actions {
display: flex;
gap: 12px;
margin-top: 16px;
}
.preview-actions .btn {
flex: 1;
}
/* OCR Result */
.ocr-result {
padding: 16px;
}
.ocr-header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
}
.ocr-header h3 {
font-size: 1rem;
font-weight: 600;
color: var(--text);
margin: 0;
}
/* Result Type Badges */
.result-type-badge {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 6px 12px;
border-radius: 6px;
font-size: 0.85rem;
font-weight: 500;
}
.result-type-badge.barcode {
background: var(--success-light);
color: var(--success);
}
.result-type-badge.text {
background: var(--accent-light);
color: var(--accent);
}
.result-type-badge.empty {
background: var(--bg);
color: var(--text-muted);
}
.result-type-badge.error {
background: var(--danger-light);
color: var(--danger);
}
.ocr-text {
background: var(--bg);
border: 1px solid var(--border);
border-radius: 8px;
padding: 16px;
font-size: 0.95rem;
line-height: 1.6;
color: var(--text);
max-height: 200px;
overflow-y: auto;
white-space: pre-wrap;
}
.ocr-text:focus {
outline: none;
border-color: var(--accent);
}
.ocr-text[contenteditable="true"] {
border-color: var(--accent);
background: var(--bg-card);
}
/* Barcode value styling - monospace, larger */
.ocr-text.barcode-value {
font-family: "SF Mono", Monaco, "Courier New", monospace;
font-size: 1.25rem;
font-weight: 600;
text-align: center;
letter-spacing: 0.05em;
padding: 24px 16px;
color: var(--text);
}
.ocr-actions {
display: flex;
gap: 12px;
margin-top: 16px;
}
.ocr-actions .btn {
flex: 1;
}
/* OCR Processing */
.ocr-processing {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 64px 24px;
min-height: 300px;
}
.processing-spinner {
width: 48px;
height: 48px;
border: 3px solid var(--border);
border-top-color: var(--accent);
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
.ocr-processing p {
margin-top: 16px;
font-size: 1rem;
color: var(--text-muted);
}
/* Camera Error */
.camera-error {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 48px 24px;
text-align: center;
min-height: 300px;
}
.camera-error svg {
color: var(--danger);
margin-bottom: 16px;
}
.camera-error p {
font-size: 1rem;
color: var(--text-muted);
margin: 0 0 20px;
}
/* ========================================
SUBMIT SECTION
======================================== */
.submit-section {
margin-top: 24px;
padding-top: 24px;
border-top: 1px solid var(--border);
}
.submit-btn {
padding: 14px 24px;
font-size: 1.05rem;
gap: 10px;
}
.submit-btn:disabled {
background: var(--border);
color: var(--text-subtle);
cursor: not-allowed;
}
.submit-btn:disabled:hover {
background: var(--border);
}
.submit-icon {
width: 20px;
height: 20px;
}
/* ========================================
MOBILE RESPONSIVE
======================================== */
@media (max-width: 480px) {
.input-container {
padding: 16px 16px 24px;
}
.input-header h1 {
font-size: 1.5rem;
}
.segment-btn {
padding: 10px 12px;
font-size: 0.9rem;
}
.segment-btn span {
display: none;
}
.segment-icon {
width: 24px;
height: 24px;
}
.mic-btn {
width: 80px;
height: 80px;
}
.mic-icon {
width: 32px;
height: 32px;
}
.text-input {
min-height: 120px;
font-size: 16px; /* Prevents zoom on iOS */
}
.input-hints {
display: none;
}
.camera-start {
min-height: 280px;
padding: 32px 16px;
}
}
/* Larger phones / tablets */
@media (min-width: 481px) and (max-width: 768px) {
.input-container {
max-width: 520px;
}
}
/* ========================================
SAFE AREA (notch/home indicator)
======================================== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
.input-container {
padding-bottom: calc(24px + env(safe-area-inset-bottom));
}
}
/* ========================================
DARK MODE SUPPORT (future)
======================================== */
@media (prefers-color-scheme: dark) {
/* Ready for dark mode variables when inou supports it */
}