/* 
    Premium Blue Gradient Design System 
    Inspired by Gestion CRM
*/

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary-color: #2563eb;
    --primary-color-hover: #1d4ed8;
    --secondary-color: #1e293b;
    --accent-color: #3b82f6;
    --accent-gradient: linear-gradient(135deg, #3b82f6, #0f172a);
    --surface-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0.4) 100%);
    
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-input: #f8fafc;

    --text-heading: #1e3a8a;
    --text-main: #334155;
    --text-muted: #64748b;
    --text-sidebar: #cbd5e1;
    --text-sidebar-hover: #ffffff;
    
    --border-color: #e2e8f0;
    --glass-border: rgba(255, 255, 255, 0.4);
    
    --shadow-card: 0 10px 40px -10px rgba(15, 23, 42, 0.05);
    --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    
    --sidebar-width: 240px;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-body);
    background-image: 
        radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(124, 58, 237, 0.05) 0px, transparent 50%);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Sidebar Styles (Matching Gestion) */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    z-index: 100;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
}

.sidebar-header {
    margin-bottom: 2rem;
}

.sidebar-header h2 {
    font-size: 24px;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-collapsed {
    display: none;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-sidebar);
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav a i {
    margin-right: 12px;
    font-size: 20px;
    flex-shrink: 0;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-sidebar-hover);
}

.sidebar-nav a.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

/* Collapsed Sidebar */
body.sidebar-collapsed .sidebar {
    width: 80px;
    padding: 1.5rem 0.75rem;
}

body.sidebar-collapsed .logo-full {
    display: none;
}

body.sidebar-collapsed .logo-collapsed {
    display: block !important;
}

body.sidebar-collapsed .sidebar-nav a {
    justify-content: center;
    padding: 12px;
}

body.sidebar-collapsed .sidebar-nav a i {
    margin-right: 0;
}

body.sidebar-collapsed .nav-text {
    display: none;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 90px 2rem 2rem 2rem;
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-collapsed .main-content {
    margin-left: 80px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-heading);
    text-transform: uppercase;
}

/* Kanban Board Layout */
.board-container {
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    padding: 1rem 0 2rem 0;
    align-items: flex-start;
}

.column {
    width: 320px;
    min-width: 320px;
    max-width: 320px;
    background: #eef2f6;
    border-radius: var(--radius-xl);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.02);
    align-self: flex-start;
}

.column-header {
    background: #ffffff;
    border-radius: var(--radius-md);
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    box-shadow: 0 2px 8px -2px rgba(15, 23, 42, 0.05);
    border: 1px solid var(--border-color);
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-height: 100px;
}

.add-task-btn {
    background: transparent;
    color: var(--primary-color);
    border: 1px dashed rgba(37, 99, 235, 0.3);
    padding: 10px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.add-task-btn:hover {
    background: rgba(37, 99, 235, 0.06);
    border-color: var(--primary-color);
}

.add-column-placeholder {
    min-width: 320px;
    width: 320px;
    background: rgba(255, 255, 255, 0.45);
    border: 2px dashed rgba(37, 99, 235, 0.35);
    border-radius: var(--radius-xl);
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-column-placeholder:hover {
    background: rgba(255, 255, 255, 0.8);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.column-top-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.column-title {
    font-weight: 800;
    color: var(--text-heading);
    font-size: 1.1rem;
    letter-spacing: -0.5px;
}

.task-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
    cursor: grab;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.task-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

.task-card:active {
    cursor: grabbing;
    transform: scale(0.98);
}

/* Buttons (Matching Gestion) */
.btn {
    padding: 12px 24px;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(37, 99, 235, 0.3);
}

/* Auth Cards */
.auth-container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.auth-card {
    background: white;
    width: 420px;
    padding: 3rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.1);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border-color);
    background: var(--bg-input);
    outline: none;
    font-family: inherit;
    font-weight: 500;
}

select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='20' height='20'%3E%3Cpath fill='%2364748b' d='M12 16L6 10H18L12 16Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 18px;
    padding-right: 40px;
    cursor: pointer;
}

select.form-control option {
    background-color: #ffffff;
    color: var(--text-main);
    padding: 12px;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* Top Header Styles */
.top-header {
    height: 70px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    z-index: 90;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.sidebar-collapsed .top-header {
    left: 80px;
}

.top-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.top-header-btn {
    background: none;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: var(--text-muted);
    transition: all 0.2s;
    position: relative;
    border: 1px solid var(--border-color);
}

.top-header-btn:hover {
    background: #f1f5f9;
    color: var(--text-heading);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid white;
}

.top-header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-left: 1px solid var(--border-color);
    padding-left: 1.5rem;
}

.user-details {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.user-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-heading);
}

