/* --- Global & Typography --- */
:root {
    --bg-color: #ffffff;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 60px;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    display: flex;
    height: 100vh;
    background-color: var(--bg-color);
}

/* --- Global Utilities & Boot Masks --- */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.global-boot-screen {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: #ffffff; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.3s ease;
}

.loading-overlay {
    justify-content: center; align-items: center; flex: 1;
}

/* --- Sidebar System --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: #1e293b;
    color: white;
    transition: width 0.3s;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
    z-index: 100;
}

.sidebar.collapsed { width: var(--sidebar-collapsed-width); }

.sidebar-header {
    padding: 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
    overflow: hidden;
}

.app-logo {
    width: 28px; height: 28px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.sidebar-title {
    margin: 0; font-size: 1.5rem;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.sidebar.collapsed .sidebar-title {
    opacity: 0; visibility: hidden; position: absolute;
}

.sidebar-center-toggle {
    position: absolute; top: 50%; right: 8px;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2);
    color: white; border-radius: 50%; width: 28px; height: 28px;
    cursor: pointer; opacity: 0.3; transition: all 0.2s ease;
    z-index: 100; display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem;
}

.sidebar-center-toggle:hover {
    opacity: 1; background: rgba(255, 255, 255, 0.2);
}

.sidebar-content {
    padding: 20px; flex: 1; overflow-y: auto;
}

.sidebar.collapsed .sidebar-content { display: none; }

.sidebar h3 {
    font-size: 0.9rem; color: #94a3b8; text-transform: uppercase;
    margin-bottom: 10px; margin-top: 20px;
}

.sidebar ul { list-style: none; padding: 0; margin: 0; }

.board-item-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

.board-item-link {
    color: white; text-decoration: none; padding: 6px 8px;
    border-radius: 4px; display: block; flex: 1;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.board-item-link:hover, .board-item-link.active { background-color: #334155; }

/* --- Sidebar Footer & Legal --- */
.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    border-top: 1px solid #334155;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-footer {
    opacity: 0; visibility: hidden; display: none;
}

.kofi-btn {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; background-color: #f3f4f6; color: #111827;
    text-decoration: none; padding: 8px 12px; border-radius: 8px;
    font-weight: bold; font-size: 0.9rem; transition: all 0.2s ease;
    border: 1px solid #e5e7eb;
}

.kofi-btn:hover {
    background-color: #FF5E5B; color: white; border-color: #FF5E5B;
}

.legal-links { display: flex; flex-direction: column; gap: 6px; text-align: center; }

.legal-link {
    color: #9ca3af; font-size: 0.75rem; text-decoration: none; transition: color 0.2s ease;
}
.legal-link:hover { color: #ffffff; }

/* --- Main App UI & Header --- */
.main-content {
    flex: 1; display: flex; flex-direction: column; overflow: hidden; background-color: #ffffff;
}

.app-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 24px; background-color: #ffffff; border-bottom: 1px solid #e5e7eb;
}

.header-left, .header-right, .header-section {
    display: flex; align-items: center; gap: 16px; white-space: nowrap;
}

