/* ============================================
   HOTEL CRM — Salesforce-inspired Theme
   ============================================ */

:root {
    --crm-sidebar-bg:    #003844;
    --crm-sidebar-hover: #004f5c;
    --crm-sidebar-active:#006c67;
    --crm-sidebar-text:  rgba(255,255,255,0.85);
    --crm-primary:       #006c67;
    --crm-primary-dark:  #005a57;
    --crm-accent:        #FFB100;
    --crm-bg:            #F3F3F3;
    --crm-card-bg:       #FFFFFF;
    --crm-border:        #DDDBDA;
    --crm-text:          #3E3E3C;
    --crm-text-light:    #706E6B;
    --sidebar-width:     240px;
    /* Bootstrap primary override */
    --bs-primary:        #006c67;
    --bs-primary-rgb:    0, 108, 103;
    --bs-link-color:     #006c67;
    --bs-link-hover-color: #005a57;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--crm-bg);
    color: var(--crm-text);
    font-size: 14px;
}

/* ---- SIDEBAR ---- */
.crm-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--crm-sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 20px 16px 16px;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    letter-spacing: 0.3px;
}

.sidebar-brand i { font-size: 22px; color: #FFB100; }

.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-section-label {
    color: rgba(255,255,255,0.45);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 8px 16px 4px;
    text-transform: uppercase;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin: 1px 8px;
    color: var(--crm-sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.15s;
    font-size: 13px;
}

.sidebar-nav .nav-link i { font-size: 15px; width: 16px; text-align: center; flex-shrink: 0; }

.sidebar-nav .nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; }

.sidebar-nav .nav-link.active {
    background: var(--crm-sidebar-active);
    color: #fff;
    font-weight: 600;
}

.nav-hotel {
    padding: 5px 16px;
    color: rgba(255,255,255,0.55);
    font-size: 12px;
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: #fff;
}

.user-avatar {
    width: 34px; height: 34px;
    background: var(--crm-accent);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
    flex-shrink: 0;
}

.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.55); }

/* ---- MAIN AREA ---- */
.crm-main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.crm-topbar {
    background: #fff;
    border-bottom: 1px solid var(--crm-border);
    padding: 0 20px;
    height: 52px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky; top: 0; z-index: 50;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.topbar-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--crm-text);
}

.topbar-icon {
    color: var(--crm-text-light);
    font-size: 18px;
    text-decoration: none;
    transition: color 0.15s;
}
.topbar-icon:hover { color: var(--crm-primary); }

/* ---- KPI CARDS ---- */
.kpi-card {
    background: #fff;
    border: 1px solid var(--crm-border);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: box-shadow 0.2s;
}
.kpi-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.kpi-card.kpi-alert { border-color: #f86c6b; background: #fff8f8; }
.small-kpi { padding: 12px; }

.kpi-icon {
    width: 38px; height: 38px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 16px;
    margin-bottom: 4px;
}

.kpi-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--crm-text);
    line-height: 1.1;
}

.kpi-label {
    font-size: 12px;
    color: var(--crm-text-light);
}

/* ---- CRM CARDS ---- */
.crm-card {
    background: #fff;
    border: 1px solid var(--crm-border);
    border-radius: 8px;
    overflow: hidden;
}

.crm-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--crm-border);
    background: #FAFAF9;
}

.crm-card-body { padding: 16px; }

/* ---- TABLES ---- */
.crm-table thead th {
    background: #FAFAF9;
    border-bottom: 2px solid var(--crm-border);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--crm-text-light);
    letter-spacing: 0.5px;
    padding: 10px 12px;
}

.crm-table tbody td { padding: 10px 12px; border-color: #F0EFED; }
.crm-table tbody tr:hover { background: #F8F8F7; }

.crm-link { color: var(--crm-primary); }
.crm-link:hover { color: var(--crm-primary-dark); text-decoration: underline; }

/* ---- KANBAN BOARD ---- */
.kanban-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
    min-height: 500px;
}

.kanban-column {
    flex: 0 0 260px;
    background: #F3F3F3;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.kanban-column-header {
    padding: 12px 16px;
    font-weight: 700;
    font-size: 13px;
    color: var(--crm-text);
    border-radius: 8px 8px 0 0;
    background: #E8E8E6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kanban-cards {
    padding: 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kanban-card {
    background: #fff;
    border: 1px solid var(--crm-border);
    border-radius: 6px;
    padding: 12px;
    position: relative;
    transition: box-shadow 0.15s, transform 0.15s;
}
.kanban-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.12); transform: translateY(-1px); }

.kanban-card-title a {
    font-weight: 600;
    font-size: 13px;
    color: var(--crm-text);
    text-decoration: none;
}
.kanban-card-title a:hover { color: var(--crm-primary); }

.kanban-card-account, .kanban-card-hotel {
    font-size: 11px;
    color: var(--crm-text-light);
    margin-top: 4px;
}

.kanban-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #F0EFED;
}

.kanban-value { font-weight: 700; font-size: 12px; color: var(--crm-primary); }
.kanban-date  { font-size: 11px; }

.kanban-card-actions {
    position: absolute;
    top: 8px; right: 8px;
    opacity: 0;
    transition: opacity 0.15s;
}
.kanban-card:hover .kanban-card-actions { opacity: 1; }

.btn-xs {
    padding: 1px 6px;
    font-size: 11px;
    border-radius: 4px;
}

/* ---- TASK LIST ---- */
.task-list { display: flex; flex-direction: column; }

