:root {
    color-scheme: light;
    --page-bg: #f5f5f5;
    --page-text: #333;
    --muted-text: #6c757d;
    --surface-bg: #ffffff;
    --surface-border: rgba(0, 0, 0, 0.08);
    --surface-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --title-color: #2c3e50;
    --recording-time: #333;
    --recording-date: #495057;
    --recording-meta: #6c757d;
    --empty-state-text: #6c757d;
    --empty-state-border: #dee2e6;
    --note-border: #dee2e6;
    --note-focus-border: #86b7fe;
    --note-focus-shadow: rgba(13, 110, 253, 0.1);
    --saved-bg: rgba(255, 255, 255, 0.98);
    --saved-text: #198754;
    --modal-bg: #ffffff;
    --modal-text: #333;
    --modal-border: rgba(0, 0, 0, 0.1);
    --icon-hover-bg: rgba(255, 255, 255, 0.12);
    --icon-color: #fff;
    --header-gap: 0.25rem;
}

body.dark {
    color-scheme: dark;
    --page-bg: #10161d;
    --page-text: #e8edf3;
    --muted-text: #9ba8b5;
    --surface-bg: #18212b;
    --surface-border: #263342;
    --surface-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
    --title-color: #f5f7fa;
    --recording-time: #edf2f7;
    --recording-date: #d4dde6;
    --recording-meta: #9fb0c0;
    --empty-state-text: #9ba8b5;
    --empty-state-border: #314152;
    --note-border: #314152;
    --note-focus-border: #6ea8fe;
    --note-focus-shadow: rgba(110, 168, 254, 0.22);
    --saved-bg: rgba(17, 25, 34, 0.98);
    --saved-text: #75b798;
    --modal-bg: #18212b;
    --modal-text: #e8edf3;
    --modal-border: #263342;
    --icon-hover-bg: rgba(255, 255, 255, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--page-bg);
    color: var(--page-text);
    line-height: 1.6;
    padding-top: 60px;
    transition: background-color 180ms ease, color 180ms ease;
}

.navbar-brand a:hover {
    opacity: 0.8;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--header-gap);
}

.navbar-icon-button {
    border: none;
    background: transparent;
    color: var(--icon-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    padding: 0;
    transition: background-color 160ms ease, opacity 160ms ease;
}

.navbar-icon-button:hover,
.navbar-icon-button:focus {
    background-color: var(--icon-hover-bg);
    outline: none;
}

.theme-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 19px;
    height: 19px;
}

.theme-icon svg {
    display: block;
}

.theme-icon-light {
    display: none;
}

body.dark .theme-icon-dark {
    display: none;
}

body.dark .theme-icon-light {
    display: inline-flex;
}

.recorder-container {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: var(--surface-bg);
    border-radius: 8px;
    box-shadow: var(--surface-shadow);
    border: 1px solid var(--surface-border);
    transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--title-color);
}

.recorder-controls {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.record-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 50px;
    border: none;
    transition: all 0.3s ease;
}

.record-btn:not(.recording) {
    background-color: #0d6efd;
    color: white;
}

.record-btn:not(.recording) .stop-icon {
    display: none;
}

.record-btn:not(.recording) .record-icon {
    display: inline-block;
}

.record-btn.recording {
    background-color: #dc3545;
    color: white;
}

.record-btn.recording .record-icon {
    display: none;
}

.record-btn.recording .stop-icon {
    display: inline-block;
}

.record-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.record-btn i {
    font-size: 1.2rem;
}

.recording-status {
    text-align: center;
}

.recording-time {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--recording-time);
    margin: 1rem 0;
    text-align: center;
    position: relative;
    display: inline-block;
}

.recording-dot {
    display: none;
    width: 10px;
    height: 10px;
    background-color: #dc3545;
    border-radius: 50%;
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
}

.recording-dot.active {
    display: block;
    animation: breathe 1.5s ease-in-out infinite;
}

@keyframes breathe {
    0% {
        transform: translateY(-50%) scale(0.8);
        opacity: 0.5;
    }
    50% {
        transform: translateY(-50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translateY(-50%) scale(0.8);
        opacity: 0.5;
    }
}

.recordings-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

.recording-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0 6px;
}

