/* ベーススタイル */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    margin: 0;
    padding: 0.75rem;
    max-width: 1600px;
    margin: 0 auto;
}

/* 更新日時 */
body > p {
    background: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

/* 図書館セクション */
.library-section {
    margin-bottom: 1.5rem;
}

.library-section h2 {
    font-size: 1.5rem;
    margin: 0 0 0.75rem 0;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* テーブルコンテナ（横並び） */
.tables-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.table-wrapper {
    min-width: 0; /* グリッドオーバーフロー防止 */
}

/* テーブル共通スタイル */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    font-size: 0.9rem;
}

caption {
    font-size: 1.1rem;
    font-weight: bold;
    padding: 0.75rem 1rem;
    background: #2c3e50;
    color: white;
    text-align: left;
}

thead {
    background: #34495e;
    color: white;
}

th {
    padding: 0.6rem 0.5rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
}

td {
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.85rem;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* 列幅の最適化 */
th.number, td.number {
    width: 50px;
    text-align: center;
}

th.renewable, td.renewable,
th.ready, td.ready {
    width: 60px;
    text-align: center;
}

th.name, td.name {
    width: auto;
    min-width: 120px;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

th.returnDate, td.returnDate,
th.researvingDueDate, td.researvingDueDate {
    width: 105px;
    white-space: nowrap;
    font-size: 0.8rem;
}

th.order, td.order {
    width: 70px;
    text-align: center;
}

/* カレンダー */
.flex {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1.5rem 0 0 0;
}

.calender {
    flex: 1;
    min-width: 300px;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.calender h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1.3rem;
    color: #2c3e50;
}

.calender table {
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.calender caption {
    background: #3498db;
    font-size: 1rem;
    padding: 0.6rem;
}

.calender th {
    background-color: #ecf0f1;
    color: #2c3e50;
    padding: 0.4rem;
    font-size: 0.8rem;
}

.calender td {
    text-align: center;
    padding: 0.4rem;
    min-width: 32px;
}

.calender td .note {
    display: block;
    font-size: 0.7rem;
    color: #666;
    margin-top: 0.2rem;
}

.calender .red {
    color: #e74c3c;
    font-weight: bold;
}

.calender .blue1 {
    color: #3498db;
}

.holiday {
    background-color: #ffebee;
}

.calender td.dtype1 {
    background-color: #ffcdd2;
    font-weight: bold;
}

.calender td.close {
    color: #c0392b;
    font-weight: bold;
    background-color: #ffebee;
}

/* データなし表示 */
td[colspan] {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 1.5rem;
}

/* レスポンシブ対応 */
@media (max-width: 1200px) {
    .tables-container {
        grid-template-columns: 1fr;
    }
    
    th.name, td.name {
        max-width: none;
    }
}

@media (max-width: 768px) {
    body {
        padding: 0.5rem;
    }
    
    .library-section h2 {
        font-size: 1.25rem;
        padding: 0.6rem 0.75rem;
    }
    
    /* テーブルを横スクロール可能に */
    .table-wrapper {
        overflow-x: auto;
    }
    
    table {
        font-size: 0.85rem;
        min-width: 500px;
    }
    
    caption {
        font-size: 1rem;
        padding: 0.6rem 0.75rem;
    }
    
    th, td {
        padding: 0.5rem 0.4rem;
        font-size: 0.8rem;
    }
    
    th.name, td.name {
        min-width: 120px;
    }
    
    th.returnDate, td.returnDate,
    th.researvingDueDate, td.researvingDueDate {
        width: 95px;
        font-size: 0.75rem;
    }
    
    .flex {
        flex-direction: column;
    }
    
    .calender {
        padding: 0.75rem;
    }
    
    .calender h3 {
        font-size: 1.15rem;
    }
    
    .calender table {
        font-size: 0.75rem;
    }
    
    .calender td {
        padding: 0.35rem;
        min-width: 28px;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    body > p {
        font-size: 0.85rem;
        padding: 0.6rem 0.75rem;
    }
    
    .library-section h2 {
        font-size: 1.1rem;
        padding: 0.5rem 0.6rem;
    }
    
    table {
        font-size: 0.75rem;
        min-width: 450px;
    }
    
    caption {
        font-size: 0.9rem;
        padding: 0.5rem 0.6rem;
    }
    
    th, td {
        padding: 0.4rem 0.3rem;
    }
    
    th.number, td.number {
        width: 40px;
    }
    
    th.order, td.order {
        width: 55px;
    }
    
    th.renewable, td.renewable,
    th.ready, td.ready {
        width: 50px;
    }
    
    th.returnDate, td.returnDate,
    th.researvingDueDate, td.researvingDueDate {
        font-size: 0.7rem;
    }
}