.user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    box-shadow: var(--shadow-card);
}

/* Notification Popover */
.notification-popover {
    display: none;
    width: 360px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
    padding: 0;
    margin: 0;
    position: fixed;
    top: 75px;
    right: 2rem;
    left: auto;
    bottom: auto;
    z-index: 1000;
    border: 1px solid var(--border-color);
}

/* Use standard Popover styles for placement and animations */
.notification-popover:popover-open {
    display: flex;
    flex-direction: column;
}

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

.popover-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-heading);
}

.mark-all-read-btn {
    background: none;
    border: none;
    font-size: 0.75rem;
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 600;
}

.mark-all-read-btn:hover {
    text-decoration: underline;
}

.popover-content {
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.no-notifications {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.notification-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
    transition: background 0.2s;
    cursor: pointer;
    position: relative;
}

.notification-item:hover {
    background: #f8fafc;
}

.notification-item.unread {
    background: rgba(37, 99, 235, 0.03);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: var(--primary-color);
    border-radius: 50%;
}

.notification-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-body {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-heading);
    margin-bottom: 2px;
}

.notification-msg {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.notification-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

.popover-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
    display: flex;
    justify-content: center;
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}

.test-noti-btn {
    background: none;
    border: 1px dashed var(--border-color);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.test-noti-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Comments Section Styles */
.comments-wrapper {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 8px;
    margin-bottom: 1rem;
}

/* Chat bubble styling */
.chat-row {
    display: flex;
    width: 100%;
    gap: 8px;
    align-items: flex-end;
}

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

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

.chat-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e2e8f0;
    color: var(--text-heading);
    font-size: 0.65rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: 2px;
}

.chat-avatar.me {
    background: var(--primary-color);
    color: white;
}

.chat-bubble-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-width: 75%;
}

.chat-row.me .chat-bubble-wrapper {
    align-items: flex-end;
}

.chat-row.other .chat-bubble-wrapper {
    align-items: flex-start;
}

.chat-author {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-left: 4px;
    margin-right: 4px;
}

.chat-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.85rem;
    line-height: 1.4;
    word-break: break-word;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.chat-row.me .chat-bubble {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-row.other .chat-bubble {
    background: #f1f5f9;
    color: var(--text-main);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.chat-time {
    font-size: 0.625rem;
    margin-top: 4px;
    text-align: right;
    display: block;
    opacity: 0.8;
}

.chat-row.me .chat-time {
    color: rgba(255, 255, 255, 0.8);
}

.chat-row.other .chat-time {
    color: var(--text-muted);
}

.comment-mention {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.08);
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 4px;
}

/* Mentions Dropdown Styles */
.mentions-dropdown-container {
    position: relative;
    width: 100%;
}

.mentions-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    max-height: 180px;
    overflow-y: auto;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    z-index: 1100;
    display: none;
    flex-direction: column;
}

.mention-suggestion {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-main);
    transition: background 0.15s;
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
}

.mention-suggestion:last-child {
    border-bottom: none;
}

.mention-suggestion:hover, .mention-suggestion.active {
    background: #f1f5f9;
    color: var(--text-heading);
}

.mention-avatar-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e2e8f0;
    color: var(--text-heading);
    font-size: 0.65rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal Grid Comments Sidebar */
.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    transition: all 0.3s ease;
}

.modal-grid.with-sidebar {
    grid-template-columns: 1.2fr 1fr 1.3fr;
}

@media (max-width: 1024px) {
    .modal-grid.with-sidebar {
        grid-template-columns: 1fr;
    }
    
    #comments-section {
        border-left: none !important;
        border-top: 1px solid var(--border-color);
        padding-left: 0 !important;
        padding-top: 1.5rem;
        margin-top: 2rem;
    }
}

/* Chat Input Box Custom Overrides */
.chat-input-container {
    margin-top: auto;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    background: #f8fafc !important;
    padding: 8px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
}

.chat-input-textarea {
    resize: none !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 6px !important;
    font-size: 0.875rem !important;
    color: var(--text-heading) !important;
    width: 100% !important;
    outline: none !important;
    min-height: 44px;
    line-height: 1.4 !important;
}

.chat-input-textarea:focus {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}

.chat-input-actions {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    border-top: 1px solid rgba(226, 232, 240, 0.8) !important;
    padding-top: 6px !important;
    margin-top: 4px !important;
}
