/* 全局樣式 */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
}

/* 基礎響應式設定 */
html {
    font-size: 16px;
}

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
}

body {
    font-family: "Microsoft JhengHei", "微軟正黑體", sans-serif;
    background-color: #f5f5f5;
    overflow-x: hidden;
}

/* 登入頁面樣式 */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.login-card .card-header {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 1.5rem;
}

.login-card .card-body {
    padding: 2rem;
}

@media (max-width: 576px) {
    .login-card .card-body {
        padding: 1.5rem;
    }
}

/* 驗證碼樣式 */
.captcha-container {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.captcha-image {
    height: 38px;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    cursor: pointer;
}

@media (max-width: 576px) {
    .captcha-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .captcha-image {
        width: 100%;
        height: auto;
    }
}

/* 登入成功提示 */
.alert-success {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
    display: none;
    animation: slideIn 0.5s ease-out;
    max-width: 90%;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 導覽列樣式 */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
    background-color: white;
    padding: 0.5rem 1rem;
}

.navbar-brand {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-right: 1rem;
}

/* 桌面版導覽列特定樣式 */
@media (min-width: 992px) {
    .navbar .container-fluid {
        display: flex;
        align-items: center;
        padding: 0 1rem;
    }

    .navbar-collapse {
        display: flex !important;
        flex-basis: auto;
    }

    .navbar-nav {
        display: flex;
        flex-direction: row;
        padding-left: 0;
        margin-bottom: 0;
        list-style: none;
        margin-right: auto;
    }

    .nav-item {
        display: flex;
        align-items: center;
    }

    .nav-link {
        padding: 0.5rem 1rem;
        color: rgba(255, 255, 255, 0.85) !important;
        text-decoration: none;
        white-space: nowrap;
    }

    .nav-link:hover {
        color: #fff !important;
    }

    .nav-link.active {
        color: #fff !important;
        font-weight: 600;
    }

    /* 用戶資訊區域 */
    .user-info {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        margin-left: auto !important;
        width: auto !important;
        margin-top: 0 !important;
    }

    .text-light {
        margin-right: 1rem;
    }

    .logout-btn {
        width: auto !important;
        margin-top: 0 !important;
        padding: 0.375rem 1rem;
        white-space: nowrap;
    }
}

/* 手機版導覽列特定樣式 */
@media (max-width: 991.98px) {
    .navbar .user-info {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100%;
    }
    
    .navbar .logout-btn {
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .navbar .text-light {
        justify-content: center;
        width: 100%;
    }
}

/* 側邊欄樣式 */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    padding: 48px 0 0;
    box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
    background-color: white;
    transition: all 0.3s ease;
    width: 250px;
}

.sidebar-sticky {
    position: relative;
    top: 0;
    height: calc(100vh - 48px);
    padding-top: .5rem;
    overflow-x: hidden;
    overflow-y: auto;
}

.sidebar .nav-link {
    color: var(--dark-color);
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar .nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.1);
}

.sidebar .nav-link.active {
    color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.1);
}

/* 個人資訊卡片樣式 */
.user-info-card {
    min-width: 200px;
    padding: 1rem;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

.user-info-card .user-name {
    font-weight: bold;
    color: var(--dark-color);
}

.user-info-card .user-email {
    color: var(--secondary-color);
    font-size: 0.9rem;
    word-break: break-all;
}

.user-info-card .user-groups {
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

/* 主內容區域樣式 */
.main-content {
    margin-left: 0;
    padding: 2rem;
    transition: all 0.3s ease;
    min-height: calc(100vh - 56px);
}

.main-content.sidebar-open {
    margin-left: 250px;
}

/* 表格響應式樣式 */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 卡片響應式樣式 */
.card {
    margin-bottom: 1rem;
}

.card-body {
    padding: 1.25rem;
}

@media (max-width: 576px) {
    .card-body {
        padding: 1rem;
    }
}

/* 表單響應式樣式 */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    margin-bottom: 0.5rem;
}

/* 按鈕響應式樣式 */
.btn {
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
}

@media (max-width: 576px) {
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn-group {
        width: 100%;
    }
    
    .btn-group .btn {
        flex: 1;
    }
}

/* 響應式設計 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0 !important;
        padding: 1rem;
    }
    
    .user-info-card {
        position: fixed;
        top: 56px;
        right: 0;
        left: 0;
        z-index: 99;
        border-radius: 0;
        box-shadow: 0 2px 4px rgba(0,0,0,.1);
    }
}

/* 列印樣式 */
@media print {
    .sidebar,
    .navbar,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: none !important;
    }
}

@media (max-width: 991.98px) {
  .navbar .user-info {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100%;
  }
  .navbar .logout-btn {
    width: 100%;
    margin-top: 0.5rem;
  }
  .navbar .text-light {
    justify-content: center;
    width: 100%;
  }
  /* 手機版九宮格主選單 */
  .main-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    margin: 15px;
    border-radius: 20px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 24px rgba(13, 110, 253, 0.08);
    border: 1px solid rgba(227, 227, 227, 0.5);
    backdrop-filter: blur(10px);
  }
  .main-menu-grid .menu-grid-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.7);
    color: var(--primary-color);
    font-size: 1.25rem;
    font-weight: 600;
    padding: 22px 0 14px 0;
    text-decoration: none;
    transition: all 0.3s ease;
    min-height: 100px;
    position: relative;
    border: none;
  }
  .main-menu-grid .menu-grid-btn::after {
    content: '';
    position: absolute;
    right: 0;
    top: 15%;
    height: 70%;
    width: 1px;
    background: linear-gradient(to bottom, transparent, rgba(13, 110, 253, 0.1), transparent);
  }
  .main-menu-grid .menu-grid-btn::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 15%;
    width: 70%;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(13, 110, 253, 0.1), transparent);
  }
  .main-menu-grid .menu-grid-btn:nth-child(3n)::after {
    display: none;
  }
  .main-menu-grid .menu-grid-btn:nth-last-child(-n+3)::before {
    display: none;
  }
  .main-menu-grid .menu-grid-btn i {
    font-size: 2.5rem;
    margin-bottom: 8px;
    color: var(--primary-color);
    opacity: 0.9;
    transition: all 0.3s ease;
  }
  .main-menu-grid .menu-grid-btn span {
    font-size: 1.15rem;
    margin-top: 2px;
    letter-spacing: 0.5px;
    color: var(--primary-color);
    font-weight: 500;
    transition: all 0.3s ease;
  }
  .main-menu-grid .menu-grid-btn.active,
  .main-menu-grid .menu-grid-btn:active {
    background: linear-gradient(145deg, rgba(13, 110, 253, 0.05), rgba(13, 110, 253, 0.1));
    transform: scale(0.98);
  }
  .main-menu-grid .menu-grid-btn:hover {
    background: rgba(13, 110, 253, 0.05);
  }
  .main-menu-grid .menu-grid-btn.active i,
  .main-menu-grid .menu-grid-btn:active i {
    transform: scale(1.1);
    opacity: 1;
  }
  .main-menu-grid .menu-grid-btn.active span,
  .main-menu-grid .menu-grid-btn:active span {
    font-weight: 600;
  }
  /* 移除底部line-bottom-nav樣式 */
  .line-bottom-nav { display: none !important; }
} 