/* Custom CSS for EMS Audio Recorder Frontend */

:root {
    --primary-gradient: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    --secondary-gradient: linear-gradient(135deg, #374151 0%, #6b7280 100%);
    --success-color: #059669;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    --info-color: #0284c7;
    --dark-color: #111827;
    --light-color: #f8fafc;
    --accent-color: #3b82f6;
}

/* Body and Layout */
body {
    background-color: #f8fafc;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

/* Recording Controls Styling */
.recording-controls {
    background: var(--primary-gradient);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.2);
    color: white;
    border: none;
}

.recording-controls h2 {
    font-weight: 300;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Audio Visualizer */
.audio-visualizer {
    background: linear-gradient(45deg, #1f2937 0%, #374151 100%);
    border: 2px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    position: relative;
}

.audio-visualizer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, 
        transparent 0%, 
        rgba(59, 130, 246, 0.1) 50%, 
        transparent 100%);
    pointer-events: none;
}

#visualizerCanvas {
    background: transparent;
    border-radius: 8px;
}

.audio-visualizer::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9rem;
    text-align: center;
    z-index: 1;
    pointer-events: none;
}

/* Record Button Animations - Professional Colors */
.record-btn {
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Professional Button Colors */
#recordBtn {
    background: linear-gradient(135deg, #059669, #10b981) !important;
    border-color: rgba(5, 150, 105, 0.3) !important;
}

#stopBtn {
    background: linear-gradient(135deg, #dc2626, #ef4444) !important;
    border-color: rgba(220, 38, 38, 0.3) !important;
}

#playBtn {
    background: linear-gradient(135deg, #0284c7, #0ea5e9) !important;
    border-color: rgba(2, 132, 199, 0.3) !important;
}

#playBtn.playing {
    background: linear-gradient(135deg, #d97706, #f59e0b) !important;
    border-color: rgba(217, 119, 6, 0.3) !important;
    animation: pulse-playing 2s ease-in-out infinite;
}

@keyframes pulse-playing {
    0% {
        box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(217, 119, 6, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(217, 119, 6, 0);
    }
}

#pauseBtn {
    background: linear-gradient(135deg, #d97706, #f59e0b) !important;
    border-color: rgba(217, 119, 6, 0.3) !important;
}

#uploadBtn {
    background: linear-gradient(135deg, #7c3aed, #8b5cf6) !important;
    border-color: rgba(124, 58, 237, 0.3) !important;
}

.record-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.record-btn:active {
    transform: scale(0.95);
}

.record-btn.recording {
    background: var(--danger-color) !important;
    border-color: rgba(220, 53, 69, 0.5);
    animation: pulse-recording 1.5s ease-in-out infinite;
}

@keyframes pulse-recording {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(220, 53, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

.record-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Status Display */
.bg-white.bg-opacity-20 {
    background-color: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(200, 200, 200, 0.3);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.bg-white.bg-opacity-20:hover {
    background-color: rgba(255, 255, 255, 0.95) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.bg-white.bg-opacity-20 h5 {
    color: #333333 !important;
    font-weight: 600 !important;
}

.bg-white.bg-opacity-20 span {
    color: #1a1a1a !important;
    font-weight: 900 !important;
}

.bg-white.bg-opacity-20 .badge {
    color: white !important;
    text-shadow: none;
}

/* Recording status text visibility - FORCE DARK TEXT */
.bg-white.bg-opacity-20 h5 {
    color: #333333 !important;
    font-weight: 600 !important;
}

#recordingDuration,
#fileSize {
    color: #1a1a1a !important;
    font-weight: 900 !important;
    font-size: 1.6rem !important;
    display: block !important;
}

#recordingStatus {
    background-color: rgba(108, 117, 125, 0.9) !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff !important;
}

/* Force text in status boxes to be dark for visibility */
.bg-white.bg-opacity-20 h5 {
    color: #333333 !important;
}

.bg-white.bg-opacity-20 span:not(.badge) {
    color: #1a1a1a !important;
}

/* Status Cards */
.status-card {
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.status-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.15);
}

.status-card .card-header {
    border-radius: 12px 12px 0 0 !important;
    border-bottom: none;
}

/* Progress Bar Enhancements */
.progress {
    background-color: rgba(220, 220, 220, 0.8) !important;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(180, 180, 180, 0.6);
}

.progress-bar {
    border-radius: 10px;
    transition: width 0.3s ease;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, 
        transparent 25%, 
        rgba(255, 255, 255, 0.1) 25%, 
        rgba(255, 255, 255, 0.1) 50%, 
        transparent 50%, 
        transparent 75%, 
        rgba(255, 255, 255, 0.1) 75%, 
        rgba(255, 255, 255, 0.1));
    background-size: 20px 20px;
    animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
    0% { background-position: 0 0; }
    100% { background-position: 20px 0; }
}

/* Table Enhancements */
.table-hover tbody tr:hover {
    background-color: rgba(59, 130, 246, 0.05);
    transition: background-color 0.2s ease;
}

.table th {
    border-top: none;
    font-weight: 600;
    color: var(--dark-color);
    background-color: rgba(59, 130, 246, 0.03);
}

/* Badge Styling */
.badge {
    font-size: 0.8em;
    font-weight: 500;
    padding: 0.5em 0.75em;
    border-radius: 6px;
}

/* Button Group Enhancements */
.btn-group-sm .btn {
    padding: 0.375rem 0.5rem;
    border-radius: 6px !important;
}

.btn-group-sm .btn:not(:last-child) {
    margin-right: 0.25rem;
}

/* Play button states for recordings list */
.play-btn.playing {
    background-color: var(--warning-color) !important;
    border-color: var(--warning-color) !important;
    color: white !important;
    animation: pulse-playing 2s ease-in-out infinite;
}

/* Professional EMS Status Cards - Fixed Alignment and Sizing */
.ems-status-card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 1.25rem 1rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    min-height: 110px;
    max-height: 110px;
    height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.ems-status-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.ems-status-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #1f2937;
    text-transform: uppercase;
    letter-spacing: 0.75px;
    margin-bottom: 0.5rem;
    background: transparent;
    width: 100%;
    padding: 0;
}

.ems-status-value {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 50px;
}

.ems-duration {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-color);
    font-family: 'Courier New', monospace;
    line-height: 1;
}

