/* CSS Reset & Variable Definitions */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Sarabun', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html {
    overflow-x: hidden; /* ป้องกันเลื่อนซ้ายขวาทั้งหน้า */
}

:root {
    --line-green: #06C755;
    --line-active: #05b04b;
    --bg-dark: #f4f5f7;
    --panel-bg: #ffffff;
    --text-main: #182230;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --accent-blue: #4a6fa1;
    --accent-blue-hover: #3d5c88;
    --danger-red: #c0504d;
    --card-bg: #e2e8f0;
    --storage-empty: #e2e8f0;

    /* Corner radius scale (slightly squared, less "bubbly") */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;

    /* Font size scale (bumped up for mobile readability) */
    --font-xs: 12px;
    --font-sm: 13px;
    --font-base: 14px;
    --font-md: 15px;
    --font-lg: 17px;
    --font-xl: 19px;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Master Layout */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    background-color: var(--panel-bg);
    border-radius: 0;
    border: none;
    overflow: hidden;
}

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

/* LEFT PANEL: LINE Chat Simulator — retired demo, never shown to real customers on any
   screen size now; kept in the markup/JS in case it's needed again for a future sales demo. */
.chat-panel {
    display: none;
    flex: 1;
    border-right: 1px solid var(--border-color);
    background-color: #eef1f4;
}

.line-theme {
    background-color: var(--line-green);
    color: white;
}

.panel-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 500; /* must outrank card-level dropdown z-index (up to 100) so the expanded profile menu is never covered */
}

.bot-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bot-profile .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.bot-info h3 {
    font-size: 16px;
    font-weight: 600;
}

.bot-info .status {
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
    color: rgba(255, 255, 255, 0.8);
}

.bot-info .status i {
    font-size: 8px;
    color: #4ade80;
}

/* Chat Messages Box */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-color: #f7f8fa;
}

/* Message Bubbles */
.message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 80%;
}

.message.received {
    align-self: flex-start;
}

.message.sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message .msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--line-green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
}

.message.sent .msg-avatar {
    background-color: var(--accent-blue);
}

