/* 工廠生產排程模擬器 - 工業風格共用樣式表 */

/* CSS 變數定義 - 工業色彩系統 */
:root {
    /* 主要工業色彩 */
    --industrial-dark: #0d0d0d;      /* 碳黑色 */
    --industrial-gray: #1a1a1a;      /* 深灰色 */
    --industrial-medium: #2d2d2d;    /* 中灰色 */
    --industrial-light: #404040;     /* 淺灰色 */
    --rust-brown: #3e2723;           /* 鐵鏽棕色 */
    --concrete-gray: #666666;        /* 混凝土灰 */

    /* 工業警示色 */
    --safety-yellow: #ffc107;        /* 工業黃 */
    --safety-orange: #ff5722;        /* 安全橙 */
    --warning-red: #f44336;          /* 警戒紅 */
    --status-green: #4caf50;         /* 狀態綠 */

    /* 金屬質感色彩 */
    --metal-silver: #c0c0c0;         /* 金屬銀 */
    --steel-blue: #4682b4;           /* 鋼藍色 */
    --bronze: #cd7f32;               /* 青銅色 */

    /* 字體系統 */
    --font-industrial: 'Oswald', 'Roboto Condensed', 'Arial Black', sans-serif;
    --font-body: 'Roboto', 'Microsoft JhengHei', sans-serif;

    /* 間距系統 */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* 邊框和陰影 */
    --border-industrial: 2px solid var(--industrial-light);
    --shadow-metal: 0 4px 8px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
    --shadow-deep: 0 8px 25px rgba(0,0,0,0.5);
}

/* 確保變數在頁面載入時可用 */
body {
    --industrial-dark: #0d0d0d;
    --industrial-gray: #1a1a1a;
    --industrial-medium: #2d2d2d;
    --industrial-light: #404040;
    --rust-brown: #3e2723;
    --concrete-gray: #666666;
    --safety-yellow: #ffc107;
    --safety-orange: #ff5722;
    --warning-red: #f44336;
    --status-green: #4caf50;
    --metal-silver: #c0c0c0;
    --steel-blue: #4682b4;
    --bronze: #cd7f32;
    --font-industrial: 'Oswald', 'Roboto Condensed', 'Arial Black', sans-serif;
    --font-body: 'Roboto', 'Microsoft JhengHei', sans-serif;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --border-industrial: 2px solid var(--industrial-light);
    --shadow-metal: 0 4px 8px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
    --shadow-deep: 0 8px 25px rgba(0,0,0,0.5);
}

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

body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: #e0e0e0;
    background: linear-gradient(135deg, var(--industrial-dark) 0%, var(--industrial-gray) 100%);
    background-attachment: fixed;

    /* 工業紋理背景 */
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 10px,
            rgba(255,255,255,0.01) 10px,
            rgba(255,255,255,0.01) 20px
        );
    pointer-events: none;
    z-index: 1;
}

body > * {
    position: relative;
    z-index: 2;
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 工業風格導航列 */
.navbar {
    background: linear-gradient(180deg, var(--industrial-medium) 0%, var(--industrial-dark) 100%);
    color: #e0e0e0;
    padding: var(--spacing-md) 0;
    border-bottom: var(--border-industrial);
    box-shadow: var(--shadow-metal);
    position: relative;
}

/* 導航列鉚釘裝飾 */
.navbar::before,
.navbar::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, var(--metal-silver) 0%, var(--industrial-light) 70%, transparent 100%);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    box-shadow: inset 0 0 3px rgba(0,0,0,0.5);
}

.navbar::before { left: 20px; }
.navbar::after { right: 20px; }

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar h1 {
    font-family: var(--font-industrial);
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--metal-silver);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.nav-links {
    display: flex;
    gap: var(--spacing-lg);
    list-style: none;
}

.nav-links a {
    color: #b0b0b0;
    text-decoration: none;
    padding: var(--spacing-xs) var(--spacing-sm);
    border: 1px solid transparent;
    font-family: var(--font-industrial);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    position: relative;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 100%);
}

