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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 20px;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

.card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.card h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.card h3 {
    color: #555;
    margin: 20px 0 10px 0;
    font-size: 1.2rem;
}

/* Recording Section */
.recording-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

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

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
}

.icon {
    font-size: 1.2rem;
}

.status {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    font-weight: 500;
}

.status.recording {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #c62828;
}

.status.success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #2e7d32;
}

.status.error {
    background: #fff3e0;
    color: #e65100;
    border-left: 4px solid #e65100;
}

.timer {
    font-size: 2.5rem;
    font-weight: 700;
    color: #667eea;
    text-align: center;
    margin: 20px 0;
    font-family: 'Courier New', monospace;
}

.audio-playback {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.playback-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

#audioPlayer {
    width: 100%;
    margin-bottom: 15px;
}

.media-preview-area {
    margin-top: 15px;
    padding: 15px;
    background: #f0f4f8;
    border-radius: 10px;
}

.captured-media-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.media-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.media-thumb:hover {
    transform: scale(1.05);
}

.video-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #333;
    color: white;
    font-size: 0.7rem;
    text-align: center;
}

.memory-media {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0;
}

.processing-results {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.processing-results h3 {
    color: #667eea;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.transcription-text {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    margin-bottom: 20px;
    line-height: 1.6;
    color: #333;
}

.analysis-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.analysis-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid #667eea;
}

.analysis-item strong {
    color: #667eea;
    display: block;
    margin-bottom: 5px;
}

.topic-item,
.observations-item,
.reminders-item,
.notes-item {
    grid-column: 1 / -1;
}

.reminders-item.has-reminder {
    background: #fff3cd;
    border-left-color: #ffc107;
    border-left-width: 4px;
}

.reminders-item.has-reminder strong {
    color: #ff8800;
}

.reminder-details {
    margin-top: 8px;
    padding: 8px;
    background: #fff8e1;
    border-radius: 5px;
    font-size: 0.9em;
}

.reminder-details small {
    color: #666;
}

@media (max-width: 767px) {
    .analysis-grid {
        grid-template-columns: 1fr;
    }
}

/* Search Section */
.search-controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 50px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-help {
    margin-top: 12px;
    background: #f0f4f8;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #5c6b73;
    line-height: 1.4;
}

.search-help code {
    background: #ffffff;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: 600;
    border: 1px solid #d1d9e6;
}

.search-results {
    margin-top: 20px;
    min-height: 100px;
}

.result-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
}

.result-item h4 {
    color: #333;
    margin-bottom: 5px;
}

.result-item p {
    color: #666;
    font-size: 0.9rem;
}

/* Timeline Section */
.timeline-section {
    grid-column: 1 / -1;
}

.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.timeline-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 5px;
    -webkit-overflow-scrolling: touch;
}

.filter-tab {
    padding: 8px 15px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    color: #666;
    transition: all 0.2s ease;
}

.filter-tab:hover {
    background: #f0f0f0;
}

.filter-tab.active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.memory-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    border-left: 5px solid #667eea;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease;
}

.memory-card:hover {
    transform: translateX(5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.memory-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.memory-date {
    font-size: 0.85rem;
    color: #888;
    font-weight: 500;
}

.memory-topic {
    font-size: 1.1rem;
    color: #333;
    text-align: right;
}

.memory-body {
    margin-bottom: 15px;
}

.memory-notes {
    color: #444;
    line-height: 1.5;
    margin-bottom: 12px;
}

.memory-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
}

.speaker-tag {
    background: #e1f5fe;
    color: #0288d1;
}

.location-tag {
    background: #e8f5e9;
    color: #2e7d32;
}

.people-tag {
    background: #f3e5f5;
    color: #7b1fa2;
}

.present-tag {
    background: #ede7f6;
    color: #512da8;
}

.time-tag {
    background: #fce4ec;
    color: #c2185b;
}

.feeling-tag {
    background: #fff9c4;
    color: #fbc02d;
}

.geo-tag {
    background: #e8eaf6;
    color: #3f51b5;
    border: 1px solid #c5cae9;
}

.reminder-tag {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffccbc;
}

.memory-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.primary-actions {
    display: flex;
    gap: 8px;
}

.secondary-actions {
    display: flex;
    gap: 8px;
}

.memory-seeker {
    flex: 1;
    margin: 0 15px;
    display: flex;
    align-items: center;
}

.seeker-bar {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.seeker-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.seeker-bar::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.4);
}