.msg-bubble {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: var(--font-base);
    line-height: 1.5;
    word-break: break-all;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.message.received .msg-bubble {
    background-color: #eef1f4;
    color: var(--text-main);
    border-top-left-radius: 2px;
}

.message.sent .msg-bubble {
    background-color: var(--line-green);
    color: white;
    border-top-right-radius: 2px;
}

.msg-time {
    font-size: var(--font-xs);
    color: var(--text-muted);
    align-self: flex-end;
    margin: 0 4px;
}

/* Quick Actions Container */
.chat-quick-actions {
    background-color: #eef1f4;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

.chat-quick-actions h4 {
    font-size: var(--font-xs);
    color: var(--text-muted);
    margin-bottom: 8px;
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-action {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: var(--font-xs);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-action:hover {
    background-color: var(--border-color);
    border-color: var(--text-muted);
}

/* Chat Input Bar */
.chat-input-area {
    padding: 16px;
    background-color: #eef1f4;
    display: flex;
    gap: 10px;
    border-top: 1px solid var(--border-color);
}

.chat-input-area input {
    flex: 1;
    background-color: #eef1f4;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 10px 20px;
    color: var(--text-main);
    font-size: var(--font-base);
    outline: none;
    transition: border-color 0.2s;
}

.chat-input-area input:focus {
    border-color: var(--line-green);
}

.btn-send {
    background-color: var(--line-green);
    color: white;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background-color 0.2s;
}

.btn-send:hover {
    background-color: var(--line-active);
}


/* RIGHT PANEL: Korrub Dashboard — now the only panel (chat-panel above is retired), so it
   always fills the full app-container regardless of screen size. */
.dashboard-panel {
    flex: 1;
    width: 100%;
    max-width: 100vw;
    background-color: var(--bg-dark);
    min-width: 0;       /* ป้องกัน flex child ขยายเกินพื้นที่ */
    overflow: hidden;   /* ตัดเนื้อหาที่ล้นจากแดชบอร์ด */
    position: relative; /* anchors the drag-and-drop overlay */
}

/* Drag-and-drop file upload overlay */
.drop-overlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 900; /* above items-grid content, below modals (1500) */
    background-color: rgba(37, 99, 235, 0.08);
    border: 3px dashed var(--accent-blue);
    align-items: center;
    justify-content: center;
    pointer-events: none; /* the panel underneath keeps receiving the drag events */
}
.drop-overlay-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--panel-bg);
    padding: 18px 28px;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    font-size: var(--font-md);
    font-weight: 700;
    color: var(--accent-blue);
}
.drop-overlay-card i { font-size: 22px; }

/* "Connecting to server" banner — shown from page load until the first data sync
   resolves. Sits above panel-header content but stays below modals (z-index 1500). */
.connecting-banner {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 600;
    background-color: var(--panel-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 6px 0 7px;
    text-align: center;
}
.connecting-banner.active { display: block; }
.connecting-track {
    position: relative;
    width: 100%;
    height: 3px;
    background-color: var(--border-color);
    overflow: hidden;
    margin-bottom: 5px;
}
.connecting-sweep {
    position: absolute;
    top: 0;
    left: -40%;
    height: 100%;
    width: 40%;
    background-color: var(--accent-blue);
    animation: connectingSweep 1.2s ease-in-out infinite;
}
@keyframes connectingSweep {
    0% { left: -40%; }
    100% { left: 100%; }
}
.connecting-text {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.dashboard-theme {
    background-color: var(--panel-bg);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo i {
    font-size: 24px;
    color: var(--accent-blue);
}

.logo h2 {
    font-size: 18px;
    font-weight: 600;
}

.btn-new-note {
    background-color: var(--accent-blue);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--font-sm);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s;
}

.btn-new-note:hover {
    background-color: var(--accent-blue-hover);
}

/* Storage Bar Area */
.storage-section {
    padding: 20px 16px;
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin: 16px 20px 8px 20px; /* desktop default margin matching items-grid padding */
}

@media (max-width: 768px) {
    .storage-section {
        margin: 10px 10px 4px 10px !important; /* mobile override matching mobile items-grid padding */
    }
}

.storage-info {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-sm);
    color: var(--text-muted);
    margin-bottom: 6px;
}

.progress-bar-container {
    height: 6px;
    background-color: var(--storage-empty);
    border-radius: 3px;
    overflow: hidden;
    display: flex; /* Align segments side-by-side */
}

.storage-legend {
    display: flex;
    justify-content: space-between;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    gap: 8px;
    margin-top: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.storage-legend::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}

.legend-item {
    font-size: var(--font-xs);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

/* Premium Upgrade Banner */
.premium-banner {
    margin-top: 14px;
    background-color: rgba(192, 80, 77, 0.15);
    border: 1px solid rgba(192, 80, 77, 0.4);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--font-xs);
    animation: fadeIn 0.3s ease;
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #f87171;
}

.btn-upgrade {
    background-color: #fbbf24;
    color: #1c1917;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: opacity 0.2s;
}

.btn-upgrade:hover {
    opacity: 0.9;
}

/* Tabs */
.tabs-container {
    padding: 12px 20px;
    background-color: #eef1f4;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.tab-link {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: var(--radius-md);
    font-size: var(--font-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.tab-link:hover {
    color: var(--text-main);
    background-color: var(--border-color);
}

.tab-link.active {
    color: white;
    background-color: var(--accent-blue);
}

/* Items Explorer Grid */
.items-grid {
    flex: 1;
    padding: 12px 14px 20px 14px;
    overflow-y: auto;
    overflow-x: hidden;  /* ป้องกันเลื่อนซ้ายขวา */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    align-content: start;
}

/* Item Card */
.item-card {
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    height: 240px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s, border-color 0.2s;
    position: relative;
    min-width: 0;       /* ป้องกัน grid child ขยายเกิน column width */
    /* NOTE: no overflow:hidden here on purpose — clips the "..." dropdown menu.
       Rounded corners are applied per-section (.card-preview top, .card-actions bottom) instead. */
}

.item-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-blue);
}

/* Card Body (Preview Area) */
.card-preview {
    height: 180px; /* ~75% of the 240px card — text below is tightened to fit in what's left */
    flex-shrink: 0;
    background-color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
}

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

.card-preview .icon-placeholder {
    font-size: 40px;
    color: var(--text-muted);
}

.card-preview .link-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0,0,0,0.7);
    color: #4ade80;
    padding: 2px 6px;
    font-size: 10px;
    border-radius: 4px;
}

