/* style.css - PinShift Lite 全系統共用樣式 */
/* 最後更新：整合所有頁面（登入、後台、員工更表、QR 顯示等） */

/* ==========================================
   1. 全局基礎樣式
   ========================================== */
:root {
    --primary: #0066cc;
    --primary-dark: #0052a3;
    --success: #2e7d32;
    --danger: #d32f2f;
    --warning: #f57c00;
    --light: #f8f9fa;
    --dark: #333;
    --gray: #555;
    --border: #ddd;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button, input[type="submit"] {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    transition: all 0.3s;
}

button:hover, input[type="submit"]:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

input[type="text"], input[type="password"], input[type="time"], select, textarea {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1.1em;
    width: 100%;
    transition: all 0.3s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0,102,204,0.15);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* 訊息框 */
.success, .error, .info {
    padding: 16px 24px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: center;
    font-size: 1.1em;
}

.success { background: #e8f5e9; color: var(--success); border: 1px solid #a5d6a7; }
.error   { background: #ffebee; color: var(--danger);  border: 1px solid #ef9a9a; }
.info    { background: #e3f2fd; color: var(--primary); border: 1px solid #90caf9; }

/* ==========================================
   2. 登入頁面（login.php / index.php）
   ========================================== */
.login-box {
    background: white;
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(0,0,0,0.15);
    padding: 50px 45px;
    width: 100%;
    max-width: 420px;
    margin: 40px auto;
    text-align: center;
    animation: fadeIn 1s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-30px); }
    to   { opacity: 1; transform: translateY(0); }
}

.login-box .logo {
    max-width: 180px;
    margin-bottom: 35px;
}

.login-box h1 {
    color: #1a3c6d;
    margin: 0 0 35px;
    font-size: 2.4em;
}

.login-box .error-message {
    background: #ffebee;
    color: #c62828;
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 25px;
    font-size: 1em;
}

/* ==========================================
   3. 後台儀表板（admin/index.php）
   ========================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin: 40px 0;
}

.stat-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    padding: 30px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}

.stat-number {
    font-size: 3.2em;
    font-weight: bold;
    color: var(--primary);
    margin: 15px 0;
}

.stat-label {
    font-size: 1.2em;
    color: var(--gray);
}

/* 導航清單 */
.nav-list ul {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.nav-list li a {
    display: block;
    padding: 18px 25px;
    background: #f0f7ff;
    color: var(--primary);
    text-decoration: none;
    border-radius: 10px;
    font-size: 1.2em;
    text-align: center;
    transition: all 0.3s;
}

.nav-list li a:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
}

/* ==========================================
   4. 員工更表（dashboard.php）
   ========================================== */
.calendar {
    width: 100%;
    border-collapse: collapse;
    margin: 30px 0;
    font-size: 1.1em;
}

.calendar th, .calendar td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: center;
    vertical-align: top;
    height: 110px;
}

.calendar th {
    background: #e3f2fd;
    font-weight: bold;
}

.day-number {
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
}

.has-shift {
    background: #e8f5e9;
    border-left: 5px solid #4caf50;
}

.shift-info {
    font-size: 0.95em;
    margin-top: 8px;
    line-height: 1.5;
    text-align: left;
}

/* 快速功能卡片 */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin: 50px 0;
}

.action-card {
    background: #f0f7ff;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    transition: all 0.3s;
}

.action-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}

.action-card a {
    display: block;
    color: var(--primary);
    text-decoration: none;
    font-size: 1.3em;
    font-weight: bold;
}

.action-card a:hover {
    color: var(--primary-dark);
}

/* ==========================================
   5. 動態 QR 顯示頁（display_dynamic_qr.php）
   ========================================== */
.qr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 30px;
}

.qr-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    padding: 30px;
    text-align: center;
    transition: all 0.4s ease;
    opacity: 0;
    transform: translateY(40px);
    animation: fadeInUp 1s forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.qr-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.qr-card img {
    width: 280px;
    height: 280px;
    border: 12px solid var(--primary);
    border-radius: 16px;
    margin: 25px 0;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.countdown {
    font-size: 1.7em;
    font-weight: bold;
    color: var(--danger);
    background: #ffebee;
    padding: 12px 20px;
    border-radius: 12px;
    display: inline-block;
    margin: 15px 0;
}

#offline-warning {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    background: var(--danger);
    color: white;
    padding: 20px;
    text-align: center;
    font-size: 1.5em;
    font-weight: bold;
    z-index: 9999;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

/* ==========================================
   6. 響應式調整（手機 / 平板）
   ========================================== */
@media (max-width: 768px) {
    .container { padding: 20px; }
    .login-box { padding: 40px 25px; }
    .qr-card img { width: 240px; height: 240px; }
    .stat-number { font-size: 2.8em; }
    .qr-grid { grid-template-columns: 1fr; }
    .quick-actions { grid-template-columns: 1fr; }
}