/* --- Auth System --- */
.auth-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #f5f5f7;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-card {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 360px;
    text-align: center;
    animation: authFadeIn 0.4s ease-out;
}

@keyframes authFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.auth-card h2 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #1d1d1f;
    font-size: 24px;
}

.auth-input-group {
    margin-bottom: 15px;
    text-align: left;
}

.auth-input-group label {
    display: block;
    font-size: 12px;
    color: #86868b;
    margin-bottom: 5px;
    font-weight: 500;
}

.auth-input-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #d2d2d7;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.auth-input-group input:focus {
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.auth-btn-primary {
    width: 100%;
    padding: 12px;
    background: #007aff;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 10px;
}

.auth-btn-primary:hover {
    background: #0071e3;
}

.auth-footer {
    margin-top: 20px;
    font-size: 13px;
    color: #86868b;
}

.link-btn {
    color: #007aff;
    cursor: pointer;
    text-decoration: none;
}

.link-btn:hover {
    text-decoration: underline;
}

/* App Wrapper Transition */
.app-layout {
    transition: filter 0.3s;
}

/* Base Layout */
html, body {
    margin: 0;
    padding: 0;
    height: 100%; /* Ensure full height */
    overflow: hidden; /* Prevent body scroll */
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f5f5f7;
    color: #1d1d1f;
}

.app-layout {
    display: flex;
    height: 100%;
    width: 100%;
    overflow: hidden; /* Ensure layout doesn't grow */
}

/* --- Sidebar --- */
.app-sidebar {
    width: 260px;
    background: #fbfbfd;
    border-right: 1px solid #d2d2d7;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    padding-top: 20px;
    position: relative;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50; /* Ensure it stays above if we add shadows */
}

/* Sidebar Toggle Button */
.sidebar-toggle-btn {
    position: absolute;
    top: 26px; /* Aligned with logo center */
    right: -12px;
    width: 24px;
    height: 24px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    color: #86868b;
    font-size: 14px;
    transition: all 0.2s;
    opacity: 0; /* Hidden by default, shown on hover */
    /* Remove pointer-events: none to ensure it captures hover/clicks */
}

.app-sidebar:hover .sidebar-toggle-btn {
    opacity: 1;
}

/* Make button visible if sidebar is collapsed, so user knows how to expand */
.app-sidebar.collapsed .sidebar-toggle-btn {
    opacity: 1;
    pointer-events: auto;
}

.sidebar-toggle-btn:hover {
    background: #f5f5f7;
    color: #1d1d1f;
    transform: scale(1.1);
}

/* Collapsed State Styles */
.app-sidebar.collapsed {
    width: 68px; /* Narrow strip */
}

/* Allow tooltips to show outside */
.app-sidebar.collapsed .sidebar-nav {
    overflow: visible;
}

/* Tooltip for Collapsed State */
.app-sidebar.collapsed .nav-item {
    position: relative;
}