.card-info {
    padding: 2px 8px 4px 8px;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.card-title {
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--text-main);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.1;
    margin-bottom: 3px;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-date {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
    line-height: 1.1;
}

.card-size {
    display: block;
    font-size: 10px;
    color: var(--accent-blue);
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.1;
}

/* Card Action Buttons */
.card-actions {
    display: flex;
    border-top: 1px solid var(--border-color);
    background-color: #ffffff;
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
    overflow: hidden; /* keeps bottom corners rounded without clipping the card's dropdown menu above it */
}

.card-actions button {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 8px;
    font-size: var(--font-xs);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.card-actions button:hover {
    color: var(--text-main);
    background-color: var(--border-color);
}

.card-actions button.btn-delete:hover {
    color: var(--danger-red);
    background-color: rgba(239, 68, 68, 0.1);
}

.card-actions button:not(:last-child) {
    border-right: 1px solid var(--border-color);
}

/* Modal Popup Window Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    /* Must outrank #selection-bar (z-index 1000) — they previously tied, so whichever
       happened to sit later in the DOM won and could paint over the other; a modal
       should always be the topmost layer regardless of what else is on screen. */
    z-index: 1500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: var(--panel-bg);
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transform: translateY(-20px);
    transition: transform 0.2s ease;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-btn {
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.close-btn:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 20px;
}

.modal-body textarea {
    width: 100%;
    background-color: var(--bg-dark);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    outline: none;
    font-size: var(--font-base);
    resize: none;
}

.modal-body textarea:focus {
    border-color: var(--accent-blue);
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background-color: #ffffff;
}

.modal-footer button {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--font-sm);
    font-weight: 600;
}

.btn-cancel {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.btn-cancel:hover {
    color: var(--text-main);
    border-color: var(--text-muted);
}

.btn-save {
    background-color: var(--accent-blue);
    border: none;
    color: white;
}

.btn-save:hover {
    background-color: var(--accent-blue-hover);
}

/* File Preview Modal Styles (Google Drive/Document Preview UI) — desktop default fills
   most of the viewport (mobile keeps its own bottom-sheet sizing below, all !important
   so it overrides this regardless). Sits on top of .modal's own dark 0.6-opacity
   backdrop, so a near-opaque 0.75 white on top of that read as a flat solid card —
   lowered so the blurred backdrop actually shows through, for a proper frosted-glass look. */
.preview-content {
    max-width: 1300px;
    width: 90vw;
    height: 88vh;
    background-color: rgba(255, 255, 255, 0.45) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    display: flex;
    flex-direction: column;
    position: relative; /* anchors the prev/next buttons + counter below */
}

/* Preview prev/next navigation — only shown (via inline display) when previewItem()
   finds neighbors in the currently on-screen filtered/folder view. */
.preview-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background-color: rgba(15, 23, 42, 0.55);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: background-color 0.2s;
}
.preview-nav-btn:hover { background-color: rgba(15, 23, 42, 0.8); }
.preview-nav-prev { left: 14px; }
.preview-nav-next { right: 14px; }
.preview-counter {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(15, 23, 42, 0.55);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 999px;
    z-index: 20;
}

@media (max-width: 768px) {
    .preview-nav-btn { width: 36px; height: 36px; font-size: 14px; }
    .preview-nav-prev { left: 8px; }
    .preview-nav-next { right: 8px; }
}

#preview-body {
    background-color: transparent !important;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 0; /* lets this flex child actually shrink/grow instead of overflowing */
    padding: 0;
}

.preview-file-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    padding: 20px;
}

