/* ========================================
   建筑项目管理系统 - 全局样式
   Global Styles for Construction PMS
   ======================================== */

/* CSS Variables */
:root {
    /* Primary Colors */
    --primary-color: #1890FF;
    --primary-dark: #096dd9;
    --primary-light: #40a9ff;
    
    /* Secondary Colors */
    --secondary-color: #722ed1;
    --success-color: #52c41a;
    --warning-color: #faad14;
    --danger-color: #f5222d;
    --info-color: #13c2c2;
    
    /* Neutral Colors */
    --text-primary: #262626;
    --text-secondary: #8c8c8c;
    --text-disabled: #bfbfbf;
    --border-color: #d9d9d9;
    --border-light: #f0f0f0;
    --bg-base: #ffffff;
    --bg-light: #fafafa;
    --bg-gray: #f0f2f5;
    
    /* Layout */
    --sidebar-width: 250px;
    --header-height: 60px;
    --border-radius: 8px;
    --border-radius-sm: 4px;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    
    /* Transitions */
    --transition-fast: 0.15s;
    --transition-normal: 0.3s;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-gray);
    margin: 0;
    padding: 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 600;
}

h1 { font-size: 32px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
h4 { font-size: 16px; }
h5 { font-size: 14px; }
h6 { font-size: 12px; }

p { margin: 0 0 1em; }

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* ========================================
   Layout Components
   ======================================== */

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #001529 0%, #002140 100%);
    color: white;
    z-index: 1000;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    background: rgba(255,255,255,0.05);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.sidebar-header .logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header .logo-img {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    object-fit: contain;
    background: white;
    padding: 2px;
}

.sidebar-header .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-color);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.sidebar-header h4 {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}

.sidebar-menu {
    padding: 12px 0;
    overflow-y: auto;
    flex: 1;
}

.menu-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.65);
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

.menu-item.active {
    background: rgba(24, 144, 255, 0.15);
    color: white;
    border-left-color: var(--primary-color);
}

.menu-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.menu-item span {
    font-size: 14px;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-gray);
}

