/* AI Article Generator - Admin Styles */

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --sidebar-width: 250px;
    --sidebar-bg: #2c3e50;
    --sidebar-text: #ecf0f1;
    --sidebar-hover: #34495e;
    --card-shadow: 0 2px 4px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

/* General Styles */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f7fa;
    color: #333;
}

/* Bootstrap Grid System */
.container {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

.col,
.col-md-3,
.col-md-4,
.col-md-6,
.col-md-8,
.col-md-12,
.col-lg-4,
.col-lg-8 {
    position: relative;
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
}

@media (min-width: 768px) {
    .col-md-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }
    
    .col-md-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
    
    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .col-md-8 {
        flex: 0 0 66.666667%;
        max-width: 66.666667%;
    }
    
    .col-md-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

@media (min-width: 992px) {
    .col-lg-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
    }
    
    .col-lg-8 {
        flex: 0 0 66.666667%;
        max-width: 66.666667%;
    }
}

/* Layout */
.d-flex {
    display: flex;
    min-height: 100vh;
}

.d-grid {
    display: grid;
}

.justify-content-between {
    justify-content: space-between;
}

.align-items-center {
    align-items: center;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: var(--transition);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-header h4 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.sidebar-header .text-muted {
    color: rgba(255,255,255,0.6);
}

.sidebar .nav {
    padding: 1rem 0;
}

.sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: var(--transition);
}

.sidebar .nav-link:hover {
    background-color: var(--sidebar-hover);
    color: #fff;
}

.sidebar .nav-link.active {
    background-color: var(--primary-color);
    color: #fff;
}

.sidebar .nav-link i {
    margin-right: 0.5rem;
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 2rem;
    min-height: 100vh;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
}

.page-header h1 i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

.page-header .text-muted {
    margin: 0;
    font-size: 1rem;
}

/* Cards */
.card {
    border: none;
    border-radius: 0.5rem;
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    height: 100%;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
    padding: 1rem 1.25rem;
}

.card-header h5 {
    margin: 0;
    font-size: 1.1rem;
}

.card-body {
    padding: 1.25rem;
}

/* Stat Cards */
.stat-card {
    border-left: 4px solid var(--primary-color);
    height: 100%;
}

.stat-card .card-body {
    padding: 1.5rem;
}

.stat-card h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
}

.stat-card h6 {
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

/* Forms */
.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-control,
.form-select {
    border-radius: 0.375rem;
    border: 1px solid #ced4da;
    padding: 0.5rem 0.75rem;
    transition: var(--transition);
    width: 100%;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

textarea.form-control {
    resize: vertical;
}

.form-check {
    margin-bottom: 0.5rem;
}

.form-check-input {
    margin-top: 0.3rem;
}

/* Buttons */
.btn {
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: var(--transition);
    display: inline-block;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background-color: transparent;
}

.btn-outline-success {
    color: #28a745;
    border-color: #28a745;
    background-color: transparent;
}

.btn-outline-danger {
    color: #dc3545;
    border-color: #dc3545;
    background-color: transparent;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.btn-group {
    display: inline-flex;
    vertical-align: middle;
}

.btn-group-sm > .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Preset Cards */
.preset-card {
    transition: var(--transition);
    height: 100%;
}

.preset-card:hover {
    transform: translateY(-2px);
}

.preset-info {
    font-size: 0.9rem;
}

.preset-info strong {
    color: #495057;
}

/* Tables */
.table {
    font-size: 0.95rem;
    width: 100%;
    margin-bottom: 1rem;
}

.table th {
    font-weight: 600;
    color: #495057;
    border-bottom-width: 2px;
}

.table-responsive {
    overflow-x: auto;
}

.table-hover tbody tr:hover {
    background-color: rgba(0,0,0,0.075);
}

/* Badges */
.badge {
    padding: 0.35em 0.65em;
    font-weight: 500;
    font-size: 0.75rem;
    border-radius: 0.25rem;
}

.bg-secondary {
    background-color: #6c757d !important;
}

.bg-success {
    background-color: #28a745 !important;
}

.bg-info {
    background-color: #17a2b8 !important;
}

.bg-warning {
    background-color: #ffc107 !important;
}

.bg-danger {
    background-color: #dc3545 !important;
}

/* Progress Bars */
.progress {
    background-color: #e9ecef;
    height: 8px;
    border-radius: 0.25rem;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

/* Modal */
.modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.modal-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

/* Image Generation Settings */
.image-generation-settings {
    background-color: #f0f8ff;
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #b8daff;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
}

/* Loading States */
.spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* Custom Scrollbar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.3s ease-out;
}

/* Settings Form */
.settings-form .card {
    margin-bottom: 1.5rem;
}

/* Alert Styles */
.alert {
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* Code/Monospace */
.font-monospace {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
}

/* Spacing Utilities */
.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-2 {
    margin-top: 0.5rem !important;
}

.mt-3 {
    margin-top: 1rem !important;
}

.mt-4 {
    margin-top: 1.5rem !important;
}

.me-2 {
    margin-right: 0.5rem !important;
}

.text-center {
    text-align: center !important;
}

.text-start {
    text-align: left !important;
}

.text-end {
    text-align: right !important;
}

.text-muted {
    color: #6c757d !important;
}

.text-danger {
    color: #dc3545 !important;
}

.text-success {
    color: #28a745 !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

.small {
    font-size: 0.875rem;
}

/* Width Utilities */
.w-100 {
    width: 100% !important;
}

/* Background Utilities */
.bg-primary {
    background-color: var(--primary-color) !important;
}

.bg-light {
    background-color: #f8f9fa !important;
}

.border-primary {
    border-color: var(--primary-color) !important;
}

/* Dashboard Specific */
.stat-card:nth-child(1) {
    border-left-color: var(--primary-color);
}

.stat-card:nth-child(2) {
    border-left-color: #28a745;
}

.stat-card:nth-child(3) {
    border-left-color: #17a2b8;
}

.stat-card:nth-child(4) {
    border-left-color: #ffc107;
}

/* Result Modal */
#resultContent h1,
#resultContent h2,
#resultContent h3 {
    color: #2c3e50;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

#resultContent p {
    line-height: 1.6;
    margin-bottom: 1rem;
}

#resultContent img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#resultContent figure {
    margin: 2rem 0;
    text-align: center;
}

#resultContent figcaption {
    margin-top: 0.5rem;
    color: #6c757d;
    font-size: 0.9rem;
}

/* Toast Container */
.toast-container {
    z-index: 9999;
}

/* Form Range */
.form-range {
    width: 100%;
    height: 0.25rem;
    background-color: #e9ecef;
    border-radius: 0.25rem;
}

.form-range::-webkit-slider-thumb {
    background: var(--primary-color);
}

.form-range::-moz-range-thumb {
    background: var(--primary-color);
}

/* Nav */
.nav {
    display: flex;
    flex-wrap: wrap;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
}

.nav-item {
    margin-bottom: 0;
}

.flex-column {
    flex-direction: column;
}

/* Card Footer */
.card-footer {
    padding: 0.75rem 1.25rem;
    background-color: rgba(0,0,0,0.03);
    border-top: 1px solid rgba(0,0,0,0.125);
}

/* 記事生成結果モーダルのスタイル修正 */

/* モーダル内の記事スタイル */
#resultContent, #historyContent {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
    line-height: 1.8;
    color: #333;
    font-size: 16px;
}

/* 見出しスタイル */
#resultContent h1, #historyContent h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 2rem 0 1.5rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid #667eea;
}