.preview-file-container img {
    /* width/height (not max-width/max-height) so a small source image actually scales UP
       to fill the now-larger preview container, not just shrinks to fit a small one */
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.preview-file-container video {
    width: 100%;
    height: 100%;
    object-fit: contain; /* width/height:100% alone would stretch and distort the video */
    background-color: black;
}

/* Mock PDF Viewer Frame */
.pdf-mock-viewer {
    width: 100%;
    height: 100%;
    background-color: #e2e8f0;
    color: #1e293b;
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pdf-toolbar {
    background-color: #e2e8f0;
    color: white;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-xs);
}

.pdf-pages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.pdf-page-sheet {
    background-color: white;
    width: 90%;
    min-height: 400px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pdf-line {
    height: 8px;
    background-color: #475569;
    border-radius: 4px;
}

.pdf-line.title {
    height: 16px;
    width: 60%;
    background-color: #e2e8f0;
    margin-bottom: 20px;
}

/* Toast styling */
.toast {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(30px);
    background-color: var(--accent-blue);
    color: white;
    padding: 10px 24px;
    border-radius: var(--radius-lg);
    font-size: var(--font-sm);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    /* Below .modal (1500) on purpose — a background toast (e.g. a settings toggle
       confirmation) should stay hidden behind an open modal, not float on top of it. */
    z-index: 1200;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.toast.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive Grid Adjustments */
@media (max-width: 768px) {
    /* Mobile double column grid layout */
    .items-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        padding: 6px 14px 10px 14px !important;
    }
    .item-card {
        height: 215px !important; /* Uniform height to prevent button cutoff */
    }
    .card-preview {
        height: 155px !important; /* ~72% of the 215px mobile card — text below is tightened to fit in what's left */
    }
    /* Translucent iOS-style Bottom Sheet mobile preview modal */
    .preview-content {
        width: 100vw !important;
        height: 90vh !important; /* Leaves a 10vh gap at the top to see the dashboard! */
        max-width: 100vw !important;
        border-radius: 16px 16px 0 0 !important; /* Rounded top corners like iPhone cards! */
        margin: 0 !important;
        margin-top: 10vh !important; /* Shift down to leave the gap at the top */
        display: flex;
        flex-direction: column;
        border: none !important;
        box-shadow: 0 -8px 24px rgba(0,0,0,0.3) !important;
    }
    #preview-body {
        flex: 1;
        height: calc(90vh - 60px) !important; /* Subtract header height from 90vh */
        background-color: transparent !important;
    }
    .preview-file-container {
        height: 100% !important;
        width: 100% !important;
        padding: 8px !important;
        box-sizing: border-box;
    }
}

/* Edit Dropdown Menu Styles */
.edit-dropdown-container {
    position: relative;
    flex: 1;
    display: flex;
}

.edit-dropdown-menu {
    position: absolute;
    bottom: 45px;
    right: 0;
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    display: none;
    flex-direction: column;
    min-width: 130px;
    z-index: 100;
    overflow: hidden;
    animation: fadeIn 0.15s ease;
}

.edit-dropdown-menu.active {
    display: flex;
}

.edit-dropdown-menu button {
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    font-size: var(--font-xs);
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    border-right: none !important;
}

.edit-dropdown-menu button:last-child {
    border-bottom: none;
}

.edit-dropdown-menu button:hover {
    background-color: var(--border-color) !important;
}

.edit-dropdown-menu button.delete-option {
    color: #f87171;
}

.edit-dropdown-menu button.delete-option:hover {
    background-color: rgba(239, 68, 68, 0.1) !important;
}

/* Clickable card elements for preview */
.card-clickable {
    cursor: pointer;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Upgrade button next to storage text */
.btn-upgrade-text {
    background: none;
    border: none;
    color: #fbbf24;
    font-size: var(--font-xs);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(251, 191, 36, 0.3);
    transition: all 0.2s;
}

.btn-upgrade-text:hover {
    background-color: rgba(251, 191, 36, 0.1);
    border-color: #fbbf24;
}


/* Switch Toggle Component */
.switch-container {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}
.switch-container input {
    opacity: 0;
    width: 0;
    height: 0;
}
.switch-container .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #e2e8f0;
    transition: 0.3s;
    border-radius: 20px;
}
.switch-container .slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: #64748b;
    transition: 0.3s;
    border-radius: 50%;
}
.switch-container input:checked + .slider {
    background-color: #3b82f6;
}
.switch-container input:checked + .slider:before {
    transform: translateX(16px);
    background-color: white;
}
.switch-container input:disabled + .slider {
    background-color: #ffffff;
    opacity: 0.5;
    cursor: not-allowed;
}
.switch-container input:disabled + .slider:before {
    background-color: #e2e8f0;
}

/* Switch Toggle Crown Overlay for Free Tier */
.switch-container {
    position: relative;
}
.switch-container .switch-crown {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 11px;
    height: 11px;
    z-index: 2;
    pointer-events: none;
    display: none;
}

/* Show/Hide crown based on body free-tier class */
body.free-tier .switch-crown {
    display: inline-block !important;
}
body:not(.free-tier) .switch-crown {
    display: none !important;
}

/* Comparison Table inside Upgrade Modal */
.comparison-table {
    border-collapse: collapse;
    width: 100%;
}
.comparison-table th, 
.comparison-table td {
    padding: 10px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}
.comparison-table tr:hover {
    background-color: rgba(255,255,255,0.02);
}
.comparison-table button {
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: var(--font-xs);
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.2s;
}
.comparison-table button:hover {
    filter: brightness(1.1);
}
.comparison-table .feat-item {
    font-size: var(--font-xs);
    color: #475569;
}
.comparison-table .feat-item i {
    width: 14px;
}
#pricing-row-pro {
    border: 1.5px solid #3b82f6 !important;
}
#pro-recommend-badge {
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Floating Action Button (FAB) and Menu */
.fab-container {
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 100;
}
.btn-fab {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--accent-blue);
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: all 0.2s;
}
.btn-fab:hover {
    background-color: #1d4ed8;
    transform: scale(1.05);
}
.fab-menu {
    display: none;
    position: absolute;
    bottom: 60px;
    right: 0;
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    padding: 6px;
    min-width: 150px;
    width: max-content;
    max-width: 260px;
    flex-direction: column;
    gap: 4px;
}
.fab-menu.active {
    display: flex !important;
}
.fab-menu button {
    background: none;
    border: none;
    color: var(--text-main);
    text-align: left;
    padding: 8px 12px;
    font-size: var(--font-xs);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    white-space: nowrap;
    border-radius: 4px;
    transition: background-color 0.2s;
}
.fab-menu button:hover {
    background-color: var(--border-color);
}