/* Header */
.header {
    background: var(--bg-base);
    padding: 15px 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Page Container */
.page-container {
    padding: 24px;
}

/* ========================================
   Card Components
   ======================================== */

.card {
    background: var(--bg-base);
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.card-header {
    background: var(--bg-base);
    border-bottom: 1px solid var(--border-light);
    padding: 16px 20px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 20px;
}

/* Stat Card */
.stat-card {
    background: var(--bg-base);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    margin-bottom: 16px;
}

.stat-icon-primary { background: linear-gradient(135deg, #1890ff, #096dd9); }
.stat-icon-success { background: linear-gradient(135deg, #52c41a, #389e0d); }
.stat-icon-warning { background: linear-gradient(135deg, #faad14, #d48806); }
.stat-icon-danger { background: linear-gradient(135deg, #f5222d, #cf1322); }
.stat-icon-purple { background: linear-gradient(135deg, #722ed1, #531dab); }
.stat-icon-cyan { background: linear-gradient(135deg, #13c2c2, #08979c); }

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

/* ========================================
   Form Components
   ======================================== */

.form-control, .form-select {
    border-color: var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 8px 12px;
    font-size: 14px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
}

.form-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-label.required::after {
    content: " *";
    color: var(--danger-color);
}

/* ========================================
   Button Components
   ======================================== */

.btn {
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-sm {
    padding: 4px 12px;
    font-size: 13px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
}

/* ========================================
   Table Components
   ======================================== */

.table {
    margin-bottom: 0;
}

.table th {
    background-color: var(--bg-light);
    font-weight: 600;
    border-bottom: 2px solid var(--border-light);
    padding: 12px 16px;
    white-space: nowrap;
}

.table td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
}

.table-hover tbody tr:hover {
    background-color: var(--bg-light);
}

/* Project Table Specific Styles */
#projectTableBody td.project-type-cell,
#projectTableBody td.project-progress-cell {
    background-color: #e3f2fd !important;
    border-radius: var(--border-radius-sm) !important;
    padding: 8px 12px !important;
    border: 1px solid #bbdefb !important;
    min-width: 100px;
}

/* ========================================
   Badge Components
   ======================================== */

.badge {
    padding: 4px 10px;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    font-size: 12px;
}

.badge.bg-secondary { background-color: #8c8c8c !important; color: white !important; }
.badge.bg-primary { background-color: var(--primary-color) !important; color: white !important; }
.badge.bg-success { background-color: var(--success-color) !important; color: white !important; }
.badge.bg-warning { background-color: var(--warning-color) !important; color: white !important; }
.badge.bg-danger { background-color: var(--danger-color) !important; color: white !important; }
.badge.bg-info { background-color: var(--info-color) !important; color: white !important; }
.badge.bg-purple, .badge.bg-purple:hover { background-color: #722ed1 !important; color: white !important; }

/* ========================================
   Progress Bar
   ======================================== */

.progress {
    height: 8px;
    border-radius: 4px;
    background-color: var(--bg-light);
    overflow: hidden;
}

.progress-bar {
    border-radius: 4px;
    transition: width var(--transition-normal);
    color: white !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
}

/* ========================================
   Utility Classes
   ======================================== */

.text-primary { color: var(--primary-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-secondary { color: var(--text-secondary) !important; }

.bg-primary { background-color: var(--primary-color) !important; }
.bg-success { background-color: var(--success-color) !important; }
.bg-warning { background-color: var(--warning-color) !important; }
.bg-danger { background-color: var(--danger-color) !important; }

.g-4 { gap: 24px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mt-4 { margin-top: 24px; }
.me-2 { margin-right: 8px; }
.ms-2 { margin-left: 8px; }

/* Flex utilities */
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.justify-content-end { justify-content: flex-end; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* Spacing */
.p-4 { padding: 24px; }
.px-4 { padding-left: 24px; padding-right: 24px; }
.py-4 { padding-top: 24px; padding-bottom: 24px; }

/* ========================================
   Login Page Specific
   ======================================== */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #001529 0%, #002140 50%, #003a70 100%);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(24, 144, 255, 0.1) 0%, transparent 50%);
    animation: rotate 30s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.login-box {
    background: var(--bg-base);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 520px;
    padding: 48px 48px;
    position: relative;
    z-index: 1;
}

.login-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--border-light);
}

.login-logo-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.login-logo-left .login-logo-img {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.login-logo-left .logo-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    box-shadow: 0 8px 24px rgba(24, 144, 255, 0.35);
}

.login-title-right {
    text-align: right;
}

.login-title-right h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-title-right p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

.login-alert {
    margin-bottom: 20px;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
}

.login-logo-img {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.login-logo .logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    margin-bottom: 16px;
    box-shadow: 0 8px 24px rgba(24, 144, 255, 0.35);
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .form-label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.login-form .form-control {
    height: 52px;
    padding: 0 16px;
    font-size: 15px;
}

.login-form .form-control-icon {
    position: relative;
}

.login-form .form-control-icon i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 16px;
}

.login-form .form-control-icon .form-control {
    padding-left: 44px;
}

.login-btn {
    width: 100%;
    height: 52px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 8px;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}

.login-footer p {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 0;
}

/* Language Selector in Header */
.language-select {
    min-width: 120px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 4px 12px;
    font-size: 13px;
    background: var(--bg-base);
    cursor: pointer;
}

/* User Dropdown */
.user-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--border-radius-sm);
    transition: background-color var(--transition-fast);
}

.user-dropdown:hover {
    background-color: var(--bg-light);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.user-name {
    font-weight: 500;
    color: var(--text-primary);
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .header {
        padding: 12px 16px;
    }
    
    .page-container {
        padding: 16px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-value {
        font-size: 24px;
    }
}