#resultContent h2, #historyContent h2 {
    font-size: 22px;
    font-weight: 600;
    color: #2c3e50;
    margin: 2rem 0 1rem 0;
    padding-left: 0.5rem;
    border-left: 4px solid #667eea;
}

#resultContent h3, #historyContent h3 {
    font-size: 18px;
    font-weight: 600;
    color: #34495e;
    margin: 1.5rem 0 0.75rem 0;
}

/* 段落スタイル */
#resultContent p, #historyContent p {
    margin-bottom: 1.2rem;
    text-align: justify;
}

/* リストスタイル */
#resultContent ul, #historyContent ul,
#resultContent ol, #historyContent ol {
    margin-bottom: 1.2rem;
    padding-left: 2rem;
}

#resultContent li, #historyContent li {
    margin-bottom: 0.5rem;
}

/* 画像コンテナ */
#resultContent figure, #historyContent figure {
    margin: 2rem 0;
    text-align: center;
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 0.5rem;
}

/* 画像スタイル - サイズを適切に制限 */
#resultContent img, #historyContent img {
    max-width: 100%;
    max-height: 400px; /* 最大高さを制限 */
    width: auto;
    height: auto;
    object-fit: contain; /* アスペクト比を保持 */
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
    display: block;
}

/* 小さい画面用の調整 */
@media (max-width: 768px) {
    #resultContent img, #historyContent img {
        max-height: 300px;
    }
}

/* 画像キャプション */
#resultContent figcaption, #historyContent figcaption {
    margin-top: 0.75rem;
    color: #6c757d;
    font-size: 14px;
    font-style: italic;
}

/* 強調テキスト */
#resultContent strong, #historyContent strong {
    font-weight: 600;
    color: #2c3e50;
}

/* 引用 */
#resultContent blockquote, #historyContent blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid #667eea;
    background-color: #f8f9fa;
    font-style: italic;
}

/* コード */
#resultContent code, #historyContent code {
    background-color: #f5f5f5;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

#resultContent pre, #historyContent pre {
    background-color: #f5f5f5;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}

/* テーブル */
#resultContent table, #historyContent table {
    width: 100%;
    margin: 1.5rem 0;
    border-collapse: collapse;
}

#resultContent th, #historyContent th,
#resultContent td, #historyContent td {
    padding: 0.75rem;
    border: 1px solid #dee2e6;
}

#resultContent th, #historyContent th {
    background-color: #f8f9fa;
    font-weight: 600;
}

/* メタデータアラート */
#resultContent .alert-info,
#historyContent .alert-info {
    margin-top: 2rem;
    border-radius: 0.5rem;
}

/* モーダル自体のスタイル調整 */
.modal-dialog.modal-xl {
    max-width: 1140px;
}

.modal-body {
    padding: 2rem;
    max-height: 80vh;
    overflow-y: auto;
}

/* スクロールバーのスタイル */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 区切り線 */
#resultContent hr, #historyContent hr {
    margin: 2rem 0;
    border: 0;
    border-top: 2px solid #e9ecef;
}

/* リンク */
#resultContent a, #historyContent a {
    color: #667eea;
    text-decoration: none;
}

#resultContent a:hover, #historyContent a:hover {
    text-decoration: underline;
}

/* レスポンシブ調整 */
@media (max-width: 768px) {
    #resultContent, #historyContent {
        font-size: 14px;
    }
    
    #resultContent h1, #historyContent h1 {
        font-size: 24px;
    }
    
    #resultContent h2, #historyContent h2 {
        font-size: 20px;
    }
    
    #resultContent h3, #historyContent h3 {
        font-size: 16px;
    }
    
    .modal-body {
        padding: 1rem;
    }
}