.task-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #F0EFED;
    gap: 12px;
}
.task-item:last-child { border-bottom: none; }
.task-item.task-overdue { background: #FFF5F5; }

.task-title { font-weight: 600; font-size: 13px; color: var(--crm-text); text-decoration: none; }
.task-title:hover { color: var(--crm-primary); }
.task-account { font-size: 11px; color: var(--crm-text-light); }
.task-item-left { display: flex; flex-direction: column; gap: 2px; }
.task-item-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.task-date { font-size: 12px; }

/* ---- CONTACT ITEMS ---- */
.contact-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid #F0EFED;
}
.contact-item:last-child { border-bottom: none; }

/* ---- HOTEL PIPELINE ---- */
.hotel-pipeline-row {
    padding: 10px 0;
    border-bottom: 1px solid #F0EFED;
}
.hotel-pipeline-row:last-child { border-bottom: none; }

/* ---- NOTIFICATION BELL ---- */
.notif-wrapper {
    position: relative;
}

.notif-btn {
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    padding: 4px;
    color: var(--crm-text-light);
    font-size: 18px;
    transition: color .15s;
}
.notif-btn:hover { color: var(--crm-primary); }
.notif-btn.has-notifs { color: #DC3545; animation: bellRing 1s ease 0s 3; }

@keyframes bellRing {
    0%,100% { transform: rotate(0); }
    15%      { transform: rotate(15deg); }
    30%      { transform: rotate(-12deg); }
    45%      { transform: rotate(10deg); }
    60%      { transform: rotate(-8deg); }
    75%      { transform: rotate(5deg); }
}

.notif-badge {
    position: absolute;
    top: -2px; right: -4px;
    background: #DC3545;
    color: #fff;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    line-height: 1.4;
    min-width: 18px;
    text-align: center;
}

.notif-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 340px;
    background: #fff;
    border: 1px solid var(--crm-border);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    z-index: 1000;
    overflow: hidden;
}

.notif-panel-header {
    background: var(--crm-sidebar-bg);
    color: #fff;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notif-panel-body {
    max-height: 320px;
    overflow-y: auto;
}

.notif-empty {
    padding: 24px;
    text-align: center;
    color: var(--crm-text-light);
    font-size: 13px;
}

.notif-item {
    display: flex;
    gap: 12px;
    padding: 11px 16px;
    border-bottom: 1px solid #F0EFED;
    text-decoration: none;
    color: var(--crm-text);
    transition: background .1s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: #F8F8F7; }

.notif-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}
.notif-dot.overdue  { background: #DC3545; }
.notif-dot.today    { background: #FFC107; }
.notif-dot.tomorrow { background: #006c67; }

.notif-title { font-weight: 600; font-size: 13px; line-height: 1.3; }
.notif-meta  { font-size: 11px; color: var(--crm-text-light); margin-top: 2px; }
.notif-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.notif-label.overdue  { color: #DC3545; }
.notif-label.today    { color: #E67E22; }
.notif-label.tomorrow { color: #006c67; }

.notif-panel-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--crm-border);
    background: #FAFAF9;
    text-align: right;
    font-size: 12px;
}
.notif-panel-footer a { color: var(--crm-primary); text-decoration: none; font-weight: 600; }

/* ---- FORM SECTION TITLES ---- */
.form-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--crm-text-light);
    border-bottom: 1px solid var(--crm-border);
    padding-bottom: 6px;
    margin-bottom: 14px;
    margin-top: 8px;
}

/* ---- EXPORT CARDS ---- */
.export-card {
    background: #FAFAF9;
    border: 1px solid var(--crm-border);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}
.export-icon { font-size: 28px; display: block; margin-bottom: 6px; }
.export-label { font-weight: 700; font-size: 14px; }
.export-count { font-size: 12px; color: var(--crm-text-light); }

/* ---- LOGIN PAGE ---- */
.login-page {
    background: linear-gradient(135deg, #003844 0%, #006c67 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-wrapper { width: 100%; max-width: 400px; padding: 20px; }

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}

.login-logo {
    font-size: 48px;
    color: var(--crm-primary);
    text-align: center;
    margin-bottom: 12px;
}

.login-title {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-subtitle {
    text-align: center;
    color: var(--crm-text-light);
    margin-bottom: 24px;
    font-size: 13px;
}

.login-hint { text-align: center; }

/* ---- BOOTSTRAP OVERRIDES ---- */
.btn-primary {
    background: var(--crm-primary);
    border-color: var(--crm-primary);
}
.btn-primary:hover {
    background: var(--crm-primary-dark);
    border-color: var(--crm-primary-dark);
}

.badge { font-weight: 600; letter-spacing: 0.2px; }

.form-control:focus, .form-select:focus {
    border-color: var(--crm-primary);
    box-shadow: 0 0 0 0.2rem rgba(0, 108, 103, 0.2);
}

.alert { border-radius: 8px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 991px) {
    .crm-sidebar {
        transform: translateX(-100%);
    }
    .crm-sidebar.open {
        transform: translateX(0);
    }
    .crm-main {
        margin-left: 0;
    }
}

@media (max-width: 767px) {
    .kpi-value { font-size: 18px; }
    .kanban-column { flex: 0 0 220px; }
}

/* ---- JOURNAL BUBBLE ---- */
.journal-bubble {
    padding: 5px 10px !important;
    background: #f8f9fa;
    border-radius: 4px;
    line-height: 1.4;
    font-size: 13px;
}
.journal-bubble p,
.journal-bubble ol,
.journal-bubble ul,
.journal-bubble li {
    margin: 0 !important;
    padding: 0 !important;
}
.journal-bubble p + p {
    margin-top: 1px !important;
}
