/* 業務ツール向け共通スタイル */

:root {
    /* 業務ツール向けカラーパレット */
    --primary-color: #6A8EAE;        /* くすみブルー（メイン） */
    --primary-dark: #5a7a96;         /* ダークブルー（ホバー時） */
    --secondary-color: #8FA3B8;      /* ライトブルー（サブ） */
    --accent-color: #2980b9;         /* アクセント（ボタンなど） */
    --accent-dark: #1f6391;          /* アクセントダーク */
    --success-color: #27ae60;        /* 成功（緑） */
    --success-dark: #1e8449;         /* 成功ダーク */
    --warning-color: #f39c12;        /* 警告（オレンジ） */
    --danger-color: #e74c3c;         /* 危険（赤） */
    
    /* 背景色・テキスト色 */
    --bg-light: #f8f9fa;            /* 軽い背景 */
    --bg-white: #ffffff;             /* 白背景 */
    --bg-gray: #e9ecef;              /* グレー背景 */
    --text-primary: #2c3e50;         /* メインテキスト */
    --text-secondary: #6c757d;       /* サブテキスト */
    --text-muted: #95a5a6;           /* ミューテッドテキスト */
    
    /* ボーダー・シャドウ */
    --border-color: #dee2e6;         /* ボーダー */
    --shadow-light: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-medium: 0 4px 12px rgba(0,0,0,0.15);
}

/* ベーススタイル */
body {
    font-family: "Meiryo", "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    padding: 0;
}

/* コンテナ・レイアウト */
.main-container {
    background: var(--bg-white);
    min-height: 100vh;
    padding: 0;
}

.content-wrapper {
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow-light);
    margin-bottom: 2rem;
    overflow: hidden;
}

/* ヘッダースタイル */
.header-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 1.5rem 2rem;
    margin-bottom: 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-primary h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    flex: 1;
    min-width: 200px;
}

.header-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ボタンスタイル */
.btn {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    border: none;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 0.875rem;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-dark);
    color: white;
    text-decoration: none;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: var(--success-dark);
    color: white;
    text-decoration: none;
}

.btn-outline-light {
    background-color: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: white;
    text-decoration: none;
}

.btn-outline-primary {
    background-color: transparent;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
}

