/* ========================================
   im-kitchen シフト管理システム CSS
   ======================================== */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
    font-family: 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
}
a { color: #2b579a; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- App Layout ---------- */
.app-wrapper { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Top Navigation ---------- */
.top-nav {
    background: linear-gradient(135deg, #2b579a, #1a3a6a);
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.nav-brand { font-size: 1.2rem; font-weight: bold; display: flex; align-items: center; gap: 10px; }
.nav-brand i { font-size: 1.4rem; }
.nav-user { display: flex; align-items: center; gap: 16px; }
.user-name { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.user-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.2);
}
.user-badge.employee { background: #4caf50; }
.user-badge.parttime { background: #ff9800; }
.btn-logout {
    color: #fff;
    opacity: 0.8;
    font-size: 1.1rem;
    transition: opacity 0.2s;
}
.btn-logout:hover { opacity: 1; text-decoration: none; }

/* ---------- Main Container ---------- */
.main-container { display: flex; flex: 1; }

/* ---------- Sidebar ---------- */
.sidebar {
    width: 240px;
    background: #fff;
    border-right: 1px solid #e0e0e0;
    min-height: calc(100vh - 56px);
    overflow-y: auto;
    position: sticky;
    top: 56px;
    flex-shrink: 0;
}
.nav-menu { list-style: none; padding: 8px 0; }
.nav-section {
    padding: 16px 20px 6px;
    font-size: 0.75rem;
    font-weight: bold;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.nav-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: #555;
    font-size: 0.9rem;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.nav-menu a:hover {
    background: #f5f7fa;
    color: #2b579a;
    text-decoration: none;
}
.nav-menu a.active {
    background: #e8eef7;
    color: #2b579a;
    font-weight: bold;
    border-left-color: #2b579a;
}
.nav-menu a i { width: 20px; text-align: center; }

/* ---------- Content Area ---------- */
.content {
    flex: 1;
    padding: 24px;
    min-width: 0;
}

/* ---------- Page Header ---------- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.page-header h1 {
    font-size: 1.5rem;
    color: #2b579a;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ---------- Cards ---------- */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    padding: 20px;
    margin-bottom: 20px;
}
.card-header {
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 2px solid #f0f2f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ---------- Dashboard Grid ---------- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
}
.stat-icon.blue { background: linear-gradient(135deg, #2b579a, #4a7fd4); }
.stat-icon.green { background: linear-gradient(135deg, #27ae60, #2ecc71); }
.stat-icon.orange { background: linear-gradient(135deg, #e67e22, #f39c12); }
.stat-icon.red { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.stat-icon.purple { background: linear-gradient(135deg, #8e44ad, #9b59b6); }
.stat-info h3 { font-size: 0.8rem; color: #888; margin-bottom: 4px; }
.stat-info .stat-number { font-size: 1.8rem; font-weight: bold; color: #333; }

/* ---------- Tables ---------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.data-table th {
    background: #f8f9fb;
    padding: 10px 12px;
    text-align: left;
    font-weight: bold;
    color: #555;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
}
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
.data-table tr:hover { background: #fafbfc; }
.data-table .text-center { text-align: center; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn:hover { text-decoration: none; opacity: 0.9; transform: translateY(-1px); }
.btn-primary { background: #2b579a; color: #fff; }
.btn-success { background: #27ae60; color: #fff; }
.btn-warning { background: #f39c12; color: #fff; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-secondary { background: #95a5a6; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-outline {
    background: transparent;
    border: 1px solid #2b579a;
    color: #2b579a;
}
.btn-outline:hover { background: #2b579a; color: #fff; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: bold;
    color: #555;
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s;
}
.form-control:focus { outline: none; border-color: #2b579a; box-shadow: 0 0 0 3px rgba(43,87,154,0.1); }
select.form-control { appearance: auto; }

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
}
.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-rank-s { background: #ffd700; color: #333; }
.badge-rank-a { background: #c0c0c0; color: #333; }
.badge-rank-b { background: #cd7f32; color: #fff; }
.badge-rank-c { background: #95a5a6; color: #fff; }
.badge-rank-d { background: #e74c3c; color: #fff; }

/* ---------- Alerts ---------- */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ---------- Modal ---------- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}
.modal-header h3 { font-size: 1.1rem; color: #333; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: #999;
}
.modal-body { padding: 20px; }
.modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ---------- Shift Table ---------- */
.shift-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.shift-table th, .shift-table td {
    border: 1px solid #e0e0e0;
    padding: 6px 8px;
    text-align: center;
    min-width: 40px;
}
.shift-table th { background: #2b579a; color: #fff; font-weight: 500; position: sticky; top: 0; }
.shift-table th.day-sun { background: #c0392b; }
.shift-table th.day-sat { background: #2980b9; }
.shift-table .staff-name { text-align: left; white-space: nowrap; font-weight: bold; min-width: 80px; }
.shift-table .shift-cell { cursor: pointer; transition: background 0.2s; min-height: 30px; }
.shift-table .shift-cell:hover { background: #e8eef7; }
.shift-table .shift-cell.has-shift { background: #e8f5e9; color: #2e7d32; font-size: 0.75rem; }
.shift-table .shift-cell.shortage { background: #ffebee; }
.shift-table .shift-cell.full { background: #e8f5e9; }

/* ---------- Capacity Bar (定員充足) ---------- */
.capacity-bar { height: 8px; border-radius: 4px; background: #eee; margin-top: 4px; }
.capacity-bar .fill { height: 100%; border-radius: 4px; transition: width 0.3s; }
.capacity-bar .fill.ok { background: #27ae60; }
.capacity-bar .fill.warn { background: #f39c12; }
.capacity-bar .fill.danger { background: #e74c3c; }

/* ---------- Filter Bar ---------- */
.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.filter-bar .form-control { width: auto; }
.filter-toggle {
    display: flex;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #ddd;
}
.filter-toggle button {
    padding: 8px 16px;
    border: none;
    background: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.filter-toggle button.active { background: #2b579a; color: #fff; }

/* ---------- Login Page ---------- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a3a6a 0%, #2b579a 50%, #4a7fd4 100%);
}
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-card h1 {
    text-align: center;
    color: #2b579a;
    margin-bottom: 8px;
    font-size: 1.6rem;
}
.login-card .subtitle {
    text-align: center;
    color: #888;
    margin-bottom: 32px;
    font-size: 0.9rem;
}
.login-card .login-icon {
    text-align: center;
    font-size: 3rem;
    color: #2b579a;
    margin-bottom: 16px;
}

/* ---------- Print ---------- */
@media print {
    .top-nav, .sidebar, .no-print { display: none !important; }
    .content { padding: 0; }
    .main-container { display: block; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .content { padding: 16px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; }
    .page-header { flex-direction: column; gap: 12px; align-items: flex-start; }
}

/* ---------- Utility ---------- */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: #999; }
.text-success { color: #27ae60; }
.text-danger { color: #e74c3c; }
.text-warning { color: #f39c12; }
.d-flex { display: flex; }
.gap-2 { gap: 16px; }
.flex-1 { flex: 1; }