.nav-links a::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--safety-yellow);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--metal-silver);
    border-color: var(--industrial-light);
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.02) 100%);
    text-shadow: 0 0 8px rgba(255,255,255,0.3);
}

.nav-links a:hover::before, .nav-links a.active::before {
    transform: scaleX(1);
}

.nav-links a.active {
    background: linear-gradient(135deg, var(--safety-orange) 0%, rgba(255,87,34,0.3) 100%);
    border-color: var(--safety-orange);
}

/* 主要內容區域 */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 80px);
}

/* 工業風格金屬板材卡片 */
.card {
    background: linear-gradient(135deg, var(--industrial-medium) 0%, var(--industrial-gray) 100%);
    border-radius: 8px;
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-metal);
    border: var(--border-industrial);
    position: relative;
    overflow: hidden;
}

/* 卡片鉚釘角落裝飾 */
.card::before,
.card::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: radial-gradient(circle, var(--metal-silver) 0%, var(--industrial-light) 60%, transparent 100%);
    border-radius: 50%;
    box-shadow: inset 0 0 4px rgba(0,0,0,0.6);
}

.card::before { top: 8px; left: 8px; }
.card::after { top: 8px; right: 8px; }

/* 卡片底部鉚釘 */
.card-bottom-rivets::before,
.card-bottom-rivets::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: radial-gradient(circle, var(--metal-silver) 0%, var(--industrial-light) 60%, transparent 100%);
    border-radius: 50%;
    box-shadow: inset 0 0 4px rgba(0,0,0,0.6);
    bottom: 8px;
}

.card-bottom-rivets::before { left: 8px; }
.card-bottom-rivets::after { right: 8px; }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--industrial-light);
}

.card-title {
    font-family: var(--font-industrial);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--metal-silver);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 工業風格表單樣式 */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-family: var(--font-industrial);
    font-weight: 500;
    color: var(--metal-silver);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: var(--spacing-sm);
    background: var(--industrial-dark);
    border: 2px solid var(--industrial-light);
    border-radius: 4px;
    font-size: 1rem;
    color: #e0e0e0;
    transition: all 0.3s ease;
    font-family: var(--font-body);
}

.form-control:focus {
    outline: none;
    border-color: var(--safety-yellow);
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.2);
    background: linear-gradient(135deg, var(--industrial-dark) 0%, rgba(255, 193, 7, 0.05) 100%);
}

.form-control::placeholder {
    color: #888888;
}

/* 工業風格按鈕系統 */
.btn {
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-radius: 4px;
    font-family: var(--font-industrial);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-metal);
}

/* 按鈕金屬質感 */
.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* 主要操作按鈕 - 工業黃 */
.btn-primary {
    background: linear-gradient(135deg, var(--safety-yellow) 0%, #e6ac00 100%);
    color: var(--industrial-dark);
    border: 1px solid #d4a000;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #e6ac00 0%, #cc9900 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.4);
}

/* 次要按鈕 - 金屬灰 */
.btn-secondary {
    background: linear-gradient(135deg, var(--concrete-gray) 0%, var(--industrial-light) 100%);
    color: #e0e0e0;
    border: 1px solid var(--industrial-light);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--industrial-light) 0%, var(--concrete-gray) 100%);
    transform: translateY(-1px);
}

