/**
 * Portal NEO - スタイルシート
 * Google Material Design + Indigo Theme
 */

:root {
    /* Deep Indigoテーマ */
    --primary: #1e3a5f;
    --primary-light: #2d5a8f;
    --primary-dark: #0f1f3a;
    --primary-rgb: 30, 58, 95;

    /* アクセントカラー */
    --accent: #294d7a;
    --success: #198754;
    --warning: #dc8a10;
    --error: #c41e3a;
    --info: #2d5a8f;

    /* グレースケール */
    --white: #ffffff;
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-400: #bdbdbd;
    --gray-500: #9e9e9e;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;

    /* レイアウト */
    --header-height: 64px;
    --sidebar-width: 240px;

    /* シャドウ */
    --shadow-1: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    --shadow-2: 0 3px 6px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.12);
    --shadow-3: 0 10px 20px rgba(0,0,0,0.15), 0 3px 6px rgba(0,0,0,0.10);

    /* トランジション */
    --transition: 0.2s ease;
}

/* リセット */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
}

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ========================================
   ログインページ
   ======================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow-3);
    overflow: hidden;
}

.login-header {
    background: var(--primary);
    color: var(--white);
    padding: 32px;
    text-align: center;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 8px;
}

.login-header p {
    opacity: 0.8;
    font-size: 14px;
}

.login-form {
    padding: 32px;
}

.login-footer {
    padding: 16px 32px;
    background: var(--gray-50);
    text-align: center;
    font-size: 12px;
    color: var(--gray-500);
}

/* ========================================
   フォーム
   ======================================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.input-with-icon {
    position: relative;
}

.input-with-icon .material-icons {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 20px;
}

.input-with-icon input {
    width: 100%;
    padding: 12px 12px 12px 44px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-size: 14px;
    transition: var(--transition);
}

.input-with-icon input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

input, select, textarea {
    font-family: inherit;
}

/* ========================================
   ボタン
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn .material-icons {
    font-size: 18px;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-light);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--gray-100);
}

/* ========================================
   アラート
   ======================================== */
.alert {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 4px;
    margin: 0 32px 16px;
    font-size: 13px;
}

.alert .material-icons {
    font-size: 20px;
}

.alert-error {
    background: #ffebee;
    color: var(--error);
}

.alert-success {
    background: #e8f5e9;
    color: var(--success);
}

/* ========================================
   レイアウト
   ======================================== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ヘッダー */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    padding: 0 24px;
    z-index: 1000;
    box-shadow: var(--shadow-2);
}

.header-logo {
    font-size: 20px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo .material-icons {
    font-size: 28px;
}

.header-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
    background: transparent !important;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    background: transparent !important;
    text-decoration: none;
    color: #fff;
}

.header-user:hover {
    background: rgba(255,255,255,0.1) !important;
    text-decoration: none;
}

.header-user .material-icons {
    font-size: 32px;
    color: #fff;
}

.header-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.3;
    background: transparent;
}

.header-user-name,
.header-user-dept {
    background: transparent;
}

.header-user-name {
    font-size: 14px;
    font-weight: 500;
}

.header-user-dept {
    font-size: 11px;
    opacity: 0.8;
}

.header-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    color: #fff !important;
    background: transparent !important;
    border: none !important;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
}

.header-logout-btn:hover {
    background: rgba(255,255,255,0.1) !important;
}

.header-logout-btn .material-icons {
    font-size: 24px;
}

/* サイドバー（アイコンのみ） */
.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: 60px;
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    overflow: hidden;
    z-index: 900;
}

.sidebar-nav {
    padding: 8px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 0;
    color: var(--gray-700);
    transition: var(--transition);
    font-size: 0;
}

.nav-item:hover {
    background: var(--gray-100);
    text-decoration: none;
}

.nav-item.active {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
    border-right: 3px solid var(--primary);
}

.nav-item .material-icons {
    font-size: 24px;
}

.nav-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 8px 12px;
}

/* メインコンテンツ */
.main-content {
    flex: 1;
    margin-left: 60px;
    margin-top: var(--header-height);
    padding: 24px;
}

/* ========================================
   カード
   ======================================== */
.card {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow-1);
    overflow: hidden;
}

.card-header {
    background: var(--primary);
    color: var(--white);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2 {
    font-size: 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h2 .material-icons {
    font-size: 20px;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 12px 20px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
}

/* ========================================
   ダッシュボード
   ======================================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
}

.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }

/* メニューグリッド */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow-1);
    color: var(--gray-700);
    text-decoration: none;
    transition: var(--transition);
}

.menu-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-2);
    text-decoration: none;
}

.menu-item .material-icons {
    font-size: 36px;
    color: var(--primary);
    margin-bottom: 8px;
}

.menu-item span {
    font-size: 13px;
    font-weight: 500;
}

/* カレンダー */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.calendar-title {
    font-size: 18px;
    font-weight: 500;
}

.calendar-nav {
    display: flex;
    gap: 4px;
}

.calendar-nav button {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--gray-100);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.calendar-nav button:hover {
    background: var(--gray-200);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--gray-200);
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.calendar-weekday {
    background: var(--primary);
    color: var(--white);
    text-align: center;
    padding: 10px;
    font-size: 13px;
    font-weight: 500;
}