.ems-progress {
    width: 100%;
    max-width: 280px;
    height: 20px;
    background: rgba(209, 213, 219, 0.9);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
}

.ems-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, 
        #10b981 0%,     /* Green (low/safe) */
        #f59e0b 50%,    /* Yellow (medium) */
        #ef4444 100%    /* Red (high/loud) */
    );
    border-radius: 6px;
    transition: width 0.2s ease-out;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Dynamic color based on level */
.ems-progress-bar.level-low {
    background: linear-gradient(90deg, #10b981, #34d399);
}

.ems-progress-bar.level-medium {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.ems-progress-bar.level-high {
    background: linear-gradient(90deg, #ef4444, #f87171);
    animation: pulse-voice 0.5s ease-in-out infinite alternate;
}

@keyframes pulse-voice {
    0% { opacity: 1; transform: scaleY(1); }
    100% { opacity: 0.8; transform: scaleY(0.95); }
}

.ems-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.4) 50%, 
        transparent 100%
    );
    animation: shimmer 2s infinite;
    border-radius: 6px;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Enhanced Status Badge Accessibility */
.ems-status-card .badge {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
    display: inline-block;
}

/* High contrast status colors for accessibility */
.ems-status-card .badge.bg-secondary {
    background-color: #4b5563 !important;
    color: #ffffff !important;
    border-color: #6b7280;
}

.ems-status-card .badge.bg-success {
    background-color: #059669 !important;
    color: #ffffff !important;
    border-color: #10b981;
}

.ems-status-card .badge.bg-danger {
    background-color: #dc2626 !important;
    color: #ffffff !important;
    border-color: #ef4444;
    animation: pulse-status 2s ease-in-out infinite;
}

.ems-status-card .badge.bg-warning {
    background-color: #d97706 !important;
    color: #ffffff !important;
    border-color: #f59e0b;
}

.ems-status-card .badge.bg-primary {
    background-color: #1e40af !important;
    color: #ffffff !important;
    border-color: #3b82f6;
}

@keyframes pulse-status {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.9; transform: scale(1.05); }
}

