/* Custom theme colors */
:root {
    --primary-white: #FFFFFF;
    --primary-pink: #F5BABB;
    --primary-teal: #568F87;
    --primary-blue: #284c84;
    --pastel-brown: #D6A99D;
    --pastel-yellow: #FBF3D5;
    --pastel-green: #D6DAC8;
    --pastel-teal: #9CAFAA;
}

/* Landing page styles */
.landing-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-teal));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.landing-page .container {
    max-width: 100%;
}

.landing-page h1 {
    font-size: 2rem;
}

.landing-page .lead {
    font-size: 1rem;
}

@media (min-width: 768px) {
    .landing-page {
        padding: 2rem;
    }
    
    .landing-page h1 {
        font-size: 3rem;
    }
    
    .landing-page .lead {
        font-size: 1.25rem;
    }
}

.feature-card {
    transition: all 0.3s ease;
    border: none;
    background: var(--primary-white);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    height: 100%;
    cursor: pointer;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .feature-card {
        margin-bottom: 0;
    }
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.feature-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
    color: var(--primary-white);
}

@media (min-width: 768px) {
    .feature-icon {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }
}

.feature-icon.record { background: var(--primary-pink); }
.feature-icon.upload { background: var(--primary-teal); }
.feature-icon.view { background: var(--primary-blue); }

/* Page containers */
.page-container {
    display: none;
    min-height: 100vh;
    padding: 1rem 0;
    background: linear-gradient(135deg, var(--pastel-yellow), var(--pastel-green));
}

.page-container.active {
    display: block;
}

/* Responsive adjustments */
@media (min-width: 768px) {
    .page-container {
        padding: 2rem 0;
    }
}

/* Navigation */
.top-nav {
    background: var(--primary-blue);
    padding: 0.75rem 0;
}

.navbar-brand.nav-brand {
    color: var(--primary-white) !important;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: bold;
}

.navbar-brand.nav-brand:hover {
    color: var(--primary-pink) !important;
}

.navbar-nav .nav-link {
    color: var(--primary-white) !important;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--primary-pink) !important;
}

.navbar-nav .nav-link.active {
    background-color: var(--primary-pink);
    color: var(--primary-white) !important;
    font-weight: bold;
}

.navbar-toggler {
    border: 1px solid var(--primary-white);
    padding: 0.25rem 0.5rem;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

@media (min-width: 768px) {
    .top-nav {
        padding: 1rem 0;
    }
    
    .navbar-brand.nav-brand {
        font-size: 1.5rem;
    }
}

.nav-brand:hover {
    color: var(--primary-pink);
}

/* Recording controls */
.recording-controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.recording-controls .btn {
    flex: 1;
    min-width: 100px;
    margin: 0.25rem;
}

@media (min-width: 576px) {
    .recording-controls .btn {
        flex: none;
        min-width: 120px;
        margin: 0;
    }
}

.recording-status {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* Waveform visualization */
.waveform-container {
    width: 100%;
    height: 80px;
    background: var(--pastel-green);
    border-radius: 10px;
    margin: 1rem 0;
    position: relative;
    overflow: hidden;
}

@media (min-width: 768px) {
    .waveform-container {
        height: 100px;
    }
}

.waveform-canvas {
    width: 100%;
    height: 100%;
}

/* Recording metadata modal */
.metadata-section {
    display: none;
    background: var(--primary-white);
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 1rem;
    border: 2px solid var(--primary-teal);
}

.metadata-section.active {
    display: block;
}

/* Recording item styles */
.recording-item {
    transition: all 0.3s ease;
    background: var(--primary-white);
    border-radius: 10px;
    border: 1px solid var(--pastel-teal);
    margin-bottom: 1rem;
    overflow: hidden;
}

.recording-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: var(--primary-teal);
}

.recording-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

@media (max-width: 767px) {
    .recording-actions {
        flex-direction: column;
        width: 100%;
        margin-top: 1rem;
    }
    
    .recording-actions .btn {
        width: 100%;
    }
    
    .recording-item .d-flex {
        flex-direction: column;
    }
    
    .recording-item .flex-grow-1 {
        margin-bottom: 1rem;
    }
}

.recording-meta {
    font-size: 0.875rem;
    color: #666;
}

/* Search and filter section */
.filter-section {
    background: var(--primary-white);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--pastel-teal);
}

