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

:root {
    --primary: #3b82f6; 
    --primary-dark: #2563eb; 
    --danger: #ef4444;
    --success: #10b981;
    --bg: #171c26;
    --card: #212733;
    --text: #f1f5f9;
    --text-dim: #94a3b8;
    --border: #3d4757;
    --background-hover: #3d4757; /* Defined for use in modal close button */
    --border-color: rgba(255, 255, 255, 0.1); /* Defined for use in modal header */
    --text-primary: var(--text); /* Defined for use in modal header */
    --text-secondary: var(--text-dim); /* Defined for use in modal body */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 80px;
}

.header {
    padding: 1.5rem;
    background: rgba(33, 39, 51, 0.7); 
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); 
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* --- NEW: Wrapper for H1 and action buttons --- */
.header-content-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.header h1 {
    font-size: 1.4rem; /* Reduced size */
    margin-bottom: 0; /* Removed margin */
}

/* --- NEW: Styles for the new buttons --- */
.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.header-btn {
    padding: 0.5rem 0.75rem; /* Slightly smaller padding */
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-weight: 500;
    cursor: pointer;
    font-size: 0.85rem; /* Smaller font size */
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap; 
}
.header-btn:hover {
    background: var(--background-hover);
    border-color: var(--primary);
}


.header-btn-logout {
	background: #530d0d;
    color: #db2121;
    padding: 0.5rem 0.75rem; /* Slightly smaller padding */
    border: 1px solid var(--border);
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.85rem; /* Smaller font size */
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap; 
}

.header-btn-logout:hover {
	background: #751212;
    
    border-color: var(--danger);
}



.tabs {
    display: flex;
    gap: 0; 
    margin: 0 -1.5rem; 
}

.tab {
    flex-grow: 1; 
    padding: 0.75rem 1rem; 
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    border-bottom: 3px solid transparent; 
    transition: all 0.3s;
    font-size: 1rem;
}

.tab:hover:not(.active) {
     background-color: rgba(61, 71, 87, 0.2); 
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background-color: var(--card);
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Renamed to note-card */
.note-card {
    background: rgba(33, 39, 51, 0.7); 
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); 
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1); 
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    user-select: none;
    cursor: pointer; 
}

.note-card.swiping {
    transition: none;
}

/* --- MODIFIED: This is for swipe-right --- */
.note-card .swipe-indicator {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    /* --- MODIFIED: Switched to success color --- */
    background: var(--success);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    font-weight: 600;
    opacity: 0;
    /* JS will control opacity during swipe, CSS controls it on reset */
    transition: opacity 0.3s;
}

/* --- NEW: Green indicator for reactivate swipe --- */
.note-card .swipe-indicator.swipe-reactivate {
    background: var(--success);
    left: auto;
    right: 0;
    justify-content: flex-end;
}

.note-card.swiping .swipe-indicator {
     /* This class no longer controls opacity, JS does */
}

/* Renamed to note-content-wrapper */
.note-content-wrapper {
    position: relative;
    z-index: 2;
    /* Added for smooth transition back */
    transition: transform 0.3s ease; 
}

/* This new style is for the note title */
.note-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    word-break: break-word;
}

/* This class is now used for note content */
.note-content {
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
    color: var(--text-dim);
    white-space: pre-wrap;
    word-break: break-word;
    
    max-height: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    /* Added for smooth transition */
    transition: all 0.2s ease-in-out;
}

/* --- NEW: Hide title if it's a generic reminder --- */
.note-card.is-reminder .note-title {
    display: none;
}

/* --- NEW: Re-balance content if title is hidden --- */
.note-card.is-reminder .note-content {
    font-size: 1.15rem; /* Larger */
    font-weight: 500;     /* Bolder */
    color: var(--text);   /* Brighter */
    max-height: 120px;    /* Adjust height */
    -webkit-line-clamp: 5; /* Allow more lines */
}

.note-meta {
    font-size: 0.875rem;
    color: var(--text-dim);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 12px;
    transition: all 0.2s ease-in-out;
}

/* --- NEW: Adjust meta spacing if title is hidden --- */
.note-card.is-reminder .note-meta {
    margin-top: 1rem; /* More space */
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-dim);
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-dim);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4); 
    transition: all 0.3s;
    z-index: 200;
}

.fab:hover {
    transform: scale(1.1);
    background: var(--primary-dark);
}

.fab:active {
    transform: scale(0.95);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* backdrop-filter will be controlled in HTML style block */
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--card);
    border-radius: 20px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.recording-animation {
    width: 120px;
    height: 120px;
    margin: 2rem auto;
    position: relative;
}

.recording-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--danger);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
}

.recording-text {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.transcript-box {
    background: var(--bg);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    min-height: 80px;
    max-height: 200px;
    overflow-y: auto;
    text-align: left;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn {
    flex: 1;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: #475569;
}

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

.edit-modal textarea {
    width: 100%;
    min-height: 100px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 1rem;
}

.edit-modal textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.notification {
    position: fixed;
    bottom: 5rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card);
    padding: 1rem 1.5rem;
    border-radius: 50px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 3000;
    display: none;
    animation: slideUp 0.3s ease-out;
}

.notification.active {
    display: block;
}

/* --- FIX: Colored Toast Messages --- */
.notification.success {
    background: var(--success);
    color: white;
}

.notification.error {
    background: var(--danger);
    color: white;
}
/* --- END --- */

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

.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    margin-right: 0.5rem;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.completed-badge {
    display: inline-block;
    background: var(--success);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}


.fab {
	display:none;
}