/* 成功按鈕 - 狀態綠 */
.btn-success {
    background: linear-gradient(135deg, var(--status-green) 0%, #388e3c 100%);
    color: white;
    border: 1px solid #2e7d32;
}

.btn-success:hover {
    background: linear-gradient(135deg, #388e3c 0%, #2e7d32 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

/* 警告按鈕 - 安全橙 */
.btn-warning {
    background: linear-gradient(135deg, var(--safety-orange) 0%, #e64a19 100%);
    color: white;
    border: 1px solid #d84315;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #e64a19 0%, #d84315 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255, 87, 34, 0.3);
}

/* 危險按鈕 - 警戒紅 */
.btn-danger {
    background: linear-gradient(135deg, var(--warning-red) 0%, #c62828 100%);
    color: white;
    border: 1px solid #b71c1c;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c62828 0%, #b71c1c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

/* 網格系統 */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: -1rem;
}

.col {
    flex: 1;
    padding: 1rem;
}

.col-6 {
    flex: 0 0 50%;
    padding: 1rem;
}

.col-4 {
    flex: 0 0 33.333%;
    padding: 1rem;
}

.col-3 {
    flex: 0 0 25%;
    padding: 1rem;
}

/* 工業風格狀態指示器 */
.status {
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-industrial);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid;
    position: relative;
}

/* 狀態指示器鉚釘效果 */
.status::before,
.status::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0.3) 100%);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    box-shadow: inset 0 0 2px rgba(0,0,0,0.3);
}

.status::before { left: 4px; }
.status::after { right: 4px; }

.status-success {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.2) 0%, rgba(76, 175, 80, 0.1) 100%);
    color: #81c784;
    border-color: var(--status-green);
}

.status-warning {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.2) 0%, rgba(255, 193, 7, 0.1) 100%);
    color: var(--safety-yellow);
    border-color: #e6ac00;
}

.status-danger {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.2) 0%, rgba(244, 67, 54, 0.1) 100%);
    color: #e57373;
    border-color: var(--warning-red);
}

.status-info {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.2) 0%, rgba(33, 150, 243, 0.1) 100%);
    color: #64b5f6;
    border-color: var(--steel-blue);
}

/* 工業風格表格樣式 */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: var(--spacing-sm);
    background: var(--industrial-dark);
    border: var(--border-industrial);
    box-shadow: var(--shadow-metal);
}

.table th,
.table td {
    padding: var(--spacing-sm);
    text-align: left;
    border-bottom: 1px solid var(--industrial-light);
    color: #e0e0e0;
    font-family: var(--font-body);
}

.table th {
    background: linear-gradient(135deg, var(--industrial-medium) 0%, var(--industrial-gray) 100%);
    font-family: var(--font-industrial);
    font-weight: 600;
    color: var(--metal-silver);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
    border-bottom: 2px solid var(--safety-yellow);
    position: relative;
}

/* 表格標題鉚釘裝飾 */
.table th::before {
    content: '';
    position: absolute;
    left: var(--spacing-xs);
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: var(--safety-yellow);
    border-radius: 50%;
    box-shadow: 0 0 4px var(--safety-yellow);
}

.table tbody tr:hover {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(255, 193, 7, 0.02) 100%);
}

.table tbody tr:nth-child(even) {
    background: rgba(255,255,255,0.02);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* 甘特圖樣式 */
.gantt-container {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    overflow-x: auto;
    margin-top: 2rem;
}

.gantt-chart {
    min-width: 800px;
    height: 400px;
    border: 1px solid #e1e8ed;
    border-radius: 5px;
    position: relative;
    background: #fafbfc;
}

/* 圖表容器 */
.chart-container {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    margin-top: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.chart {
    height: 300px;
    border: 1px solid #e1e8ed;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    background: #fafbfc;
}

/* 進度條 */
.progress {
    width: 100%;
    height: 1rem;
    background-color: #e9ecef;
    border-radius: 0.5rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

/* 標籤 */
.badge {
    display: inline-block;
    padding: 0.25em 0.5em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
}

.badge-primary {
    color: #fff;
    background-color: #667eea;
}

.badge-secondary {
    color: #fff;
    background-color: #6c757d;
}

.badge-success {
    color: #fff;
    background-color: #28a745;
}

/* 工具提示 */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 0.5rem;
    border-radius: 5px;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
}

/* 響應式設計 */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .nav-links {
        flex-direction: column;
        gap: 0.5rem;
    }

    .row {
        flex-direction: column;
        margin: 0;
    }

    .col, .col-6, .col-4, .col-3 {
        flex: 1;
        padding: 0.5rem 0;
    }

    .card {
        padding: 1.5rem;
    }

    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 1rem;
    }

    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* 動畫效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* 載入動畫 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 模態框樣式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.close {
    font-size: 2rem;
    cursor: pointer;
    color: #aaa;
    background: none;
    border: none;
}

.close:hover {
    color: #000;
}