/* ==========================================================================
   1. 共通設定 (Base)
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", sans-serif;
    color: #333;
    background-color: #f4f7f9;
    line-height: 1.6;
}

button {
    cursor: pointer;
    transition: all 0.2s;
}

/* ==========================================================================
   2. ログイン画面 (login.html)
   ========================================================================== */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #ffffff;
}

.login-container {
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    width: 100%;
    padding: 0 5%;
    gap: 50px;
}

.image-box {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 600px;
}

.image-box img {
    width: 100%;
    height: auto;
}

.login-box {
    flex: 0 1 400px;
    padding: 40px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.login-box h1 {
    font-size: 24px;
    margin-bottom: 24px;
    text-align: center;
}

/* ==========================================================================
   3. ホーム共通レイアウト (Sidebar & Header)
   ========================================================================== */
.home-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* サイドバー */
.sidebar {
    width: 260px;
    background-color: #2c3e50;
    color: #ecf0f1;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-logo {
    padding: 25px;
    font-size: 22px;
    font-weight: bold;
    background-color: #1a252f;
    text-align: center;
    letter-spacing: 1px;
}

.sidebar-nav ul {
    list-style: none;
    margin-top: 10px;
}

.sidebar-nav li a {
    display: block;
    padding: 15px 25px;
    color: #bdc3c7;
    text-decoration: none;
}

.sidebar-nav li.active a,
.sidebar-nav li a:hover {
    background-color: #34495e;
    color: #ffffff;
    border-left: 4px solid #3498db;
}

/* メインエリア */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background-color: #f4f7f9;
}

.main-header {
    height: 70px;
    background-color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    border-bottom: 1px solid #e0e0e0;
}

.logout-link {
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
}

/* ==========================================================================
   4. 共通コンポーネント (Cards, Buttons, Inputs)
   ========================================================================== */
.content-body {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.card {
    background: #ffffff;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 25px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.card h2 {
    font-size: 20px;
    margin-bottom: 20px;
    border-bottom: 2px solid #f4f7f9;
    padding-bottom: 10px;
}

/* ボタン */
.primary-button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: bold;
}

.primary-button:hover {
    background-color: #0056b3;
}

.secondary-button {
    background-color: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
    padding: 12px 24px;
    border-radius: 6px;
}

/* 共通入力スタイル */
input[type="text"], 
input[type="password"], 
select {
    width: 100%;
    padding: 12px;
    border: 1px solid #dcdcdc;
    border-radius: 8px;
    font-size: 16px;
}

/* ==========================================================================
   5. 蔵書登録画面用 (book_register.html)
   ========================================================================== */
.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    background: #eef2f5;
    padding: 20px;
    border-radius: 8px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.full-width {
    grid-column: span 2;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #555;
}

.form-actions {
    margin-top: 30px;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

.divider {
    border: 0;
    border-top: 1px solid #eee;
    margin: 40px 0;
}

/* ==========================================================================
   6. デジタル時計
   ========================================================================== */
.digital-clock {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #1a1a1a;
    color: #ffffff;
    padding: 12px 24px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 24px;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

/* ==========================================================================
   7. レスポンシブ
   ========================================================================== */
@media (max-width: 768px) {
    .image-box { display: none; }
    .sidebar { width: 70px; }
    .sidebar-logo, .sidebar-nav span { display: none; }
    .sidebar-nav li a { text-align: center; padding: 20px 0; }
    .form-grid { grid-template-columns: 1fr; }
    .full-width { grid-column: span 1; }
}

/* バーコードプレビューエリア */
.barcode-preview {
    background: #fff;
    padding: 20px;
    margin: 20px auto;
    display: inline-block;
    border: 1px solid #eee;
}

/* 印刷用設定 */
@media print {
    /* 印刷時はバーコードエリア以外すべて非表示 */
    body * {
        visibility: hidden;
    }
    #barcode-area, #barcode-area * {
        visibility: visible;
    }
    #barcode-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        box-shadow: none;
        border: none;
    }
    .form-actions {
        display: none;
    }
}