/* Custom button styles */
.btn-primary {
    background-color: var(--primary-teal);
    border-color: var(--primary-teal);
}

.btn-primary:hover {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
}

.btn-outline-primary {
    color: var(--primary-teal);
    border-color: var(--primary-teal);
}

.btn-outline-primary:hover {
    background-color: var(--primary-teal);
    border-color: var(--primary-teal);
}

.btn-success {
    background-color: var(--primary-pink);
    border-color: var(--primary-pink);
}

.btn-success:hover {
    background-color: #e8a5a6;
    border-color: #e8a5a6;
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

.recording-timer {
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .recording-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .recording-controls .btn {
        width: 100%;
        max-width: 200px;
    }
    
    .recording-actions {
        flex-direction: column;
    }
    
    .recording-actions .btn {
        width: 100%;
    }
    
    .feature-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
}

/* Audio element styling */
audio {
    border-radius: 0.375rem;
}

/* Card styling */
.card {
    transition: all 0.3s ease;
    border: none;
    background: var(--primary-white);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-teal), var(--primary-blue));
    color: var(--primary-white);
    border-radius: 15px 15px 0 0 !important;
    border: none;
}

/* Hide default dark theme */
[data-bs-theme="dark"] {
    color-scheme: light;
}

/* Results Display Styles */
#resultsContainer .card {
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border: none;
    border-radius: 16px;
    margin-bottom: 2rem;
}

#resultsContainer .card-header {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border-radius: 16px 16px 0 0 !important;
    border: none;
    padding: 1.5rem;
}

#resultsContainer .card-header h5 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

#resultsContainer .card-body {
    padding: 2rem;
}

.transcript-content, .feedback-content {
    height: 100%;
}

.transcript-content h4, .feedback-content h4 {
    color: #568F87;
    font-weight: 600;
    margin-bottom: 1rem;
}

.transcript-text {
    background: #f8f9fa;
    border-radius: 12px;
    font-family: 'Georgia', serif;
    line-height: 1.7;
    max-height: 400px;
    overflow-y: auto;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
}

.feedback-html {
    background: white;
    border-radius: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding: 1.5rem;
    border: 1px solid #e9ecef;
}

.feedback-html h1, .feedback-html h2, .feedback-html h3 {
    color: #568F87;
    margin-top: 1rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.feedback-html p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.feedback-html ul, .feedback-html ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.feedback-html li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.feedback-html strong {
    color: #4A7C59;
    font-weight: 600;
}

/* Action buttons in results section */
#resultsContainer .btn {
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
}

#resultsContainer .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Improved layout flow */
.landing-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.recording-section, .upload-section {
    margin-bottom: 1.5rem;
}

/* Processing Status Styles */
.processing-item {
    transition: all 0.3s ease;
    border-left: 4px solid #dee2e6 !important;
    margin-bottom: 0.75rem;
}

.processing-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.processing-item .processing-meta {
    font-size: 0.875rem;
}

.processing-item .spinner-border {
    width: 1rem;
    height: 1rem;
}

/* Processing Status Animations */
@keyframes processing-pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.processing-item .spinner-border {
    animation: processing-pulse 2s infinite;
}

/* Status Badge Styles */
.badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
}

.badge.bg-success {
    background-color: #28a745 !important;
}

.badge.bg-info {
    background-color: #17a2b8 !important;
}

.badge.bg-warning {
    background-color: #ffc107 !important;
    color: #212529 !important;
}

.badge.bg-danger {
    background-color: #dc3545 !important;
}

.badge.bg-secondary {
    background-color: #6c757d !important;
}

/* Processing Modal Styles */
#processingModal .modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

#processingModal .modal-header {
    border-radius: 16px 16px 0 0;
    border: none;
}

#processingModal .processing-animation {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Responsive Design */
@media (max-width: 768px) {
    #resultsContainer .row {
        flex-direction: column;
    }
    
    #resultsContainer .col-md-6 {
        margin-bottom: 1rem;
    }
    
    .transcript-text, .feedback-html {
        max-height: 300px;
    }
    
    #resultsContainer .card-body {
        padding: 1.5rem;
    }
    
    #resultsContainer .btn {
        display: block;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .recording-section, .upload-section {
        margin-bottom: 1rem;
    }
}

