/* /css/components.css */

.user-popover-menu {
    position: fixed;
    background-color: var(--apple-card-bg-light);
    border: 1px solid var(--apple-card-border-light);
    border-radius: 0.7rem;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    z-index: 1050;
    min-width: 160px;
    display: none;
    flex-direction: column;
    padding: 0.4rem 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.user-popover-menu.show { 
    opacity: 1; 
    visibility: visible; 
    display: flex; 
    transform: translateY(5px); 
}
.user-popover-menu .popover-link { 
    padding: 0.6rem 1rem; 
    color: var(--sidebar-text-color); 
    text-decoration: none; 
    white-space: nowrap; 
    transition: background-color 0.2s ease, color 0.2s ease; 
    display: block;
}
[data-bs-theme="dark"] .user-popover-menu { 
    background-color: var(--apple-card-bg-dark); 
    border-color: var(--apple-card-border-dark); 
}
body.sidebar-hidden .user-popover-menu { 
    display: none !important; 
    opacity: 0 !important; 
    visibility: hidden !important; 
}
.user-popover-menu .popover-link:hover {
    color: var(--apple-accent-color);
    background-color: var(--sidebar-link-hover-bg);
}


.note-actions .btn { font-size: 0.7rem; padding: 0.1rem 0.4rem; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
.note-text { overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; }

.card-glass, .header-glass { 
    -webkit-backdrop-filter: blur(20px); 
    backdrop-filter: blur(20px); 
    background-color: var(--apple-card-bg-light); 
    border: 1px solid var(--apple-card-border-light); 
    border-radius: 1rem; 
    transition: all 0.3s ease;
    box-shadow: 0 6px 18px var(--button-glow);
}
[data-bs-theme="dark"] .card-glass, [data-bs-theme="dark"] .header-glass { background-color: var(--apple-card-bg-dark); border: 1px solid var(--apple-card-border-dark); }

.shimmer-overlay::after { content: ''; position: absolute; inset: 0; z-index: 0; background-image: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0)); background-size: 200% 100%; animation: shimmer 5s infinite linear; }
[data-bs-theme="dark"] .shimmer-overlay::after { background-image: linear-gradient(100deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.05) 50%, rgba(255, 255, 255, 0)); }


header .navbar .nav-link { font-weight: 500; }
#addNoteBtn { font-weight: 500; }

button, .btn, .btn-primary {
    background-color: var(--apple-accent-color);
    border-color: transparent;
    color: #fff;
    border-radius: 0.6rem;
    padding: 0.45rem 0.9rem;
    transition: all 0.25s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

button:hover, .btn:hover, .btn-primary:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 0 12px var(--button-glow);
    transform: translateY(-3px);
}

button:active, .btn:active {
    transform: scale(0.97);
    box-shadow: 0 0 6px var(--button-glow);
}

[data-bs-theme="dark"] .btn-primary {
    color: #1c1c1e;
}

.text-primary, a { color: var(--apple-accent-color); text-decoration: none; }
a { transition: color 0.2s ease; } 
a:hover { color: var(--accent-hover); } 

header .nav-pills .nav-link {
    font-weight: 500;
    border-radius: 0.6rem; 
    padding: 0.45rem 0.9rem; 
    transition: all 0.25s ease, box-shadow 0.2s ease; 
    color: var(--sidebar-text-color); 
    background-color: transparent; 
}

header .nav-pills .nav-link:not(.active):hover {
    background-color: var(--sidebar-link-hover-bg);
    transform: translateY(-2px); 
}

header .nav-pills .nav-link.active, 
header .nav-pills .show > .nav-link {
    background-color: var(--apple-accent-color);
    color: white; 
    font-weight: 600;
    box-shadow: 0 0 12px var(--button-glow);
}

[data-bs-theme="dark"] header .nav-pills .nav-link.active, 
[data-bs-theme="dark"] header .nav-pills .show > .nav-link {
    color: #1c1c1e; 
}

header .nav-pills .nav-link.active:hover, 
header .nav-pills .show > .nav-link:hover {
    background-color: var(--accent-hover);
    transform: translateY(-3px); 
    box-shadow: 0 0 12px var(--button-glow);
}

#theme-switcher .btn {
    background-color: transparent;
    color: var(--sidebar-text-color);
    box-shadow: none;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#theme-switcher .btn:hover {
    background-color: var(--sidebar-link-hover-bg);
    transform: none;
    box-shadow: none;
}

