/**
 * OC-BOOK 管理画面 CSS
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

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

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

.login-box {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 28px;
    color: #2d5a87;
    margin-bottom: 8px;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

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

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="datetime-local"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2d5a87;
    box-shadow: 0 0 0 3px rgba(45, 90, 135, 0.1);
}

.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #888;
}

.form-group input[type="file"] {
    padding: 10px;
    background: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 8px;
    cursor: pointer;
}

.form-group input[type="color"] {
    width: 60px;
    height: 40px;
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

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

.required {
    color: #e53935;
}

/* ボタン */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary {
    background: #2d5a87;
    color: #fff;
}

.btn-primary:hover {
    background: #1a4068;
}

.btn-outline {
    background: transparent;
    border: 1px solid #ddd;
    color: #666;
}

.btn-outline:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.btn-danger {
    background: #e53935;
    color: #fff;
}

.btn-danger:hover {
    background: #c62828;
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

/* アラート */
.alert {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

/* ヘッダー */
.admin-header {
    background: #fff;
    border-bottom: 1px solid #eee;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left h1 {
    font-size: 20px;
    color: #2d5a87;
}

.header-left .back-link {
    color: #666;
    text-decoration: none;
    font-size: 14px;
}

.header-left .back-link:hover {
    color: #2d5a87;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-name {
    font-size: 14px;
    color: #666;
}

/* メインコンテンツ */
.admin-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h2 {
    font-size: 24px;
    color: #1a1a1a;
}

/* 空状態 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 12px;
    border: 2px dashed #ddd;
}

.empty-state p {
    color: #888;
    margin-bottom: 20px;
}

/* 書籍カード */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.book-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

.book-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.book-card-header h3 {
    font-size: 16px;
    color: #1a1a1a;
}

.book-card-body {
    padding: 20px;
}

.book-info {
    margin-bottom: 16px;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    margin-bottom: 6px;
}

.info-row .label {
    color: #888;
    min-width: 80px;
}

.info-row code {
    background: #f5f5f5;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.book-url {
    margin-top: 16px;
}

.book-url label {
    display: block;
    font-size: 12px;
    color: #888;
    margin-bottom: 6px;
}

.url-copy {
    display: flex;
    gap: 8px;
}

.url-copy input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    background: #f8f9fa;
}

.book-card-footer {
    padding: 16px 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* バッジ */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-success {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-warning {
    background: #fff3e0;
    color: #e65100;
}

.badge-info {
    background: #e3f2fd;
    color: #1565c0;
}

/* 編集フォーム */
.edit-form {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.form-section {
    padding: 24px;
    border-bottom: 1px solid #eee;
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h3 {
    font-size: 16px;
    color: #1a1a1a;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.form-actions {
    padding: 20px 24px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .admin-header {
        padding: 12px 16px;
    }

    .admin-main {
        padding: 16px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .books-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .book-card-footer {
        flex-wrap: wrap;
    }
}