.btn-outline-primary:hover {
    background-color: var(--accent-color);
    color: white;
    text-decoration: none;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

/* テーブルスタイル */
.table {
    width: 100%;
    margin-bottom: 1rem;
    background-color: transparent;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem;
    vertical-align: top;
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.table thead th {
    background-color: var(--primary-color);
    color: white;
    border: none;
    font-weight: 600;
    text-align: left;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

.table-hover tbody tr:hover {
    background-color: rgba(106, 142, 174, 0.1);
}

.table-responsive {
    overflow-x: auto;
    min-height: 0.01%;
}

/* ステータスバッジ */
.status-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
}

.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-processing {
    background-color: #cce5ff;
    color: #004085;
}

.status-error {
    background-color: #f8d7da;
    color: #721c24;
}

.status-completed {
    background-color: #d4edda;
    color: #155724;
}

/* カード・インフォ */
.info-card {
    background: var(--bg-light);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.info-card h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.info-card .table {
    margin-bottom: 0;
}

.info-card .table td,
.info-card .table th {
    padding: 0.5rem 0;
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.info-card .table th {
    background: none;
    color: var(--text-secondary);
    font-weight: 600;
    width: 120px;
}

/* アラート・メッセージ */
.alert {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 4px;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeaa7;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

/* ユーザー情報 */
.user-info-section {
    background: var(--bg-gray);
    padding: 1rem;
    border-radius: 6px;
    margin-top: 2rem;
}

.user-info-section h5 {
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

/* グリッドレイアウト */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

.col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding-right: 15px;
    padding-left: 15px;
}

.col-12 {
    flex: 0 0 100%;
    max-width: 100%;
    padding-right: 15px;
    padding-left: 15px;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .header-primary {
        padding: 1rem;
    }
    
    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .header-primary h1 {
        font-size: 1.25rem;
        text-align: center;
        min-width: auto;
        flex: none;
    }
    
    .header-title {
        display: block;
    }
    
    .header-controls {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
        margin-top: 0;
    }
    
    .header-controls .btn {
        text-align: center;
        width: 100%;
        justify-content: center;
        display: flex;
        align-items: center;
    }
    
    .btn-sm {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
    
    /* モバイル用テーブルスタイル */
    .table-responsive {
        border: none;
    }
    
    .mobile-table {
        display: none;
    }
    
    .table thead {
        display: none;
    }
    
    .table tbody tr {
        display: block;
        background: var(--bg-white);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        margin-bottom: 1rem;
        padding: 1rem;
        box-shadow: var(--shadow-light);
    }
    
    .table tbody tr:hover {
        background: var(--bg-white);
        box-shadow: var(--shadow-medium);
    }
    
    .table tbody td {
        display: block;
        border: none;
        padding: 0.25rem 0;
        text-align: left !important;
        position: relative;
        padding-left: 35%;
        font-size: 0.875rem;
    }
    
    .table tbody td:before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 30%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 600;
        color: var(--text-secondary);
        font-size: 0.8rem;
    }
    
    .table tbody td:first-child {
        border-top: none;
        font-weight: bold;
        color: var(--primary-color);
        margin-bottom: 0.5rem;
        padding-left: 0;
        font-size: 1rem;
    }
    
    .table tbody td:first-child:before {
        display: none;
    }
    
    .info-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .info-card h4 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .p-4 {
        padding: 1rem !important;
    }
}

/* 超小画面（480px以下）用の追加調整 */
@media (max-width: 480px) {
    body {
        font-size: 13px;
    }
    
    .header-primary {
        padding: 0.75rem;
    }
    
    .header-primary h1 {
        font-size: 1rem;
    }
    
    .header-title {
        font-size: 0.9rem;
    }
    
    .btn-text {
        display: none;
    }
    
    .header-controls .btn {
        padding: 0.5rem;
        font-size: 1rem;
    }
    
    .table tbody td {
        padding-left: 40%;
        font-size: 0.8rem;
    }
    
    .table tbody td:before {
        width: 35%;
        font-size: 0.75rem;
    }
    
    .status-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
    }
    
    .btn-sm {
        font-size: 0.7rem;
        padding: 0.4rem 0.6rem;
    }
}

/* ユーティリティクラス */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted) !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.p-4 { padding: 1.5rem !important; }

.d-flex { display: flex !important; }
.justify-content-between { justify-content: space-between !important; }
.align-items-center { align-items: center !important; }

/* アイコンとテキストの間隔 */
.me-1 { margin-right: 0.25rem !important; }
.me-2 { margin-right: 0.5rem !important; }

/* フォームスタイル */
.form-group {
    margin-bottom: 1rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    color: var(--text-primary);
    background-color: var(--bg-white);
    border-color: var(--accent-color);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(41, 128, 185, 0.25);
}

.form-floating {
    position: relative;
    margin-bottom: 1rem;
}

.form-floating > .form-control {
    padding: 1rem 0.75rem;
}

.form-floating > label {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    padding: 1rem 0.75rem;
    pointer-events: none;
    border: 1px solid transparent;
    transform-origin: 0 0;
    transition: opacity 0.1s ease-in-out, transform 0.1s ease-in-out;
    color: var(--text-muted);
}

.form-select {
    display: block;
    width: 100%;
    padding: 0.5rem 2.25rem 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-check {
    display: block;
    min-height: 1.5rem;
    padding-left: 1.5em;
    margin-bottom: 0.125rem;
}

.form-check-input {
    width: 1em;
    height: 1em;
    margin-top: 0.25em;
    margin-left: -1.5em;
    vertical-align: top;
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 0.25em;
}

.form-check-label {
    color: var(--text-primary);
}

/* 空状態表示 */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* ローディング・スピナー */
.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}