.app-sidebar.collapsed .nav-item:hover::after {
    content: attr(data-title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 10px;
    background: #333;
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    animation: tooltipFadeIn 0.2s forwards;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

@keyframes tooltipFadeIn {
    to { opacity: 1; }
}

/* Content Hiding in Collapsed State */
.app-sidebar.collapsed .logo-text,
.app-sidebar.collapsed .nav-label,
.app-sidebar.collapsed .nav-item .count,
.app-sidebar.collapsed .nav-item .nav-text {
    opacity: 0;
    pointer-events: none;
    display: none !important; /* Force hide */
}

/* Icon Centering in Collapsed State */
.app-sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 10px 0; /* More spacing in collapsed mode */
    overflow: visible; /* Allow tooltip to show */
}

.app-sidebar.collapsed .nav-item .icon {
    margin-right: 0; /* Remove margin to ensure true centering */
}

.app-sidebar.collapsed .sidebar-header {
    padding: 0;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    overflow: visible; /* Ensure toggle button isn't clipped if needed */
}

/* Adjust logo icon size/position when collapsed */
.app-sidebar.collapsed .app-logo {
    justify-content: center;
    margin: 0;
    padding-top: 5px;
}

/* Hide specific elements */
.app-sidebar.collapsed .nav-section {
    margin-bottom: 15px;
}

/* Hide Preview, Backup, and Account sections completely in collapsed state */
.app-sidebar.collapsed .section-preview,
.app-sidebar.collapsed .section-backup,
.app-sidebar.collapsed .section-account {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sidebar-header {
    padding: 0 20px 20px 20px;
}

.app-logo {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #1d1d1f;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box input {
    width: 100%;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #d2d2d7;
    background: #e3e3e8;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    transition: background 0.2s;
}

.search-box input:focus {
    background: #fff;
    border-color: #007aff;
}

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0 10px;
}

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

.nav-label {
    font-size: 11px;
    font-weight: 600;
    color: #86868b;
    margin-bottom: 8px;
    padding-left: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #424245;
    transition: background 0.1s;
    user-select: none;
}

.nav-item:hover {
    background: #e8e8ed;
}

.nav-item.active {
    background: #e4e4e9;
    /* Active Gray */
    color: #1d1d1f;
    font-weight: 500;
}

.nav-item .icon {
    margin-right: 10px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
}

.nav-item .count {
    margin-left: auto;
    font-size: 12px;
    color: #86868b;
}

/* --- Main Content --- */
.app-main {
    flex: 1;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.view-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* --- Search View --- */
.search-result-group {
    margin-bottom: 30px;
}

.search-group-title {
    font-size: 14px;
    font-weight: bold;
    color: #86868b;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-item {
    padding: 15px;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.search-item.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-item:hover {
    border-color: #007aff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.search-item-title {
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 4px;
}

.search-item-context {
    font-size: 13px;
    color: #6e6e73;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-content {
    flex: 1;
}

.history-delete {
    padding: 5px;
    cursor: pointer;
    opacity: 0.6;
    font-size: 16px;
    transition: opacity 0.2s, color 0.2s;
}

.history-delete:hover {
    opacity: 1;
    color: #ff3b30;
}

/* --- Profile & Sync Views --- */
.profile-section {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 20px;
    color: #1d1d1f;
    border-bottom: 1px solid #f0f0f5;
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #86868b;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    font-family: inherit;
    color: #1d1d1f;
}

.form-input:focus {
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.primary-btn {
    background: #007aff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.primary-btn:hover {
    background: #0071e3;
}

.action-btn {
    padding: 6px 12px;
    border: 1px solid #d2d2d7;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #1d1d1f;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #f5f5f7;
    border-color: #c7c7cc;
}

.action-btn.destructive, .destructive-btn {
    color: #ff3b30;
    border-color: #ff3b30;
    background: white;
    border: 1px solid #ff3b30;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.destructive-btn {
    width: 100%;
}

.action-btn.destructive:hover, .destructive-btn:hover {
    background: #fff0f0;
    border-color: #ffcccc;
}

.view-header {
    height: 60px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    flex-shrink: 0;
}

.view-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.view-controls {
    display: flex;
    flex-direction: row;
    /* Ensure horizontal */
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    /* Prevent wrapping */
}

/* Page Grid (Home View) */
.page-grid {
    padding: 40px;
    box-sizing: border-box;
    /* overflow-y: auto; Removed to allow parent to handle scroll */
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    align-content: start;
    align-items: start; /* Fix: Prevent row height stretching and ensure independent card expansion */
    
    /* Center and Fixed Width Design */
    max-width: 1400px;
    min-width: 1100px; /* Force horizontal scroll on narrow screens */
    margin: 0 auto;
    width: 100%;
}

/* Remove responsive column reduction to enforce 4 columns + scroll */
/* 
@media (max-width: 1400px) {
    .page-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
...
*/

/* Page Card Style */
.grid-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 220px;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.grid-card.list-row {
    flex-direction: row;
    height: auto;
    min-height: 100px;
}

.grid-card.list-row .grid-card-cover {
    width: 120px;
    height: auto;
    flex-shrink: 0;
}

.grid-card.list-row .grid-card-info {
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

.grid-card.list-row .grid-card-title {
    margin-bottom: 0;
    flex: 1;
}

.grid-card.list-row .grid-card-meta {
    margin-top: 0;
}

.grid-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    /* Soft shadow */
    transform: translateY(-4px);
    border-color: #d2d2d7;
}

.grid-card-cover {
    height: 120px;
    background: #f5f5f7;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: #d2d2d7;
    position: relative;
}

.grid-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.grid-card-info {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-main-content {
    width: 100%;
}

.grid-card.list-row .card-main-content {
    width: auto;
    flex: 1;
    min-width: 0;
    margin-right: 15px;
}

.grid-card-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: #1d1d1f;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.grid-card-domain {
    font-size: 11px;
    color: #86868b;
    display: flex;
    align-items: center;
    gap: 4px;
}

.grid-card-meta {
    margin-top: auto;
    display: flex;
    gap: 6px;
}

.meta-badge {
    height: 20px;
    padding: 0 8px;
    border-radius: 10px;
    background: #f5f5f7;
    color: #6e6e73;
    font-size: 10px;
    display: flex;
    align-items: center;
    font-weight: 500;
}

/* --- Chat Notes Styles (Matches dashboard.html) --- */
#chatGrid {
    padding-bottom: 100px;
}

.chat-bubble-row {
    display: flex;
    margin-bottom: 24px;
    padding: 0 40px;
    align-items: flex-start;
}

/* Responsive Grid for Chat Notes */
.chat-notes-view .chat-bubble-row {
    display: grid;
    grid-template-columns: 1fr minmax(auto, 750px) 1fr; /* Flexible sides, max center */
    justify-content: center !important;
    gap: 20px;
    padding: 0 40px; /* Increased padding for better edge whitespace */
    width: 100%;
    box-sizing: border-box;
    align-items: start;
    margin-bottom: 24px;
}

/* Collapsible Bubble Styles */
.user-bubble-collapsible, .ai-bubble-collapsible {
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s;
}

.user-bubble-collapsible:hover, .ai-bubble-collapsible:hover {
    background-color: #dbeafe !important; /* Slightly darker hover */
}
.ai-bubble-collapsible:hover {
    background-color: #e5e5e5 !important; /* Darker grey for AI */
}

.user-bubble-collapsible::after, .ai-bubble-collapsible::after {
    content: 'Show less';
    display: block;
    font-size: 11px;
    color: #007aff;
    margin-top: 8px;
    font-weight: 500;
}

.user-bubble-collapsible.is-collapsed::after, .ai-bubble-collapsible.is-collapsed::after {
    content: 'Show more...';
}

.user-bubble-content.collapsed, .ai-bubble-content.collapsed {
    max-height: 150px;
    overflow: hidden;
    mask-image: linear-gradient(180deg, black 60%, transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, black 60%, transparent 100%);
}

@media (max-width: 1300px) {
    .chat-notes-view .chat-bubble-row {
        grid-template-columns: 200px 1fr 200px;
    }
}

@media (max-width: 1024px) {
    .chat-notes-view .chat-bubble-row {
        grid-template-columns: 120px 1fr 120px;
    }
}

@media (max-width: 768px) {
    .chat-notes-view .chat-bubble-row {
        grid-template-columns: 1fr;
        display: flex;
        flex-direction: column;
        padding: 0 15px;
    }
    .chat-col-side { display: none; }
}

.chat-col-center {
    display: flex;
    flex-direction: column;
}

.chat-notes-view .chat-bubble-row.user .chat-col-center {
    align-items: flex-end;
}

.chat-notes-view .chat-bubble-row.ai .chat-col-center {
    align-items: flex-start;
}

.chat-bubble-row.user {
    justify-content: flex-end;
}

.chat-bubble-row.ai {
    justify-content: flex-start;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.chat-avatar.user {
    margin-left: 12px;
    background: #007aff;
    color: white;
}

.chat-avatar.ai {
    margin-right: 12px;
    background: #f5f5f7;
    border: 1px solid #e5e5e5;
}

.chat-bubble {
    padding: 16px 20px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.6;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    min-width: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Scoped styles for Gemini/ChatGPT Chat View */
.chat-notes-view .chat-bubble-row.ai .chat-bubble {
    background: #f2f2f2;
    color: #1d1d1f;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 80%;
    margin-left: 12px;
    box-shadow: none;
}

.chat-notes-view .chat-bubble-row.user .chat-bubble {
    background: #e8f0fe;
    color: #1d1d1f;
    border-radius: 18px;
    border-bottom-right-radius: 4px;
    max-width: min(50ch, calc(100% - 70px));
    margin-right: 12px;
    box-shadow: none;
}

.chat-notes-view .note-box {
    background: #fafafa;
    border: 1px solid #efefef;
    border-radius: 8px;
    border-left: 3px solid #d1d1d6;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    color: #48484a;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    white-space: pre-wrap;
    position: relative;
    transition: all 0.2s;
    margin-top: 8px;
    min-height: 40px;
}

.chat-notes-view .note-box:hover {
    border-color: #d1d1d6;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.chat-notes-view .note-edit-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    padding: 2px 6px;
    font-size: 10px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    color: #86868b;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    gap: 2px;
}

.chat-notes-view .note-box:hover .note-edit-btn {
    opacity: 1;
}

.chat-avatar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 4px;
    flex-shrink: 0;
    width: 50px;
    background: transparent; /* Override */
    border: none; /* Override */
    border-radius: 0; /* Override */
    height: auto; /* Override */
}

.bubble-tag {
    font-size: 10px;
    color: #999;
    margin-top: 4px;
    white-space: nowrap;
}

.chat-detail-link {
    transition: color 0.2s, stroke 0.2s;
}

.chat-detail-link:hover {
    color: #007aff !important;
}

.chat-detail-link:hover svg {
    stroke: #007aff;
}

/* Edit Cover Buttons in Card */
.btn-edit-cover {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 5;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-remove-cover {
    position: absolute;
    bottom: 8px;
    right: 42px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    color: #ffcccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 5;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.grid-card-cover:hover .btn-edit-cover,
.grid-card-cover:hover .btn-remove-cover {
    opacity: 1;
}

.btn-edit-cover:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.btn-remove-cover:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
    color: #ff4444;
}

/* Date Header */
.date-header {
    grid-column: 1 / -1;
    margin: 20px 0 10px 0;
    padding: 8px 16px;
    background: #f5f5f7;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #1d1d1f;
    display: flex;
    align-items: center;
}

.grid-card-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: #1d1d1f;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.grid-card-domain {
    font-size: 11px;
    color: #86868b;
    display: flex;
    align-items: center;
    gap: 4px;
}

.grid-card-meta {
    margin-top: auto;
    display: flex;
    gap: 6px;
}

.meta-badge {
    height: 20px;
    padding: 0 8px;
    border-radius: 10px;
    background: #f5f5f7;
    color: #6e6e73;
    font-size: 10px;
    display: flex;
    align-items: center;
    font-weight: 500;
}

/* --- Detail View --- */
.detail-header-bar {
    justify-content: flex-start;
    gap: 20px;
}

.back-btn {
    border: none;
    background: none;
    font-size: 14px;
    color: #007aff;
    cursor: pointer;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 6px;
}

.back-btn:hover {
    background: #f0f0f0;
}

.page-header-content {
    padding: 20px 40px;
    border-bottom: 1px solid #f5f5f5;
}

.page-header-content h1 {
    font-size: 24px;
    margin: 0 0 10px 0;
}

/* --- Highlight Card Grid --- */
.highlight-cards {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    align-content: start;
    align-items: start; /* Critical for independent column expansion */
    
    /* Centering and Margins */
    max-width: 1400px;
    min-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 40px;

    box-sizing: border-box;
}

@media (max-width: 1000px) {
    .highlight-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .highlight-cards {
        grid-template-columns: 1fr;
    }
}

/* --- Card Base Style --- */
.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    border: 1px solid #e5e5e5;
    border-left: 4px solid #ddd;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.3s ease;
    width: 100%; /* Ensure card fills the grid column */
    
    /* Folded State Defaults */
    height: 320px;
    overflow: hidden;
}

.card.editing {
    height: auto !important;
    min-height: 320px; /* Prevent shrinking below default */
    overflow: visible !important;
    z-index: 50;
}

.card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

/* Expanded State */
.card.expanded {
    height: auto;
    width: 100%; /* Ensure width stays fixed to column width */
    overflow: visible;
    z-index: 100; /* Pop above neighbors if needed */
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
}

/* Interaction - Only if expandable */
.card.expandable {
    cursor: pointer;
}
.card.expandable:hover::after {
    /* Optional hint */
}

/* --- Card Content Structure --- */

/* Header: Rank & Time */
.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 12px;
    color: #999;
    min-height: 20px;
    flex-wrap: nowrap; /* Force single line */
}

.card-rank {
    font-weight: 600;
    color: #d2d2d7;
    font-size: 14px; /* Small size */
    line-height: 1;
    flex-shrink: 0; /* Prevent shrinking */
}

.card-timestamp {
    white-space: nowrap; /* Prevent wrapping */
}

/* Content Wrapper */
.card-content-wrapper {
    flex: 1;
    overflow: hidden; /* Hide overflow in folded state */
    margin-bottom: 15px;
}

.card-text {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    overflow-wrap: break-word;
    word-break: break-word;
    
    /* Line Clamp Logic */
    display: -webkit-box;
    -webkit-line-clamp: 10;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Expanded Text */
.card.expanded .card-text {
    -webkit-line-clamp: unset;
    overflow: visible;
}

/* Bottom Group (Sticky at bottom of card) */
.card-bottom-group {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-note {
    background: #fafafa;
    border: 1px solid #efefef;
    border-radius: 8px;
    border-left: 3px solid #d1d1d6;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    color: #48484a;
    display: flex;
    gap: 8px;
    align-items: flex-start;
    transition: all 0.2s;
    font-family: inherit;
    white-space: pre-wrap;
}

.card-note:hover {
    border-color: #d1d1d6;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    background: #e8f0fe;
    color: #1967d2;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* Actions Footer */
.card-actions-footer {
    padding-top: 10px;
    border-top: 1px solid #f5f5f5;
    display: flex;
    justify-content: center; /* Center buttons */
    gap: 20px;
    margin-top: 10px; /* Add spacing from content/meta */
}

/* Action Buttons */
.card-action-btn {
    cursor: pointer;
    font-size: 16px;
    opacity: 0.6;
    transition: all 0.2s;
}
.card-action-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Color Variants */
.card.yellow { border-left-color: #ffd700; }
.card.green { border-left-color: #b7f0b7; }
.card.blue { border-left-color: #bae1ff; }
.card.pink { border-left-color: #ffb3ba; }
.card.purple { border-left-color: #e0bbe4; }
.card.image-card { border-left-color: #2196F3; }


/* --- View Layouts --- */

/* Page List View (Centered) */
.page-list-view {
    padding: 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    width: 100%;
    box-sizing: border-box;
    align-items: center; /* Center the cards */
    
    /* Center and Fixed Width Design */
    max-width: 1400px;
    margin: 0 auto;
}

.page-list-view .card {
    width: 100%;
    max-width: 1100px; /* Constrain card width */
}

/* Gallery Layout (Masonry) */
.page-gallery-view {
    padding: 20px 40px;
    column-count: 4;
    column-gap: 20px;
    overflow-y: auto;
    display: block;
    box-sizing: border-box;
}

.page-gallery-view .gallery-item-wrapper,
.page-gallery-view .grid-card {
    break-inside: avoid;
    margin-bottom: 20px;
    display: inline-block;
    /* Fix for Masonry artifacts */
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 1200px) {
    .page-gallery-view {
        column-count: 3;
    }
}

@media (max-width: 900px) {
    .page-gallery-view {
        column-count: 2;
    }
}

@media (max-width: 600px) {
    .page-gallery-view {
        column-count: 1;
    }
}

.btn-edit-card {
    color: #FF9800;
    background: #fff3e0;
}

.btn-edit-card:hover {
    background: #ffe0b2;
}

.btn-delete-card {
    color: #ff3b30;
}

.btn-delete-card:hover {
    background: #ffebee;
}

.btn-copy-card {
    color: #86868b;
}

.btn-copy-card:hover {
    background: #f0f0f0;
    color: #1d1d1f;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #86868b;
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 15px;
    color: #d2d2d7;
}

/* --- Layout Modes --- */

/* List Layout */
.page-grid.layout-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.page-grid.layout-list .grid-card {
    height: auto;
    flex-direction: row;
    min-height: 80px;
    align-items: center;
    padding: 10px 20px;
}

/* Header Export Button */
.btn-header-export {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    background: white;
    color: #333;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    height: 32px;
    /* Match toggle height */
}

.btn-header-export:hover {
    background: #fdfdfd;
    border-color: #d1d1d6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.btn-header-export:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    background: #f5f5f7;
}

.page-grid.layout-list .grid-card-cover {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    margin-right: 20px;
    flex-shrink: 0;
    font-size: 24px;
}

.page-grid.layout-list .grid-card-info {
    flex-direction: row;
    align-items: center;
    padding: 0;
    gap: 20px;
}

.page-grid.layout-list .grid-card-title {
    flex: 1;
    margin: 0;
    font-size: 16px;
    -webkit-line-clamp: 1;
}

.page-grid.layout-list .grid-card-domain {
    width: 150px;
}

.page-grid.layout-list .grid-card-meta {
    margin: 0;
    width: 140px;
    justify-content: flex-end;
}

.page-grid.layout-list .delete-card-btn {
    position: static;
    margin-left: 10px;
    opacity: 0;
    /* Hover still applies */
}

.page-grid.layout-list .grid-card:hover .delete-card-btn {
    opacity: 1;
}


/* Masonry Layout */
.page-grid.layout-masonry {
    display: block;
    column-count: 4;
    column-gap: 20px;
    padding: 40px;
}

.page-grid.layout-masonry .grid-card {
    display: inline-block;
    width: 100%;
    margin-bottom: 20px;
    height: auto;
    break-inside: avoid;
}

.page-grid.layout-masonry .grid-card-cover {
    height: auto;
    min-height: 100px;
}

@media (max-width: 1200px) {
    .page-grid.layout-masonry {
        column-count: 3;
    }
}

@media (max-width: 800px) {
    .page-grid.layout-masonry {
        column-count: 2;
    }
}

/* View Toggles */
.layout-toggle-btn {
    padding: 5px 8px;
    cursor: pointer;
    border-radius: 4px;
    color: #888;
    background: transparent;
    border: none;
    font-size: 16px;
    transition: all 0.2s;
}

.layout-toggle-btn:hover {
    background: #e5e5e5;
    color: #333;
}

.layout-toggle-btn.active {
    background: #e0e0e0;
    color: #007aff;
}

/* Custom Cover Edit Button */
.btn-edit-cover {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 5;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-remove-cover {
    position: absolute;
    bottom: 8px;
    right: 42px;
    /* Left of the edit button */
    width: 24px;
    /* Smaller than edit */
    height: 24px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    color: #ffcccc;
    /* Soft red */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 5;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.grid-card-cover:hover .btn-edit-cover,
.grid-card-cover:hover .btn-remove-cover {
    opacity: 1;
}

.btn-remove-cover:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
    color: #ff4444;
}

/* List Layout Adjustments for Cover Buttons */
.layout-list .btn-edit-cover {
    width: 20px;
    height: 20px;
    font-size: 10px;
    bottom: 4px;
    right: 4px;
}

.layout-list .btn-remove-cover {
    width: 20px;
    height: 20px;
    font-size: 10px;
    bottom: 4px;
    right: 28px;
}

.btn-edit-cover:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

/* --- User Sidebar --- */
.user-section .nav-item {
    font-size: 13px;
    padding: 8px 12px;
}

.user-section .nav-label {
    font-size: 11px;
    font-weight: 600;
    color: #86868b;
    margin-bottom: 5px;
    padding-left: 12px;
    text-transform: uppercase;
}

#user-display-name {
    color: #1d1d1f;
    /* font-weight: 600; REMOVED to match other nav items */
}

/* --- Home Dashboard Sections --- */
.dash-section {
    margin-bottom: 30px;
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid rgba(0, 0, 0, 0.03);
    width: 100%;
    max-width: 1200px;
}

.dash-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    align-items: center;
}

.dash-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.dash-link {
    font-size: 13px;
    color: #007aff;
    cursor: pointer;
    text-decoration: none;
}

.dash-link:hover {
    text-decoration: underline;
}

.dash-grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
@media (max-width: 900px) {
    .dash-grid-container { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .dash-grid-container { grid-template-columns: 1fr; }
}

.dash-grid-container.list-mode {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* --- Search History Items --- */
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-content {
    flex: 1;
    cursor: pointer;
}

.history-delete {
    padding: 5px;
    cursor: pointer;
    opacity: 0.6;
    font-size: 12px;
}

.history-delete:hover {
    opacity: 1;
    background: #eee;
    border-radius: 50%;
}

/* --- Strict List Layout Overrides for Date Groups --- */
.date-group-cards.layout-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.date-group-cards.layout-list .grid-card {
    display: flex;
    flex-direction: row;
    height: auto;
    min-height: 80px;
    align-items: center;
    width: 100%;
    max-width: 100%;
    /* Ensure full width */
    padding: 10px 20px;
    box-sizing: border-box;
    /* IMPORTANT */
}

.date-group-cards.layout-list .grid-card-cover {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    margin-right: 20px;
    border-radius: 6px;
    font-size: 24px;
}

.date-group-cards.layout-list .grid-card-info {
    flex-direction: row;
    align-items: center;
    padding: 0;
    flex: 1;
    gap: 20px;
}

.date-group-cards.layout-list .grid-card-title {
    margin: 0;
    flex: 1;
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.date-group-cards.layout-list .grid-card-domain {
    width: 150px;
    text-align: right;
    /* Adjust if needed */
}

.date-group-cards.layout-list .grid-card-meta {
    margin: 0 0 0 20px;
    justify-content: flex-end;
    width: 140px;
}

/* Dashboard Grid - CRITICAL for HOME page scrolling */
.dashboard-grid {
    padding: 40px;
    overflow-y: auto !important;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Fix Grid card width - exact 260px cards */
.page-grid-grouped .date-group-cards {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 20px;
    justify-content: start;
}

/* Override for List Layout */
.page-grid-grouped .date-group-cards.layout-list {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
}

@media (max-width: 1400px) {
    .page-grid-grouped .date-group-cards {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}
@media (max-width: 1000px) {
    .page-grid-grouped .date-group-cards {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}
@media (max-width: 600px) {
    .page-grid-grouped .date-group-cards {
        grid-template-columns: 1fr !important;
    }
}

/* === DASHBOARD-EXACT LAYOUTS === */

/* Page Grid - Date Grouped Container */
.page-grid-grouped {
    padding: 40px;
    overflow: visible !important; /* Allow sticky headers to work with parent scroll */
    flex: 1;
    display: block;
}

/* Date Group Header */
.date-group-header {
    padding: 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #6e6e73;
    display: flex;
    align-items: center;
    margin-top: 20px;
}

.date-group-header:first-child {
    margin-top: 0;
}

.date-group-header .date-icon {
    margin-right: 8px;
    font-size: 16px;
}

/* Date Group Cards Container - GRID VIEW */
.date-group-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, 260px);
    gap: 20px;
    justify-content: start;
    margin-bottom: 30px;
}

/* LIST VIEW - Override for date groups */
.date-group-cards.layout-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.date-group-cards.layout-list .grid-card {
    height: auto;
    flex-direction: row;
    min-height: 80px;
    align-items: center;
    padding: 10px 20px;
}

.date-group-cards.layout-list .grid-card-cover {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    margin-right: 20px;
    flex-shrink: 0;
    font-size: 24px;
}

.date-group-cards.layout-list .grid-card-info {
    flex-direction: row;
    align-items: center;
    padding: 0;
    gap: 20px;
    flex: 1;
}

.date-group-cards.layout-list .grid-card-title {
    flex: 1;
    margin: 0;
    font-size: 16px;
    -webkit-line-clamp: 1;
}

.date-group-cards.layout-list .grid-card-domain {
    width: 150px;
}

.date-group-cards.layout-list .grid-card-meta {
    margin: 0;
    width: 140px;
    justify-content: flex-end;
}

/* --- Profile View --- */
.profile-section {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 20px;
    color: #1d1d1f;
    border-bottom: 1px solid #f0f0f5;
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #86868b;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    font-family: inherit;
    color: #1d1d1f;
}

.form-input:focus {
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.primary-btn {
    background: #007aff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.primary-btn:hover {
    background: #0071e3;
}

.action-btn {
    padding: 6px 12px;
    border: 1px solid #d2d2d7;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #1d1d1f;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #f5f5f7;
    border-color: #c7c7cc;
}

.action-btn.destructive {
    color: #ff3b30;
    border-color: #ff3b30;
}

.action-btn.destructive:hover {
    background: #fff0f0;
    border-color: #ffcccc;
}

/* MASONRY VIEW - True waterfall */
.page-gallery-view {
    padding: 40px;
    column-count: 4;
    column-gap: 20px;
    overflow-y: auto;
    display: block;
    
    /* Center and Fixed Width Design */
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.page-gallery-view .grid-card {
    display: inline-block;
    width: 100%;
    margin-bottom: 20px;
    height: auto;
    break-inside: avoid;
}

.page-gallery-view .grid-card-cover {
    height: auto;
    min-height: 100px;
}

@media (max-width: 1200px) {
    .page-gallery-view {
        column-count: 3;
    }
}

@media (max-width: 800px) {
    .page-gallery-view {
        column-count: 2;
    }
}

/* === DASHBOARD-EXACT LAYOUTS === */

/* Grid Layout Base */
.date-group-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    justify-content: start;
    margin-bottom: 30px;
    
    /* Center and Fixed Width Design - inherit from parent usually, but good to enforce if standalone */
    /* width: 100%; - Implicit */
}

/* Remove responsive column reduction to enforce 4 columns + scroll */
/*
@media (max-width: 1400px) {
    .date-group-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 1000px) {
    .date-group-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 600px) {
    .date-group-cards {
        grid-template-columns: 1fr;
    }
}
*/

/* LIST VIEW - Full-width horizontal rows (ONE PER ROW) */
.date-group-cards.layout-list {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    gap: 12px;
    min-width: 0 !important; /* Override parent grid min-width if inherited */
    max-width: 1400px;
    margin: 0 auto 30px auto;
}

/* Date Group Header */
.date-group-header {
    padding: 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #6e6e73;
    display: flex;
    align-items: center;
    margin-top: 20px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    box-sizing: border-box;
}

/* Override min-width for List Layout on parent grid */
.page-grid.layout-list {
    min-width: 0 !important;
}

.date-group-cards.layout-list .grid-card {
    width: 100% !important;
    max-width: 100% !important;
    height: auto;
    min-height: 90px;
    flex-direction: row;
    align-items: center;
    padding: 15px 20px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    background: #fff;
    transition: all 0.2s;
    box-sizing: border-box;
}

.date-group-cards.layout-list .grid-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.date-group-cards.layout-list .grid-card-cover {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    margin-right: 20px;
    flex-shrink: 0;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f7;
}

.date-group-cards.layout-list .grid-card-info {
    flex: 1;
    flex-direction: row;
    align-items: center;
    padding: 0;
    gap: 20px;
    justify-content: space-between;
    min-width: 0;
}

.date-group-cards.layout-list .grid-card-title {
    flex: 1;
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #1d1d1f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.date-group-cards.layout-list .grid-card-domain {
    width: 180px;
    font-size: 12px;
    color: #86868b;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.date-group-cards.layout-list .grid-card-meta {
    margin: 0;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* MASONRY/GALLERY VIEW - Waterfall with cover images */
.page-gallery-view {
    padding: 40px;
    column-count: 4;
    column-gap: 20px;
    display: block;
}

.page-gallery-view .grid-card {
    display: inline-block;
    width: 100%;
    margin-bottom: 20px;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    break-inside: avoid;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e5e5e5;
    background: #fff;
    transition: all 0.2s;
}

.page-gallery-view .grid-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.page-gallery-view .grid-card-cover {
    width: 100%;
    height: auto;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f7;
}

.page-gallery-view .grid-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.page-gallery-view .grid-card-info {
    padding: 12px;
}

@media (max-width: 1400px) {
    .page-gallery-view {
        column-count: 3;
    }
}

@media (max-width: 1000px) {
    .page-gallery-view {
        column-count: 2;
    }
}

@media (max-width: 600px) {
    .page-gallery-view {
        column-count: 1;
    }
}/* Ensure cover images display properly */
.grid-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: '';
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #32d74b;
}

input:focus + .slider {
  box-shadow: 0 0 1px #32d74b;
}

input:checked + .slider:before {
  -webkit-transform: translateX(16px);
  -ms-transform: translateX(16px);
  transform: translateX(16px);
}

/* Icon Button */
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}
.icon-btn:hover {
    background: #e5e5e5;
}

/* Note Editing */
.note-edit-area {
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    border: 1px solid #d2d2d7;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
    outline: none;
    line-height: 1.5;
    margin-top: 8px;
    display: block;
    background-color: #fff;
    color: #1d1d1f;
}

.note-edit-area:focus {
    border-color: #007aff;
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.1);
}