.app-header h1 { margin: 0; font-size: 1.25rem; color: #0f172a; }

.user-profile-row { gap: 12px; }
#user-display img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
#user-name { font-weight: 600; color: #374151; font-size: 0.95rem; }

/* Buttons & Inputs */
.header-btn, .mini-action-btn, .like-btn, .delete-btn, .icon-action-btn {
    font-family: 'Inter', sans-serif; cursor: pointer; transition: all 0.2s ease;
}

.header-btn {
    padding: 8px 16px; border-radius: 6px; font-weight: 500;
    font-size: 0.9rem; border: 1px solid #d1d5db; background: #ffffff; color: #374151;
}
.header-btn:hover { background: #f3f4f6; }

.primary-btn { background: #007bff; color: white; border: none; }
.primary-btn:hover { background: #0056b3; }
.danger-btn { background: #ef4444; color: white; border: none; }
.danger-btn:hover { background: #dc2626; }
.sub-btn-style { background: #10b981; color: white; border: none; }

#blur-btn.active { background-color: #f59e0b; color: white; border-color: #f59e0b; border: none; }

.mini-action-btn { background: none; border: none; opacity: 0.6; font-size: 0.8rem; }
.mini-action-btn:hover { opacity: 1; }

.modern-input {
    padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px;
    font-family: 'Inter', sans-serif; font-size: 0.9rem; outline: none;
}
.modern-input:focus { border-color: #007bff; }

/* --- Board & Columns --- */
.column-mgmt-bar {
    padding: 12px 24px; background: #f9fafb; border-bottom: 1px solid #e5e7eb;
    display: flex; align-items: center; gap: 12px; font-size: 0.9rem; color: #4b5563;
}

#retro-board {
    display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important;
    gap: 24px; padding: 24px; align-items: flex-start !important;
    overflow-x: auto; width: 100%; flex: 1; box-sizing: border-box;
}

.column {
    min-width: 350px; width: 350px; max-width: 350px; flex-shrink: 0;
    background-color: #f3f4f6; border-radius: 12px; padding: 16px;
    display: flex; flex-direction: column; box-sizing: border-box;
}

.column-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.column-header h2 { font-size: 1rem; font-weight: 600; margin: 0; }

.color-picker-input {
    width: 24px; height: 24px; padding: 0; border: none; border-radius: 4px;
    cursor: pointer; background: none; margin-right: 4px;
}
.color-picker-input::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker-input::-webkit-color-swatch { border: 1px solid #ccc; border-radius: 4px; }

/* --- Cards UI --- */
.cards-container {
    display: flex; flex-direction: column; gap: 12px; flex: 1;
    padding-top: 30px; padding-bottom: 5vh; min-height: 70vh;
}

.card {
    background: #ffffff; border-radius: 8px; padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.1);
    border: none; border-left: 4px solid var(--col-color, #cbd5e0); 
    display: flex; flex-direction: column; gap: 12px; cursor: grab;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.05); }

.card-author { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: #6b7280; font-weight: 500; }
.card-author img { width: 20px; height: 20px; border-radius: 50%; }

.card-text { font-size: 0.95rem; color: #1f2937; line-height: 1.5; }

.card-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 4px; }

.like-btn, .delete-btn {
    background: #ffffff; border: 1px solid #e5e7eb; border-radius: 6px;
    padding: 4px 10px; font-size: 0.8rem; color: #6b7280;
}
.like-btn:hover, .delete-btn:hover { background: #f9fafb; border-color: #d1d5db; }
.like-btn.has-liked { color: #10b981; border-color: #10b981; background: #ecfdf5; }

.card-input-area { margin-top: 0; margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.card-input-area input { padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.9rem; outline: none; }
.card-input-area input:focus { border-color: var(--col-color, #007bff); }
.card-input-area button {
    background: transparent; border: none; color: var(--col-color, #6b7280); font-weight: 600;
    font-size: 0.9rem; text-align: left; cursor: pointer; padding: 4px 0; display: flex; gap: 6px;
}
.card-input-area button:hover { opacity: 0.7; }

/* Edit / Inline Action Buttons */
.icon-action-btn {
    background: #ffffff; border: 1px solid #d1d5db; border-radius: 4px;
    padding: 4px 10px; font-size: 0.85rem; font-weight: bold;
}
.save-action-btn { color: #374151; }
.save-action-btn:hover { background: #f0fdf4; color: #16a34a; border-color: #16a34a; }
.cancel-action-btn { color: #6b7280; }
.cancel-action-btn:hover { background: #fef2f2; color: #dc2626; border-color: #dc2626; }

/* Blurred Board State */
.cards-blurred .card-text, 
.cards-blurred .comments-list {
    filter: blur(5px); 
    user-select: none; 
    pointer-events: none;
}

/* Force light grey text to override any inline HTML colors */
.cards-blurred .card-text, 
.cards-blurred .comments-list, 
.cards-blurred .comments-list * {
    color: #cbd5e0 !important; 
}
.cards-blurred .comment-input-area, .cards-blurred .delete-btn { display: none !important; }

/* --- Modals System --- */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center;
}

.modal-content {
    background: white; padding: 24px; border-radius: 8px; max-width: 400px;
    width: 100%; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.modal-title { margin-top: 0; margin-bottom: 12px; color: #2b2d42; }
.modal-body { color: #4a5568; font-size: 0.95rem; margin-bottom: 20px; line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* --- Mobile Header Elements (Hidden on Desktop) --- */
.mobile-menu-bar { display: none; }
.mobile-close-btn { display: none; }
.top-settings-panel { display: block; }

/* --- Mobile Responsive Rules --- */
@media (max-width: 768px) {
    /* Stack the board vertically instead of horizontally */
    #retro-board { 
        padding: 16px; 
        gap: 24px; 
        flex-direction: column !important; 
        align-items: stretch !important;   
        overflow-x: hidden;                
    }
    
    /* Make columns take up the full screen width */
    .column { 
        min-width: 100%; 
        width: 100%; 
        max-width: 100%; 
    }
    
    .card { 
        padding: 12px; 
        font-size: 0.9rem; 
    }
    
    .sidebar-title { display: none; }
    .sidebar-header { justify-content: center; }

    /* --- NEW HEADER RESPONSIVENESS --- */
    .app-header {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        text-align: center;
    }

    .header-left, .header-right {
        flex-direction: column;
        width: 100%;
        white-space: normal; /* Removes the 1-line restriction */
    }

    .header-section {
        flex-direction: column;
        width: 100%;
        white-space: normal;
    }

    .user-profile-row {
        flex-direction: column;
        gap: 12px;
    }

    .column-mgmt-bar {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 12px;
    }

    /* Make buttons and inputs full-width for easy mobile tapping */
    .modern-input, .header-btn {
        width: 100%;
        box-sizing: border-box;
        justify-content: center;
    }

    /* --- NEW FULL-SCREEN MOBILE MENU --- */
    
    /* Show the slim top bar */
    .mobile-menu-bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 16px;
        background: #ffffff;
        border-bottom: 1px solid #e5e7eb;
        font-weight: 600;
        color: #0f172a;
    }

    .mobile-menu-toggle {
        background: #f3f4f6;
        border: 1px solid #d1d5db;
        border-radius: 4px;
        padding: 6px 12px;
        cursor: pointer;
        font-size: 0.85rem;
        color: #374151;
        font-weight: bold;
    }

    /* Hide the main controls by default and prepare the full-screen overlay */
    .top-settings-panel {
        display: none; 
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: #ffffff;
        z-index: 2000;
        overflow-y: auto;
        padding-bottom: 40px;
        box-sizing: border-box;
    }

    /* Class applied via JS to open the menu */
    .top-settings-panel.open {
        display: flex;
        flex-direction: column;
    }

    .mobile-close-btn {
        display: block;
        margin: 16px;
        padding: 12px;
        background: #f3f4f6;
        border: 1px solid #d1d5db;
        border-radius: 6px;
        font-weight: bold;
        cursor: pointer;
        color: #374151;
    }
    
    /* Remove borders inside the full-screen menu so it looks clean */
    .app-header { border-bottom: none; }
    
}

/* --- Multi-line Inputs & Emoji Styling --- */
.auto-expand-input {
    width: 100%;
    resize: none; 
    overflow: hidden; 
    min-height: 40px; 
    font-family: inherit;
    line-height: 1.5;
    padding-right: 40px !important; /* Pushes text away from the right edge so it doesn't hide behind the emoji */
    box-sizing: border-box;
}

/* Wrapper to hold the input and the smile icon together */
.input-with-emoji {
    position: relative;
    width: 100%;
    display: block; /* Changed from flex so the textarea fills the container naturally */
}

.emoji-trigger-btn {
    position: absolute;
    right: 8px;
    bottom: 8px; /* Tucks it perfectly inside the bottom-right corner of the textarea border */
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #6b7280;
    transition: color 0.2s;
    padding: 0;
}

.emoji-trigger-btn:hover {
    color: #374151;
}

/* Global Picker Positioning */
.hidden-picker {
    display: none;
    position: absolute;
    z-index: 9999;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}