/* 業務システム用スタイル */
:root {
    --color-primary: #1a56db;
    --color-primary-hover: #1e40af;
    --color-danger: #dc2626;
    --color-success: #16a34a;
    --color-warning: #ca8a04;

    --color-text: #1f2937;
    --color-text-light: #6b7280;
    --color-border: #d1d5db;
    --color-bg: #f3f4f6;
    --color-white: #ffffff;

    --font-family: "Meiryo", "メイリオ", "Hiragino Kaku Gothic ProN", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-bg);
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family);
    font-weight: bold;
    color: var(--color-text);
    margin: 0 0 16px 0;
}

h3 a {
    color: inherit;
    text-decoration: none;
}

h3 a:hover {
    text-decoration: underline;
}

h3 { font-size: 18px; }
h4 { font-size: 16px; }

a {
    color: var(--color-primary);
    text-decoration: underline;
}

a:hover {
    color: var(--color-primary-hover);
}

/* Buttons */
.button, button, input[type='button'], input[type='reset'], input[type='submit'] {
    background: var(--color-primary);
    border: 1px solid var(--color-primary);
    color: white;
    padding: 8px 16px;
    font-size: 14px;
    font-family: var(--font-family);
    cursor: pointer;
    display: inline-block;
    text-decoration: none;
    line-height: 1.5;
}

.button:hover, button:hover, input[type='button']:hover,
input[type='reset']:hover, input[type='submit']:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    color: white;
}

/* Outline Button */
.button.button-outline {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.button.button-outline:hover {
    background: var(--color-bg);
    border-color: var(--color-text-light);
    color: var(--color-text);
}

/* Top Navigation */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1e3a5f;
    padding: 0 20px;
    height: 50px;
}

.top-nav-title a {
    font-size: 16px;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.top-nav-title span {
    color: #93c5fd;
}

.top-nav-links {
    display: flex;
    gap: 8px;
    align-items: center;
}

.top-nav-links a {
    color: white;
    text-decoration: none;
    padding: 8px 12px;
    font-size: 13px;
}

.top-nav-links a:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.top-nav-links .button-outline {
    border: 1px solid white;
    padding: 6px 12px;
    font-size: 13px;
    color: white;
    background: transparent;
}

.top-nav-links .button-outline:hover {
    background: white;
    color: #1e3a5f;
}

.top-nav-links .user-email {
    color: #fff;
    font-size: 14px;
    margin-right: 15px;
    display: flex;
    align-items: center;
}

/* Main Container */
.main {
    padding: 20px;
}

.container {
    max-width: none !important;
    width: 100% !important;
    margin: 0 auto;
}

/* Content Box */
.content {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    padding: 20px;
    margin-bottom: 20px;
}

.content h3, .related h4, .related h3 {
    border-bottom: 2px solid #1e3a5f;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    width: 100%;
    box-sizing: border-box;
    padding-bottom: 4px;
    margin-bottom: 20px;
}

/* 見出し内のテキストとボタンを横並びにするスタイルを簡略化 */
.content h3 > a,
.related h4 > a,
.related h3 > a {
    /* floatは不要 */
}

.header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.content h3 a, .related h4 a {
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-white);
}

th, td {
    border: 1px solid var(--color-border);
    padding: 10px 12px;
    text-align: left;
    font-size: 13px;
}

thead th {
    background: #e5e7eb;
    font-weight: bold;
    color: var(--color-text);
    white-space: nowrap;
}

tbody tr:nth-child(even) {
    background: #f9fafb;
}

tbody tr:hover {
    background: #fef3c7;
}

.side-nav {
    display: none;
}

.side-nav .heading {
    font-size: 14px;
    font-weight: bold;
    color: var(--color-text);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}

.side-nav-item {
    display: block;
    padding: 8px 0;
    color: var(--color-primary);
    font-size: 13px;
}

.side-nav-item:hover {
    color: var(--color-primary-hover);
}

/* Actions */
.actions {
    white-space: nowrap;
}

.actions a {
    margin-right: 8px;
    font-size: 13px;
}

.float-right {
    float: right;
    margin-bottom: 0;
}

/* Related sections */
.related {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
    width: 100%;
}

.related h4 {
    margin-bottom: 12px;
}

/* View page */
.view.content table {
    width: 100%;
}

.view.content {
    width: 100%;
}

.view.content th {
    background: #f3f4f6;
    width: 150px;
    font-weight: bold;
}

.text {
    margin-top: 16px;
    padding: 12px;
    background: #f9fafb;
    border: 1px solid var(--color-border);
}

.text strong {
    display: block;
    font-size: 13px;
    color: var(--color-text-light);
    margin-bottom: 8px;
}

blockquote {
    margin: 0;
    padding: 0;
}

