/* ========================================
   管理画面スタイル
======================================== */

/* フォーム拡張スタイル */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.image-upload-area {
    border: 2px dashed #ddd;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
    gap: 15px;
    overflow: visible;
}

.image-upload-area:hover {
    border-color: #2D5F3F;
    background: rgba(45, 95, 63, 0.05);
}

.image-upload-area input[type="file"] {
    display: none;
}

.upload-placeholder {
    pointer-events: auto;
    cursor: pointer;
    width: 100%;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed #ccc;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.7);
    margin-top: 10px;
}

.upload-placeholder p {
    margin: 0;
    color: #666;
    font-size: 16px;
}

.upload-preview {
    position: relative;
    max-width: 100%;
}

.upload-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.remove-image {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 複数画像プレビュー */
.multi-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
    max-width: 100%;
}

.preview-item {
    position: relative;
    flex: 0 0 calc(33.333% - 10px);
    min-width: 120px;
    max-width: 180px;
}

@media (max-width: 768px) {
    .preview-item {
        flex: 0 0 calc(50% - 8px);
        min-width: 100px;
        max-width: 150px;
    }
}

@media (max-width: 480px) {
    .preview-item {
        flex: 0 0 100%;
        max-width: 200px;
    }
}

.preview-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

@media (max-width: 480px) {
    .preview-item img {
        height: 120px;
    }
}

.preview-item .remove-image {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.preview-item .image-info {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
}

.remove-image:hover {
    background: #cc0000;
}

.tags-input-container {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    background: white;
}

.tags-input-container input {
    border: none;
    outline: none;
    width: 100%;
    padding: 5px 0;
    font-size: 14px;
}

.tags-display {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.tag-item {
    background: #2D5F3F;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tag-item .remove-tag {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
}

.tag-item .remove-tag:hover {
    color: #ffcccc;
}

/* 日付選択 */
.date-selector {
    display: flex;
    gap: 10px;
}

.date-selector select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

/* タグ選択 */
.tags-selector {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    background: white;
}

.available-tags {
    margin-bottom: 15px;
}

.available-tags::before {
    content: "利用可能なタグ:";
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
}

.tag-option {
    display: inline-block;
    background: #f5f5f5;
    color: #666;
    padding: 6px 12px;
    margin: 4px;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #ddd;
}

.tag-option:hover {
    background: #e8f5e9;
    border-color: #2D5F3F;
}

.tag-option.selected {
    background: #2D5F3F;
    color: white;
    border-color: #2D5F3F;
}

.selected-tags .tags-label {
    font-size: 12px;
    color: #666;
    margin: 0 0 10px 0;
}

/* アップロード進捗 */
.upload-progress {
    margin-top: 15px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2D5F3F, #5B9BD5);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 12px;
    color: #666;
}

.upload-status {
    position: absolute;
    bottom: -25px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 12px;
    padding: 5px;
    border-radius: 4px;
}

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

.upload-status.error {
    background: #f8d7da;
    color: #721c24;
}

.size-info {
    font-size: 11px;
    color: #999;
    font-weight: normal;
}

/* サイドバーユーザー情報 */
.user-info {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(255,255,255,0.1);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.user-info span {
    display: block;
    color: white;
    font-size: 12px;
    margin-bottom: 10px;
}

.btn-logout {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .image-upload-area {
        min-height: 150px;
        padding: 15px;
    }
    
    .upload-placeholder p {
        font-size: 14px;
    }
}

/* ログイン画面 */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #2D5F3F 0%, #5B9BD5 100%);
}

.login-container {
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

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

.login-logo img {
    width: 120px;
    height: auto;
    margin-bottom: 20px;
}

.login-logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: #2D5F3F;
    margin: 0;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #E5E5E5;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
    outline: none;
    border-color: #5B9BD5;
}

.user-type-label {
    display: inline-flex;
    align-items: center;
    margin-right: 20px;
    cursor: pointer;
    font-weight: normal !important;
}

.user-type-label input[type="radio"] {
    margin-right: 8px;
    width: auto;
}

.btn-login {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    font-weight: 600;
    margin-top: 10px;
}

.login-error {
    background-color: #ffebee;
    color: #c62828;
    padding: 10px;
    border-radius: 5px;
    margin-top: 15px;
    font-size: 14px;
    text-align: center;
}

/* ログアウトセクション */
.logout-section {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

#current-user {
    font-weight: 500;
    color: #2D5F3F;
}

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

body {
    font-family: 'Noto Sans JP', sans-serif;
    background-color: #F5F7FA;
    color: #333;
}

.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* サイドバー */
.admin-sidebar {
    width: 250px;
    background-color: #2C3E50;
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.admin-logo {
    padding: 30px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-logo h1 {
    font-size: 20px;
    font-weight: 700;
}

.admin-nav ul {
    list-style: none;
    padding: 20px 0;
}

.admin-nav .nav-item {
    display: block;
    padding: 15px 20px;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
    text-decoration: none;
}

.admin-nav .nav-item:hover,
.admin-nav .nav-item.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

/* メインコンテンツ */
.admin-main {
    flex: 1;
    margin-left: 250px;
    padding: 30px;
}

.admin-section {
    display: none;
    background-color: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.admin-section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #E5E7EB;
    padding-bottom: 20px;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: #2C3E50;
    flex: 1;
}

/* ボタン */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
}

.btn-danger:hover {
    background-color: #c0392b;
}

/* コンテンツリスト */
.content-list {
    margin-bottom: 30px;
}

.content-item {
    padding: 20px;
    border: 1px solid #E5E7EB;
    border-radius: 5px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.content-item:hover {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.content-info h3 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 5px;
}

.content-meta {
    display: flex;
    gap: 15px;
    font-size: 14px;
    color: #7f8c8d;
}

.content-actions {
    display: flex;
    gap: 10px;
}

/* フォーム */
.edit-form {
    background-color: #F8F9FA;
    padding: 30px;
    border-radius: 5px;
    margin-top: 30px;
}

.edit-form h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #2C3E50;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #495057;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #CED4DA;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 30px;
}

/* アラート */
.alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .admin-sidebar.active {
        transform: translateX(0);
    }
    
    .admin-main {
        margin-left: 0;
        padding: 20px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .content-item {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .content-actions {
        justify-content: flex-end;
    }
}