/* Loading States */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    z-index: 10;
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #568F87;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Audio Player Styles */
.audio-player-preview, .audio-preview {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.audio-player-preview:hover, .audio-preview:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.audio-player-preview h6, .audio-preview h6 {
    color: #568F87;
    font-weight: 600;
    margin-bottom: 1rem;
}

.audio-player-preview audio, .audio-preview audio {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.file-info {
    padding: 0.5rem;
    background: rgba(255,255,255,0.7);
    border-radius: 6px;
    margin-top: 0.5rem;
}

/* Recording Item Styles */
.recording-item {
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    border-radius: 12px;
}

.recording-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    border-color: #568F87;
}

.recording-item .card-body {
    padding: 1.5rem;
}

.recording-item .card-title {
    color: #2c3e50;
    font-weight: 600;
}

.recording-meta {
    color: #6c757d;
}

.analysis-preview {
    background: rgba(40, 167, 69, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border-left: 3px solid #28a745;
}

/* Analysis View Page Styles */
#analysisViewPage .card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    margin-bottom: 2rem;
}

#analysisViewPage .card-header {
    border-radius: 16px 16px 0 0 !important;
    border: none;
    padding: 1.25rem;
}

#analysisViewPage .card-body {
    padding: 1.5rem;
}

/* Audio Player Styles */
#analysisAudioPlayer {
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

#analysisAudioPlayer:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* Transcript and Feedback Display */
.transcript-text, .feedback-html {
    line-height: 1.6;
    font-size: 0.95rem;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.transcript-text {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.feedback-html {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #28a745;
}

/* Analysis Page Buttons */
#analysisViewPage .btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

#analysisViewPage .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Character count display */
#analysisViewPage .card-header small {
    font-size: 0.8rem;
    opacity: 0.8;
    font-weight: normal;
}

/* Scrollable content */
.transcript-text, .feedback-html {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #f7fafc;
}

.transcript-text::-webkit-scrollbar,
.feedback-html::-webkit-scrollbar {
    width: 6px;
}

.transcript-text::-webkit-scrollbar-track,
.feedback-html::-webkit-scrollbar-track {
    background: #f7fafc;
    border-radius: 3px;
}

.transcript-text::-webkit-scrollbar-thumb,
.feedback-html::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.transcript-text::-webkit-scrollbar-thumb:hover,
.feedback-html::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .recording-item .btn-group {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .recording-item .btn-group .btn {
        width: 100%;
    }
    
    #analysisViewPage .card-body {
        padding: 1.5rem;
    }
}

/* Done Button Styles */
.btn-success.btn-lg {
    font-size: 1.1rem;
    padding: 0.875rem 1.75rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    transition: all 0.3s ease;
}

.btn-success.btn-lg:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

/* Loading States */
.loading-spinner-container {
    text-align: center;
    padding: 3rem 1rem;
}

.loading-spinner-container .spinner-border {
    width: 3rem;
    height: 3rem;
    color: #568F87;
}

.loading-spinner-container p {
    color: #6c757d;
    margin-top: 1rem;
    font-size: 1.1rem;
}

/* Error States */
.error-container {
    text-align: center;
    padding: 3rem 1rem;
}

.error-container .fa-exclamation-triangle {
    color: #dc3545;
    margin-bottom: 1rem;
}

.error-container h5 {
    color: #dc3545;
    margin-bottom: 1rem;
}

.error-container .text-muted {
    color: #6c757d !important;
    margin-bottom: 1.5rem;
}

.error-container .btn {
    margin-top: 1rem;
}

/* Improved Button Group Styling */
.btn-group .btn {
    margin: 0 0.25rem;
    border-radius: 6px !important;
}

.btn-group .btn:first-child {
    margin-left: 0;
}

.btn-group .btn:last-child {
    margin-right: 0;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .btn-success.btn-lg {
        font-size: 1rem;
        padding: 0.75rem 1.5rem;
    }
    
    .btn-group {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-group .btn {
        margin: 0;
        width: 100%;
    }
}