.btn-stop {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.btn-stop:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-view {
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    color: white;
    border: none;
}

.btn-view:hover {
    box-shadow: 0 4px 12px rgba(0, 210, 255, 0.3);
}

.btn-delete {
    background: #fff0f0;
    color: #e53935;
    border: 1px solid #ffcdd2;
}

.btn-delete:hover {
    background: #e53935;
    color: white;
}

.btn-small {
    padding: 8px 15px;
    font-size: 0.85rem;
}

.btn-play {
    background: #667eea;
    color: white;
}

.btn-details {
    background: #eee;
    color: #555;
}

/* Edit Mode Styles */
.edit-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.topic-edit {
    font-weight: bold;
    font-size: 1.1rem;
}

.notes-edit {
    min-height: 100px;
    resize: vertical;
    line-height: 1.5;
}

.edit-tags-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 15px;
    background: #f0f2f5;
    padding: 15px;
    border-radius: 10px;
}

.edit-tag-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.edit-tag-field label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #667eea;
    text-transform: uppercase;
}

.edit-tag-field input {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.85rem;
}

.edit-actions {
    display: flex;
    gap: 8px;
}

.btn-edit {
    background: #e8eaf6;
    color: #3f51b5;
    border: 1px solid #c5cae9;
}

.btn-edit:hover {
    background: #3f51b5;
    color: white;
}

@media (max-width: 600px) {
    .edit-tags-container {
        grid-template-columns: 1fr;
    }
}

.loading, .empty, .error {
    text-align: center;
    padding: 40px;
    color: #888;
    font-style: italic;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close-btn {
    position: absolute;
    right: 20px;
    top: 15px;
    color: #aaa;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    z-index: 10;
}

.close-btn:hover {
    color: #333;
}

#modalBody h2 {
    color: #667eea;
    margin-bottom: 20px;
    padding-right: 30px;
    font-size: 1.5rem;
}

.detail-section {
    margin-bottom: 25px;
}

.detail-section h3 {
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-content {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 12px;
    line-height: 1.6;
    color: #333;
}

.transcription-preview {
    white-space: pre-wrap;
}

.btn-link {
    background: none;
    border: none;
    color: #667eea;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font-weight: 600;
    margin-top: 5px;
}

.obs-chip {
    display: inline-block;
    background: #e1f5fe;
    color: #0288d1;
    padding: 5px 12px;
    border-radius: 15px;
    margin: 3px;
    font-size: 0.9rem;
}

@media (max-width: 767px) {
    .modal-content {
        margin: 10% auto;
        padding: 20px;
        width: 95%;
    }
    
    .close-btn {
        font-size: 45px; /* Larger for easier tapping */
        top: 5px;
        right: 15px;
    }
}

footer {
    text-align: center;
    color: white;
    margin-top: 40px;
    padding: 20px;
    opacity: 0.8;
}

/* Responsive Design */
@media (min-width: 768px) {
    .main-content {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 767px) {
    header h1 {
        font-size: 2.2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .card {
        padding: 20px;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .search-controls {
        flex-direction: column;
    }

    .search-input {
        width: 100%;
    }

    .timer {
        font-size: 2rem;
    }
}

/* Review Modal Sticky Actions */
.review-actions-sticky {
    position: sticky;
    bottom: -30px; /* Offset modal padding */
    background: white;
    padding: 15px 0;
    margin-top: 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    z-index: 100;
    box-shadow: 0 -10px 20px rgba(255,255,255,0.9);
}

@media (max-width: 767px) {
    .review-actions-sticky {
        bottom: -20px;
        padding: 10px 0;
    }
}
