/**
 * LINE建案客服機器人後台系統
 * 
 * 全站樣式表
 */

:root {
    --primary-color: #4e73df;
    --secondary-color: #6c757d;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --light-color: #f8f9fc;
    --dark-color: #5a5c69;
    --white-color: #ffffff;
    --body-color: #f8f9fa;
    --sidebar-width: 250px;
    --topbar-height: 70px;
}

/* ==========================================================================
   基礎樣式
   ========================================================================== */
body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    background-color: var(--body-color);
    color: #444;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.2s;
}

a:hover {
    color: #2e59d9;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #2e59d9;
    border-color: #2653d4;
}

/* ==========================================================================
   登入頁面
   ========================================================================== */
.login-container {
    width: 400px;
    max-width: 90%;
    padding: 15px;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo img {
    max-width: 150px;
    height: auto;
}

.login-card {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.login-header {
    background-color: var(--primary-color);
    color: white;
    padding: 20px;
    text-align: center;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.login-body {
    padding: 30px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    color: #6c757d;
    font-size: 0.9rem;
}

.form-control {
    height: auto;
    padding: 12px 15px;
}

.login-btn {
    padding: 12px;
    font-weight: 500;
    font-size: 16px;
}

.input-group-text {
    background-color: #f8f9fa;
    border-right: none;
}

.form-control.left-border {
    border-left: none;
}

.form-control:focus {
    box-shadow: none;
    border-color: #ced4da;
}

.form-control.left-border:focus {
    border-left: none;
}

/* ==========================================================================
   儀表板佈局
   ========================================================================== */
.wrapper {
    display: flex;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    min-height: 100vh;
    transition: all 0.3s;
    position: fixed;
    z-index: 999;
    color: white;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
}

.sidebar.toggled {
    margin-left: calc(-1 * var(--sidebar-width));
}

.brand-container {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    background-color: rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand {
    display: flex;
    align-items: center;
    color: white;
    text-decoration: none;
    width: 100%;
}

.brand:hover {
    color: white;
}

.brand-logo {
    height: 40px;
    width: auto;
    margin-right: 12px;
}

.brand-text {
    font-size: 1.2rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-sidebar {
    padding: 1rem 0;
    list-style: none;
    margin: 0;
}

.nav-sidebar-item {
    margin: 0;
    padding: 0;
}

.nav-sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.9rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
    position: relative;
    font-weight: 500;
    text-decoration: none;
}

.nav-sidebar-link:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
    padding-left: 1.8rem;
}

.nav-sidebar-link.active {
    color: white;
    background-color: rgba(255, 255, 255, 0.15);
    font-weight: 600;
    border-left: 4px solid white;
}

.nav-sidebar-link.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 4px;
    background-color: white;
}

.nav-sidebar-icon {
    margin-right: 0.8rem;
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
    opacity: 0.9;
}

.nav-sidebar-text {
    letter-spacing: 0.3px;
}

/* 子選單樣式 */
.nav-sidebar-link.dropdown-toggle::after {
    margin-left: auto;
}

.nav-sidebar .collapse {
    background-color: rgba(0, 0, 0, 0.1);
}

.nav-sidebar .collapse .nav-sidebar-link {
    padding-left: 3.5rem;
    font-size: 0.95rem;
}

.nav-sidebar .collapse .nav-sidebar-link:hover {
    padding-left: 3.8rem;
}

.nav-sidebar .collapse .nav-sidebar-link.active {
    border-left: none;
}

/* 側邊欄頁腳 */
.sidebar-footer {
    padding: 1rem 1.5rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    position: absolute;
    bottom: 0;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.1);
}

.content {
    width: calc(100% - var(--sidebar-width));
    min-height: calc(100vh - var(--topbar-height));
    margin-left: var(--sidebar-width);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    padding: 1.5rem;
    background-color: #f8f9fc;
}

.content.toggled {
    margin-left: 0;
}

.topbar {
    height: var(--topbar-height);
    position: sticky;
    top: 0;
    z-index: 99;
    background-color: white;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
}

.topbar-divider {
    width: 0;
    border-right: 1px solid #e3e6f0;
    height: 2rem;
    margin: 0 1rem;
}

.topbar .navbar-search {
    width: 30rem;
    max-width: 100%;
}

.topbar .navbar-search .input-group {
    width: 100%;
}

.topbar .dropdown-menu {
    min-width: 15rem;
    position: absolute;
}

.page-content {
    padding: 1.5rem;
}
/* ==========================================================================
   表頭
   ========================================================================== */
.content-area{
    width: 100%;
}
/* ==========================================================================
   卡片元件樣式
   ========================================================================== */
.card {
    border: none;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    margin-bottom: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
}

.card-header {
    background-color: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem 1.25rem;
    border-top-left-radius: 10px !important;
    border-top-right-radius: 10px !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h6, .card-header .card-title {
    margin-bottom: 0;
    font-weight: 600;
    font-size: 1.1rem;
    color: #333;
}

.card-body {
    padding: 1.5rem;
}

/* 資訊卡片樣式 */
.info-card {
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
}

.info-card:hover {
    transform: translateY(-5px);
}

.info-card-primary {
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    color: white;
}

.info-card-success {
    background: linear-gradient(135deg, #1cc88a 0%, #13855c 100%);
    color: white;
}

.info-card-warning {
    background: linear-gradient(135deg, #f6c23e 0%, #dda20a 100%);
    color: white;
}

.info-card-danger {
    background: linear-gradient(135deg, #e74a3b 0%, #be2617 100%);
    color: white;
}

.info-card-info {
    background: linear-gradient(135deg, #36b9cc 0%, #258391 100%);
    color: white;
}

.info-card-body {
    padding: 1.5rem;
}

.info-card-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.info-card-title {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.8;
}

.info-card-icon {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    opacity: 0.3;
}

/* ==========================================================================
   表格樣式
   ========================================================================== */
.table {
    color: #444;
}

.table th {
    font-weight: 700;
    border-top: none;
    background-color: #f8f9fc;
    color: #5a5c69;
}

.table td {
    vertical-align: middle;
}

.table-responsive {
    overflow-x: auto;
}

.table-filter {
    margin-bottom: 1rem;
}

.table-toolbar {
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-toolbar .btn-group {
    margin-left: 0.5rem;
}

.pagination {
    margin-bottom: 0;
}

/* ==========================================================================
   狀態標籤和徽章
   ========================================================================== */
.status-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 50rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-success {
    background-color: var(--success-color);
    color: white;
}

.badge-warning {
    background-color: var(--warning-color);
    color: #212529;
}

.badge-danger {
    background-color: var(--danger-color);
    color: white;
}

.badge-info {
    background-color: var(--info-color);
    color: white;
}

.badge-primary {
    background-color: var(--primary-color);
    color: white;
}

.badge-secondary {
    background-color: var(--secondary-color);
    color: white;
}

/* ==========================================================================
   表單樣式
   ========================================================================== */
.form-group label {
    font-weight: 600;
    color: #5a5c69;
    margin-bottom: 0.5rem;
}

.form-control {
    border-radius: 0.3rem;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
}

.form-control:focus {
    border-color: #ccc;
    box-shadow: 0 0 0 0.25rem rgba(78, 115, 223, 0.15);
}

/* ==========================================================================
   按鈕樣式
   ========================================================================== */
.btn {
    border-radius: 0.3rem;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    font-weight: 600;
}

.btn-icon {
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 0;
}

.btn-circle {
    border-radius: 100%;
    height: 2.5rem;
    width: 2.5rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-sm {
    font-size: 0.85rem;
    padding: 0.25rem 0.7rem;
}

/* ==========================================================================
   聊天頁面特殊樣式
   ========================================================================== */
.chat-container {
    height: calc(100vh - var(--topbar-height) - 3rem);
    display: flex;
    overflow: hidden;
}

.chat-users {
    width: 300px;
    border-right: 1px solid #e3e6f0;
    overflow-y: auto;
}

.chat-messages {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 1rem;
    border-bottom: 1px solid #e3e6f0;
}

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background-color: #f8f9fc;
}

.chat-footer {
    padding: 1rem;
    border-top: 1px solid #e3e6f0;
}

.chat-user-item {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}

.chat-user-item:hover {
    background-color: #f8f9fc;
}

.chat-user-item.active {
    background-color: #f0f7ff;
    border-left: 4px solid var(--primary-color);
}

.message {
    margin-bottom: 1rem;
    display: flex;
}

.message-incoming {
    justify-content: flex-start;
}

.message-outgoing {
    justify-content: flex-end;
}

.message-content {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    position: relative;
}

.message-incoming .message-content {
    background-color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    border-bottom-left-radius: 0;
}

.message-outgoing .message-content {
    background-color: var(--primary-color);
    color: white;
    border-bottom-right-radius: 0;
}

.message-time {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.message-outgoing .message-time {
    color: rgba(255, 255, 255, 0.8);
}

/* ==========================================================================
   響應式設計
   ========================================================================== */
@media (max-width: 992px) {
    .sidebar {
        width: 230px;
        margin-left: -230px;
    }
    
    .sidebar.toggled {
        margin-left: 0;
    }
    
    .content {
        margin-left: 0;
    }
    
    .content.toggled {
        margin-left: 230px;
    }
    
    .nav-sidebar-text {
        font-size: 0.9rem;
    }
    
    .brand-text {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 250px;
        margin-left: -250px;
        z-index: 1040;
    }
    
    .content.toggled {
        margin-left: 0;
    }
    
    body:after {
        content: '';
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1030;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
    }
    
    body.sidebar-open:after {
        opacity: 1;
        visibility: visible;
    }
}

/* 側邊欄過渡效果增強 */
.sidebar, .content, .nav-sidebar-link {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* 側邊欄項目的hover和active效果增強 */
.nav-sidebar-item {
    position: relative;
    margin: 2px 0;
}

.nav-sidebar-link:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    padding-left: 1.8rem;
}

.nav-sidebar-link.active:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 4px;
    background: white;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.nav-sidebar-link.active:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    z-index: -1;
}

/* 圖標效果增強 */
.nav-sidebar-icon {
    transition: transform 0.2s ease;
}

.nav-sidebar-link:hover .nav-sidebar-icon {
    transform: translateX(3px);
}

/* Logo 區域美化 */
.brand-container {
    padding: 0.9rem 1.5rem;
    background: rgba(0, 0, 0, 0.15);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.brand-logo {
    transition: transform 0.3s ease;
}

.brand:hover .brand-logo {
    transform: scale(1.05);
}

@media (max-width: 576px) {
    .table-responsive {
        display: block;
    }
    
    .topbar .navbar-search {
        display: none;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .table-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .table-toolbar .btn-group {
        margin-top: 0.5rem;
        margin-left: 0;
    }
}

/* ==========================================================================
   Header 美化
   ========================================================================== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-height);
    background-color: white;
    padding: 0 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-right {
    display: flex;
    align-items: center;
}

.header-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

.sidebar-toggle-btn {
    color: #555;
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle-btn:hover {
    background-color: #f1f3fa;
    color: var(--primary-color);
    transform: rotate(15deg);
}

.btn-link {
    color: #6c757d;
    padding: 0.375rem 0.75rem;
    text-decoration: none;
}

.btn-link:hover {
    color: var(--primary-color);
} 