/* Flash Messages */
.message {
    padding: 12px 16px;
    margin-bottom: 16px;
    border: 1px solid;
    font-size: 13px;
}

.message.success {
    background: #dcfce7;
    color: #166534;
    border-color: #16a34a;
}

.message.warning {
    background: #fef9c3;
    color: #854d0e;
    border-color: #ca8a04;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border-color: #dc2626;
}

.message.info, .message {
    background: #dbeafe;
    color: #1e40af;
    border-color: #3b82f6;
}

/* Paginator */
.paginator {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
}

.pagination li {
    margin: 0;
}

.pagination a {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid var(--color-border);
    background: var(--color-white);
    color: var(--color-primary);
    font-size: 13px;
    text-decoration: none;
}

.pagination a:hover {
    background: #e5e7eb;
    color: var(--color-primary-hover);
}

.pagination li.active a {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.pagination .disabled a {
    color: #9ca3af;
    cursor: not-allowed;
}

.paginator p {
    text-align: center;
    font-size: 13px;
    color: var(--color-text-light);
}

/* Forms */
.input {
    margin-bottom: 16px;
}

/* ログイン画面以外のコンテンツを100%幅にする */
.content:not(.users.form),
.index.content {
    width: 100%;
}

/* ログイン画面のスタイル（中央寄せ・幅制限） */
.users.form.content {
    max-width: 500px;
    margin: 40px auto;
}

.input label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    color: var(--color-text);
    margin-bottom: 4px;
}

.input input,
.input select,
.input textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--color-border);
    font-size: 14px;
    font-family: var(--font-family);
}

.input input:focus,
.input select:focus,
.input textarea:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: -1px;
}

.error-message {
    color: var(--color-danger);
    font-size: 12px;
    margin-top: 4px;
}

/* Grid layout */
.row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.column {
    flex: 1;
    min-width: 200px;
}

.column-responsive {
    flex: 1;
    min-width: 300px;
}

aside.column {
    flex: 0 0 220px;
    min-width: 220px;
}

/* Sort indicators */
th a {
    color: var(--color-text);
    text-decoration: none;
}

th a:hover {
    text-decoration: underline;
}

.asc:after {
    content: " ▼";
    font-size: 10px;
}

.desc:after {
    content: " ▲";
    font-size: 10px;
}

/* Error pages */
.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
}

/* Column sizes */
.column-80 {
    flex: 1;
    min-width: 300px;
}

/* Fieldset and Legend */
fieldset {
    border: 1px solid var(--color-border);
    padding: 20px;
    margin: 0 0 16px 0;
    background: var(--color-white);
}

legend {
    display: none; /* 見出しをh3に置き換えたため非表示 */
}

/* Horizontal Rule */
hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 20px 0;
}

/* QR Code Entry */
.qrcode-entry {
    background: #f9fafb;
    border: 1px solid var(--color-border);
    padding: 16px;
    margin-bottom: 12px;
}

.qrcode-entry:last-child {
    margin-bottom: 0;
}

/* Checkbox and Radio */
.input input[type='checkbox'],
.input input[type='radio'] {
    width: auto;
    margin-right: 8px;
}

.input label:has(input[type='checkbox']),
.input label:has(input[type='radio']) {
    display: inline-flex;
    align-items: center;
    font-weight: normal;
}

/* Hidden elements */
.message.hidden {
    display: none;
}

/* Delete link style */
.side-nav-item.delete,
a.delete {
    color: var(--color-danger);
}

.side-nav-item.delete:hover,
a.delete:hover {
    color: #b91c1c;
}

/* Post link (form submission link) */
form[style*="display:none"] + a,
.side-nav form {
    display: inline;
}

.side-nav form button {
    background: none;
    border: none;
    color: var(--color-danger);
    padding: 8px 0;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
}

.side-nav form button:hover {
    color: #b91c1c;
}

/* Error page */
.error-container h2 {
    font-size: 24px;
    margin-bottom: 16px;
}

.error-container .error {
    margin-bottom: 20px;
}

/* Header actions layout */
.header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.header-actions .button {
    white-space: nowrap;
}

/* Text overflow handling for table cells */
td.truncate {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Allow wrapping for description columns */
td.allow-wrap {
    white-space: normal;
    word-break: break-word;
}

/* Form inputs in tables */
table .input {
    margin-bottom: 0;
}

table .input input,
table .input select {
    min-width: 120px;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .row {
        flex-direction: column;
        gap: 0;
    }

    aside.column {
        flex: 1;
        min-width: 0;
    }

    .column, .column-responsive, .column-80 {
        min-width: 0;
    }

    .float-right {
        float: none;
        display: block;
        margin-bottom: 16px;
    }

    .top-nav {
        flex-direction: column;
        height: auto;
        padding: 12px;
        gap: 8px;
    }
}