.recording-date {
    font-size: 0.9rem;
    color: var(--recording-date);
    font-weight: 500;
}

.recording-time-ago {
    font-size: 0.85rem;
    color: var(--recording-meta);
}

.recording-item {
    background: var(--surface-bg);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 4px rgb(0 0 0 / 17%);
    border: 1px solid var(--surface-border);
}

.recording-item audio {
    width: 100%;
    margin-bottom: 0.75rem;
}

.button-container {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.download-button, .delete-button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    color: white;
}

.download-button {
    background-color: #2ecc71;
}

.download-button:hover {
    background-color: #27ae60;
}

.delete-button {
    background-color: #e74c3c;
}

.delete-button:hover {
    background-color: #c0392b;
}

.text-bold {
    font-weight: bold;
}

.generic-flex {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 16px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--empty-state-text);
    text-align: center;
    border: 2px dashed var(--empty-state-border);
    border-radius: 8px;
    will-change: opacity;
    transition: opacity 0.3s ease-in-out;
}

.empty-state.hidden {
    display: none !important;
}

.empty-state svg {
    margin-bottom: 1rem;
    opacity: 0.7;
}

.empty-state p {
    font-size: 1.1rem;
    margin: 0;
}

/* Modal styles */
.modal-container {
    padding: 1.5rem;
}

.custom-modal-title {
    margin: 0;
    font-weight: bold;
}

.about-notice {
    background-color: rgba(13, 110, 253, 0.06);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1.5rem;
    color: var(--page-text);
}

.about-author-container {
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: center;
}

.about-author-link {
    text-decoration: none;
    font-weight: bold;
}

.about-icon-container {
    display: flex;
    gap: 1rem;
}

.github-icon,
.donate-icon {
    opacity: 0.7;
    transition: opacity 0.2s;
}

.github-icon:hover,
.donate-icon:hover {
    opacity: 1;
}

/* Override Bootstrap modal styles */
.modal-header {
    border-bottom: none;
    padding: 1rem 1.5rem;
}

.modal-footer {
    border-top: none;
    justify-content: space-between;
    padding: 1rem 1.5rem;
}

.modal-content {
    background: var(--modal-bg);
    color: var(--modal-text);
    border: 1px solid var(--modal-border);
}

.modal-body,
.modal-header,
.modal-footer {
    color: var(--modal-text);
}

.btn-close:focus {
    box-shadow: none;
}

/* Slide out animation for deleting recordings */
@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateX(0);
        max-height: 500px;
    }
    to {
        opacity: 0;
        transform: translateX(-100%);
        max-height: 0;
    }
}

/* Media queries */
@media screen and (max-width: 767px) {
    .recording-item {
        flex-direction: column;
    }
}

.notes-container {
    position: relative;
}

.recording-notes {
    width: 100%;
    margin: 0.75rem 0;
    padding: 0.5rem;
    border: 1px solid var(--note-border);
    border-radius: 10px;
    font-size: 0.9rem;
    min-height: 70px;
    resize: vertical;
    transition: border-color 0.2s ease-in-out;
    background: var(--surface-bg);
    color: var(--page-text);
}

.recording-notes:focus {
    outline: none;
    border-color: var(--note-focus-border);
    box-shadow: 0 0 0 0.25rem var(--note-focus-shadow);
}

.notes-saved {
    position: absolute;
    right: 5px;
    bottom: 24px;
    font-size: 0.7rem;
    color: var(--saved-text);
    background: var(--saved-bg);
    padding: 3px 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease-in-out;
    pointer-events: none;
    box-shadow: 1px 1px 4px 1px #00000036;
}

.notes-saved i {
    font-size: 0.9rem;
}

.notes-saved.visible {
    opacity: 1;
    transform: translateY(0);
}

.processing-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgb(0 0 0 / 34%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.processing-loader.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.processing-text {
    color: white;
    margin-top: 15px;
    font-size: 1.1em;
}

.bg-dark {
    background-color: #1b222d !important;
}

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