/* Enhanced Typography Hierarchy */
.card-header h4 {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.025em;
}

.card-header h4 i {
    opacity: 0.9;
}

/* Modal Enhancements */
.modal-content {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    background: var(--primary-gradient);
    color: white;
    border-bottom: none;
}

.modal-header .btn-close {
    filter: invert(1);
}

/* Footer */
footer {
    margin-top: auto;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-top: 1px solid #dee2e6;
}

/* Responsive Design */
@media (max-width: 768px) {
    .record-btn {
        width: 60px;
        height: 60px;
        font-size: 18px;
    }
    
    .recording-controls h1 {
        font-size: 1.75rem;
    }
    
    .recording-controls h1 small {
        font-size: 1rem !important;
    }
    
    .audio-visualizer {
        height: 60px;
    }
    
    #visualizerCanvas {
        width: 100%;
        height: 45px;
    }
    
    .ems-status-card {
        padding: 1rem 0.75rem;
        min-height: 90px;
        max-height: 90px;
        height: 90px;
    }
    
    .ems-duration {
        font-size: 1.5rem;
    }
    
    .ems-status-label {
        font-size: 0.7rem;
    }
    
    .ems-status-value {
        min-height: 40px;
    }
    
    /* Toast Notifications - Mobile Responsive */
    #toast-container {
        top: 10px !important;
        right: 10px !important;
        left: 10px !important;
        max-width: calc(100vw - 20px) !important;
    }
    
    #toast-container .toast {
        min-width: 100% !important;
        max-width: 100% !important;
    }
    
    #toast-container .toast-body {
        font-size: 13px !important;
    }
}

@media (max-width: 576px) {
    .recording-controls {
        border-radius: 12px;
    }
    
    .status-card {
        margin-bottom: 1rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .ems-status-card {
        margin-bottom: 1rem;
        padding: 0.875rem 0.5rem;
        min-height: 85px;
        max-height: 85px;
        height: 85px;
    }
    
    .ems-duration {
        font-size: 1.25rem;
    }
    
    .ems-status-label {
        font-size: 0.65rem;
        margin-bottom: 0.4rem;
    }
    
    .ems-status-value {
        min-height: 35px;
    }
}

/* Loading Spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Toast Notification Container - Fixed Alignment and Size */
#toast-container {
    position: fixed !important;
    top: 10px !important;
    right: 10px !important;
    z-index: 9999 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    gap: 10px !important;
    padding: 10px !important;
    max-width: 400px !important;
    width: auto !important;
}

/* Toast Notification - Consistent Size and Alignment */
#toast-container .toast {
    min-width: 350px !important;
    max-width: 400px !important;
    width: 100% !important;
    margin: 0 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
    border-radius: 8px !important;
}

/* Toast Header - Consistent Height */
#toast-container .toast-header {
    min-height: 40px !important;
    padding: 10px 15px !important;
    align-items: center !important;
    display: flex !important;
}

/* Toast Body - Consistent Padding */
#toast-container .toast-body {
    padding: 12px 15px !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    word-wrap: break-word !important;
}

/* Ensure proper alignment for close button */
#toast-container .btn-close {
    margin-left: auto !important;
    padding: 0.5rem !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Error States */
.error-state {
    color: var(--danger-color);
    background-color: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.2);
    border-radius: 8px;
    padding: 1rem;
}

.success-state {
    color: var(--success-color);
    background-color: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.2);
    border-radius: 8px;
    padding: 1rem;
}

/* File upload drag and drop styling */
.upload-zone {
    border: 2px dashed #ccc;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    background-color: #fafafa;
    transition: all 0.3s ease;
}

.upload-zone.dragover {
    border-color: var(--accent-color);
    background-color: rgba(59, 130, 246, 0.05);
    transform: scale(1.02);
} 