#theme-switcher .btn.active {
    background-color: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1), inset 0 1px 1px rgba(0,0,0,0.05);
    color: var(--bs-body-color) !important;
}

[data-bs-theme="dark"] #theme-switcher .btn.active {
    background-color: #495057;
}


/* === ADD ALL THE CSS BELOW THIS LINE === */

/* --- Fix for ugly nav-tabs --- */
.nav-tabs {
    border-bottom: 2px solid var(--apple-card-border);
}

.nav-tabs .nav-link {
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    color: var(--apple-secondary-text);
    padding: 0.5rem 0.2rem;
    margin-right: 1.5rem;
    margin-bottom: -2px; /* Aligns border with parent border */
    
    /* Reset all button-like styles */
    border-radius: 0;
    transform: none;
    box-shadow: none;
    font-weight: 500;
}

.nav-tabs .nav-link:hover {
    background: transparent;
    border-bottom-color: var(--apple-secondary-text);
    color: var(--apple-text-color);
    transform: none; /* Override button hover */
    box-shadow: none; /* Override button hover */
}

.nav-tabs .nav-link.active {
    background: transparent;
    color: var(--apple-accent-color);
    border-bottom-color: var(--apple-accent-color);
    font-weight: 600;
    
    /* Reset all button-like active styles */
    transform: none;
    box-shadow: none;
}

/* --- Mail Test Result Box --- */
.mail-test-result {
    padding: 1rem 1.25rem;
    border-radius: 0.6rem;
    font-size: 0.95rem;
    word-wrap: break-word;
}
/* Style the <pre> tag with the debug log */
.mail-test-result pre {
    text-align: left;
    background: rgba(0,0,0,0.1);
    border: 1px solid var(--apple-card-border);
    padding: 10px;
    border-radius: 5px;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap; /* Wrap long lines */
    word-break: break-all;
}

[data-bs-theme="dark"] .mail-test-result pre {
    background: rgba(255,255,255,0.05);
}

/* === Fix for Tagify Placeholder Color === */
/*
 * This targets Tagify's custom placeholder (a ::before pseudo-element)
 * when the component is empty. It forces it to use our
 * theme-aware CSS variable (--apple-placeholder-color)
 * instead of Tagify's hardcoded default gray/black.
*/
.tagify.tagify--empty .tagify__input::before {
    color: var(--apple-placeholder-color);
    opacity: 1; /* Ensures it's fully visible, as your variable already has transparency */
}

/* === NEW: Console/Log Output Box === */
/* This styles the Python script output */
.console-output {
    background-color: rgba(0, 0, 0, 0.2); /* Dark, slightly transparent bg */
    border: 1px solid var(--apple-card-border);
    border-radius: 0.6rem;
    padding: 0.75rem 1rem;
    backdrop-filter: blur(5px);
}

[data-bs-theme="dark"] .console-output {
    background-color: rgba(0, 0, 0, 0.3);
}

/* Styles the <pre> tag inside the console */
.console-output pre {
    margin: 0;
    padding: 0;
    font-family: 'SFMono-Regular', Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.85em;
    color: var(--apple-text-color);
    white-space: pre-wrap; /* Wrap long lines */
    word-wrap: break-word;
}

[data-bs-theme="dark"] .console-output pre {
    color: #f5f5f7; /* Lighter text on dark bg */
}

/*
 * ==================================================
 * FINAL FIX: Tagify 'select' Mode Dark Mode
 * ==================================================
 * This targets the tag element that 'select' mode
 * uses to display the selected value.
 */

/*
 * 1. Force the tag's text color to use your theme variable.
 * This is the most important part.
 */
[data-bs-theme="dark"] .tagify--select .tagify__tag-text {
    color: var(--sidebar-text-color) !important;
}

/*
 * 2. Make the tag itself transparent so it blends
 * in with the form-control background.
 */
[data-bs-theme="dark"] .tagify--select .tagify__tag {
    background-color: transparent !important;
}

/*
 * 3. Remove extra padding/margins from the tag
 * to make it look like normal input text.
 */
.tagify--select .tagify__tag {
    padding: 0 !important;
    margin: 0 !important;
    /* Vertically center the text */
    display: inline-flex;
    align-items: center;
}

/* 4. Fixes the placeholder (which you already had) */
.tagify.tagify--empty .tagify__input::before {
    color: var(--apple-placeholder-color);
    opacity: 1;
}