/* Unified Input Styles */

/* Segmented Control - iOS-style floating pill */
.segmented-control-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.segmented-control {
    display: inline-flex;
    align-items: center;
    background: #e5e7eb;
    border-radius: 12px;
    padding: 4px;
    position: relative;
}

.segmented-slider {
    position: absolute;
    height: calc(100% - 8px);
    width: calc(25% - 2px);
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    left: 4px;
    top: 4px;
    pointer-events: none;
}

.segment {
    position: relative;
    z-index: 1;
    width: 48px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 1.1rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

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

.segment.active {
    color: var(--color-primary);
}

/* Slider position based on active segment (slider is child 1, segments are 2-5) */
.segmented-control:has(.segment:nth-child(2).active) .segmented-slider { transform: translateX(0); }
.segmented-control:has(.segment:nth-child(3).active) .segmented-slider { transform: translateX(100%); }
.segmented-control:has(.segment:nth-child(4).active) .segmented-slider { transform: translateX(200%); }
.segmented-control:has(.segment:nth-child(5).active) .segmented-slider { transform: translateX(300%); }

/* Browse Files button - styled like result action buttons */
.browse-files-btn {
    font-size: 0.95rem !important;
    padding: 0.5rem 1.25rem !important;
    border-radius: 0.375rem;
    border: 2px solid #6c757d !important;
    background-color: transparent !important;
    color: #6c757d !important;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.browse-files-btn:hover {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

.browse-files-btn:active {
    transform: translateY(0);
}

/* Drag and drop areas */
.drag-drop-area {
    border: 3px dashed #cbd5e1;
    border-radius: var(--border-radius-md);
    padding: 2rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background-color: #f8fafc;
}

.drag-drop-hint {
    font-size: 0.85rem;
}

.drag-drop-area:hover {
    border-color: var(--color-primary);
    background-color: rgba(102, 126, 234, 0.05);
}

.drag-drop-area.drag-over {
    border-color: var(--color-success);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%);
    transform: scale(1.02);
}

.drag-drop-icon {
    font-size: 4rem;
    color: var(--color-primary);
    display: block;
}

/* File preview */
.file-preview {
    background: rgba(102, 126, 234, 0.05);
    border-radius: var(--border-radius-md);
    padding: 1rem;
    margin-top: 1rem;
}

.file-preview h6 {
    font-weight: 500; /* Medium weight instead of default 600 */
}

/* File preview text container - prevent button overflow */
.file-preview-text {
    min-width: 0; /* Allow text to shrink below natural width */
}

.file-preview-text h6 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* File preview remove button - prevent shrinking */
#uploadRemoveFile {
    flex-shrink: 0; /* Prevent button from being squeezed */
}

/* BiomPIN input styling */
#biompinInput {
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

#biompinInput::placeholder {
    letter-spacing: normal;
}

/* BiomPIN option switch */
.biompin-option {
    background: rgba(102, 126, 234, 0.05);
    border-radius: var(--border-radius-md);
    padding: 1rem;
}

.form-check-input:checked {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

/* Process button states */
#processBtn {
    background: var(--gradient-primary);
    border: none;
    font-weight: 600;
    padding: 0.75rem;
    transition: all 0.3s ease;
    position: relative;
}

#processBtn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#processBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#processBtn .processing-spinner {
    display: none;
}

#processBtn.processing .btn-text {
    display: none;
}

#processBtn.processing .processing-spinner {
    display: inline;
}

/* Alert container */
#alertContainer .alert {
    border-radius: var(--border-radius-sm);
    border: none;
}

/* Card height adjustments */
.upload-card {
    height: auto;
}

.upload-card .card-body {
    height: auto;
    overflow: hidden;
}

/* Disable Bootstrap fade to prevent height jump during tab transitions */
#inputTabContent .tab-pane.fade {
    transition: none;
    opacity: 1 !important;
}

#inputTabContent .tab-pane.fade:not(.show) {
    display: none !important;
}

/* History Tab Styles */
.history-container {
    /* No max-height - let content expand naturally with Load More pattern */
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 2px; /* Extra padding to prevent border clipping on hover */
}

.history-item {
    background: rgba(102, 126, 234, 0.05);
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius-md);
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

.history-item:hover {
    background: rgba(102, 126, 234, 0.1);
    border-color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
    z-index: 1;
}

/* BiomPIN - prominent first line */
.history-item-pin {
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: 0.5px;
}

/* Second line - patient info and time */
.history-item-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.history-item-patient-info {
    color: var(--color-text-muted);
}

.history-item-time {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Time color classes */
.time-safe {
    color: #10b981; /* Green - 48-72+ hours */
}

.time-warning {
    color: #f59e0b; /* Yellow - 24-48 hours */
}

.time-urgent {
    color: #f97316; /* Orange - <24 hours */
}

.time-expired,
.time-unknown {
    color: var(--color-text-muted);
}

/* Empty state */
.history-empty {
    text-align: center;
    padding: 2rem;
    color: var(--color-text-muted);
}

.history-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* Load more card - half height, subtle gray */
.history-load-more {
    background: rgba(108, 117, 125, 0.08);
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius-md);
    padding: 0.5rem 1rem; /* Half height of regular items */
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    position: relative;
}

.history-load-more:hover {
    background: rgba(108, 117, 125, 0.15);
    border-color: #cbd5e1;
    transform: translateY(-1px);
    z-index: 1;
}

.history-load-more i {
    font-size: 0.75rem;
    opacity: 0.6;
}

/* Transcribe empty state - match history empty state styling */
.transcribe-empty {
    text-align: center;
    padding: 2rem;
    color: var(--color-text-muted);
}

.transcribe-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
    display: block;
}

/* Mobile adjustments for input tabs */
@media (max-width: 576px) {
    /* Segmented control - keep same size for touch targets */
    .segmented-control-wrapper {
        margin-bottom: 1rem;
    }

    /* Drag-drop area - reduced padding */
    .drag-drop-area {
        padding: 1.5rem 1rem;
    }

    .drag-drop-icon {
        font-size: 3rem !important;
        margin-bottom: 0.75rem !important;
    }

    .browse-files-btn {
        font-size: 0.875rem !important;
        padding: 0.45rem 1rem !important;
    }

    .drag-drop-hint {
        font-size: 0.8rem;
        margin-bottom: 0.5rem !important;
    }

    /* File preview - more compact */
    .file-preview {
        padding: 0.75rem;
    }

    .file-preview i {
        font-size: 1.5rem !important;
    }

    .file-preview h6 {
        font-size: 0.85rem;
        margin-bottom: 0.25rem !important;
    }

    .file-preview small {
        font-size: 0.7rem;
    }

    /* File preview remove button - more compact */
    #uploadRemoveFile {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.85rem;
        min-width: auto;
    }

    #uploadRemoveFile i {
        margin: 0 !important;
    }

    /* Process button - slightly smaller */
    #processBtn {
        padding: 0.65rem;
        font-size: 0.95rem;
    }

    /* History items - more compact */
    .history-item {
        padding: 0.65rem 0.85rem;
    }

    .history-item-pin {
        font-size: 0.95rem;
    }

    .history-item-info {
        font-size: 0.8rem;
    }

    /* Empty states - reduced padding */
    .history-empty,
    .transcribe-empty {
        padding: 1.5rem 1rem;
    }

    .history-empty i,
    .transcribe-empty i {
        font-size: 2.5rem;
        margin-bottom: 0.75rem;
    }
}