.calendar-day {
    background: var(--white);
    min-height: 130px;
    padding: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.calendar-day:hover {
    background: var(--gray-50);
}

.calendar-day.other-month {
    background: var(--gray-50);
}

.calendar-day.today {
    background: rgba(var(--primary-rgb), 0.05);
}

.calendar-date {
    font-size: 14px;
    font-weight: 500;
    padding: 4px;
    margin-bottom: 4px;
}

.calendar-day.today .calendar-date {
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-event {
    font-size: 14px;
    padding: 8px 10px;
    margin: 4px 0;
    border-radius: 4px;
    background: #e3f2fd;
    color: var(--gray-800);
    border-left: 4px solid var(--accent);
    cursor: pointer;
}

.calendar-event:hover {
    background: #bbdefb;
}

.calendar-event.all-day {
    background: #e8f5e9;
    border-left-color: var(--success);
}

.calendar-event.all-day:hover {
    background: #c8e6c9;
}

.calendar-event.private {
    background: #fff8e1;
    border-left-color: #ffb300;
}

.calendar-event.private:hover {
    background: #ffecb3;
}

.calendar-event.locked-only {
    background: #fff8e1;
    border-left-color: #ffb300;
    min-width: 24px;
    text-align: center;
}

.event-lock {
    font-size: 10px;
    margin-right: 2px;
}

.event-badge {
    display: inline-block;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    margin-right: 4px;
}

.event-badge.external {
    background: #1976d2;
}

.event-badge.tentative {
    background: #7b1fa2;
}

.event-badge.important {
    background: #d32f2f;
}

.event-badge.flagged {
    background: #f57c00;
    padding: 1px 3px;
}

.event-icon-img {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 3px;
}

.event-time {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.event-title {
    font-size: 15px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.event-icon {
    font-size: 14px;
    margin-right: 4px;
}

/* パネル */
.panel {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow-1);
    overflow: hidden;
}

.panel-header {
    background: var(--primary);
    color: var(--white);
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-header .material-icons {
    font-size: 18px;
}

.panel-body {
    padding: 16px;
}

/* リストアイテム */
.list-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
}

.list-item:last-child {
    border-bottom: none;
}

.list-item-icon {
    width: 40px;
    height: 40px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
}

.list-item-icon .material-icons {
    color: var(--primary);
    font-size: 20px;
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-weight: 500;
    margin-bottom: 2px;
}

.list-item-meta {
    font-size: 12px;
    color: var(--gray-500);
}

.list-item-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.badge-important {
    background: #ffebee;
    color: var(--error);
}

.badge-pending {
    background: #fff8e1;
    color: var(--warning);
}

.badge-high {
    background: #ffebee;
    color: var(--error);
}

/* ToDoリスト */
.todo-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
}

.todo-item:last-child {
    border-bottom: none;
}

.todo-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-400);
    border-radius: 4px;
    margin-right: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.todo-checkbox:hover {
    border-color: var(--primary);
}

.todo-checkbox.checked {
    background: var(--primary);
    border-color: var(--primary);
}

.todo-checkbox.checked::after {
    content: '✓';
    color: var(--white);
    font-size: 12px;
}

.todo-content {
    flex: 1;
}

.todo-title {
    font-size: 13px;
}

.todo-due {
    font-size: 11px;
    color: var(--gray-500);
}

/* FAB */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 50%;
    box-shadow: var(--shadow-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 800;
}

.fab:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-3);
}

.fab .material-icons {
    font-size: 24px;
}

/* ========================================
   テーブル
   ======================================== */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    background: var(--gray-50);
    font-weight: 500;
    font-size: 12px;
    color: var(--gray-600);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

/* ========================================
   ボトムナビゲーション（モバイル用）
   ======================================== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

.bottom-nav-list {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    margin: 0;
    padding: 0 4px;
    list-style: none;
}

.bottom-nav-list li {
    flex: 1;
    display: flex;
    justify-content: center;
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-decoration: none;
    color: var(--gray-500);
    font-size: 10px;
    transition: var(--transition);
    padding: 4px 2px;
    min-width: 0;
}

.bottom-nav-item .material-icons {
    font-size: 22px;
    margin-bottom: 2px;
}

.bottom-nav-item span:not(.material-icons) {
    font-size: 9px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.bottom-nav-item.active,
.bottom-nav-item:hover {
    color: var(--primary);
}

.bottom-nav-item.active {
    color: var(--primary);
}

/* ハンバーガーメニュー（非表示） */
.menu-toggle {
    display: none;
}

/* サイドバーオーバーレイ（非表示） */
.sidebar-overlay {
    display: none;
}

/* ========================================
   レスポンシブ
   ======================================== */
@media (max-width: 1024px) {
    .col-4, .col-6, .col-8 {
        grid-column: span 12;
    }

    .menu-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* ボトムナビ表示 */
    .bottom-nav {
        display: block;
    }

    /* サイドバー非表示 */
    .sidebar {
        display: none;
    }

    /* メインコンテンツ */
    .main-content {
        margin-left: 0;
        padding: 16px;
        padding-bottom: 76px; /* ボトムナビの高さ分 */
    }

    /* ヘッダーユーザー情報非表示 */
    .header-user-info {
        display: none;
    }

    .header-user .material-icons {
        font-size: 28px;
    }

    /* ヘッダーロゴ縮小 */
    .header-logo {
        font-size: 16px;
    }

    .header-logo .material-icons {
        font-size: 24px;
    }

    /* テーブルのレスポンシブ */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-responsive .table {
        min-width: 600px;
    }

    /* カード */
    .card-body {
        padding: 16px;
    }

    /* FAB位置調整 */
    .fab {
        bottom: 76px;
        right: 16px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 12px;
    }

    .header {
        padding: 0 12px;
    }

    .menu-toggle {
        margin-right: 8px;
    }

    .header-logo {
        font-size: 14px;
        gap: 8px;
    }

    .header-logo .material-icons {
        font-size: 20px;
    }
}
