/* Admin Panel Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-form {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-form h1 {
    text-align: center;
    color: #0066cc;
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
}

.login-form h2 {
    text-align: center;
    color: #666;
    margin-bottom: 2rem;
    font-size: 1.2rem;
    font-weight: 400;
}

/* Admin Layout */
.admin-container {
    display: flex;
    min-height: 100vh;
}

.admin-nav {
    width: 280px;
    background: #2c3e50;
    color: white;
    padding: 1.5rem 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.nav-brand {
    padding: 0 1.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid #34495e;
    padding-bottom: 1rem;
}

.nav-brand h2 {
    color: #0066cc;
    font-size: 1.4rem;
}

.nav-brand small {
    color: #bdc3c7;
    font-size: 0.9rem;
}

.nav-menu {
    list-style: none;
    margin-bottom: 2rem;
}

.nav-menu li {
    margin-bottom: 0.5rem;
}

.nav-menu a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: #bdc3c7;
    text-decoration: none;
    transition: all 0.3s ease;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: #34495e;
    color: white;
    border-right: 3px solid #0066cc;
}

.nav-user {
    position: absolute;
    bottom: 1rem;
    left: 0;
    right: 0;
    padding: 0 1.5rem;
    border-top: 1px solid #34495e;
    padding-top: 1rem;
}

.nav-user span {
    display: block;
    color: #bdc3c7;
    margin-bottom: 0.5rem;
}

.nav-user a {
    display: block;
    margin-bottom: 0.5rem;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.password-btn {
    color: #3498db;
}

.password-btn:hover {
    color: #2980b9;
    text-decoration: underline;
}

.logout-btn {
    color: #e74c3c;
}

.logout-btn:hover {
    color: #c0392b;
    text-decoration: underline;
}

/* Main Content */
.admin-main {
    flex: 1;
    margin-left: 280px;
    padding: 2rem;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #ddd;
}

.admin-header h1 {
    color: #2c3e50;
    font-size: 1.8rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0,102,204,0.2);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #666;
    font-size: 0.9rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.3s ease;
    font-weight: 500;
}

.btn-primary {
    background: #0066cc;
    color: white;
}

.btn-primary:hover {
    background: #0052a3;
}

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

.btn-secondary:hover {
    background: #545b62;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

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

.btn-light {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
}

.btn-light:hover {
    background: #e2e6ea;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.login-btn {
    width: 100%;
    background: #0066cc;
    color: white;
    padding: 0.875rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.login-btn:hover {
    background: #0052a3;
}

/* Messages */
.success-message,
.error-message {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

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

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

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h3 {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #0066cc;
}

/* Recent Uploads */
.recent-uploads {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.recent-uploads h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
}

.recent-uploads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.recent-upload-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border: 1px solid #eee;
    border-radius: 4px;
}

.recent-upload-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.recent-upload-info h4 {
    margin-bottom: 0.25rem;
    color: #333;
}

.recent-upload-info p {
    color: #666;
    font-size: 0.9rem;
}

.recent-upload-info small {
    color: #999;
    font-size: 0.8rem;
}

/* Tables */
.categories-table {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.categories-table table {
    width: 100%;
    border-collapse: collapse;
}

.categories-table th,
.categories-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.categories-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.categories-table tr:hover {
    background: #f8f9fa;
}

/* Image Grid */
.images-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Large screens - 6 columns */
@media (min-width: 1400px) {
    .images-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* Medium screens - 4 columns */
@media (max-width: 1200px) {
    .images-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.image-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s ease;
}

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

.image-thumbnail {
    height: 160px;
    overflow: hidden;
}

.image-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-info {
    padding: 1rem;
}

.image-info h3 {
    margin-bottom: 0.5rem;
    color: #333;
}

.image-info .category {
    color: #0066cc;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.image-info .date {
    color: #999;
    font-size: 0.8rem;
}

.image-actions {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid #eee;
}

/* Filter */
.filter-section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.filter-form {
    display: flex;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group select,
.filter-group input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.results-info {
    margin-bottom: 1rem;
    color: #666;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    background: white;
    color: #333;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.pagination-btn:hover,
.pagination-btn.active {
    background: #0066cc;
    color: white;
    border-color: #0066cc;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #000;
}

/* Upload Form */
.upload-form {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Password Form */
.password-form-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-width: 500px;
    margin-bottom: 2rem;
}

.password-form .form-group {
    margin-bottom: 1.5rem;
}

.password-tips {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #0066cc;
    max-width: 500px;
}

.password-tips h3 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.password-tips ul {
    margin: 0;
    padding-left: 1.5rem;
}

.password-tips li {
    margin-bottom: 0.5rem;
    color: #666;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 3rem;
    color: #666;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .admin-nav {
        width: 100%;
        height: auto;
        position: relative;
    }
    
    .admin-main {
        margin-left: 0;
        padding: 1rem;
    }
    
    .admin-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .filter-form {
        flex-direction: column;
    }
    
    .filter-group {
        min-width: auto;
    }
    
    .images-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .recent-uploads-grid {
        grid-template-columns: 1fr;
    }
    
    .image-actions {
        flex-wrap: wrap;
    }
    
    .modal-content {
        margin: 10% auto;
        width: 95%;
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .admin-main {
        padding: 0.5rem;
    }
    
    .login-form {
        padding: 1.5rem;
    }
    
    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .nav-menu a {
        padding: 0.6rem 1rem;
    }
    
    .images-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .image-thumbnail {
        height: 120px;
    }
}

/* 一括選択・削除機能 */
.bulk-select-all {
    margin-bottom: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.bulk-select-all label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    margin: 0;
}

.bulk-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: #e7f3ff;
    border-radius: 4px;
    border: 1px solid #b3d9ff;
}

.bulk-actions button {
    margin: 0;
}

#selectedCount {
    font-weight: 500;
    color: #0066cc;
}

.image-card {
    position: relative;
}

.image-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    padding: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.image-card.selected {
    border: 2px solid #0066cc;
    transform: scale(0.98);
}

/* チェックボックスの見た目改善 */
.image-select, #selectAll {
    accent-color: #0066cc;
}

/* バルクアクションのレスポンシブ対応 */
@media (max-width: 768px) {
    .bulk-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .bulk-actions button {
        width: 100%;
    }
}

/* Upload Progress Styles */
.upload-progress {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.progress-header h3 {
    color: #0066cc;
    margin: 0;
}

.progress-bar-container {
    margin-bottom: 1rem;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 10px;
}

.progress-text {
    text-align: center;
    margin-top: 0.5rem;
    font-weight: 500;
    color: #333;
}

.progress-current-file {
    background: #f8f9fa;
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border-left: 4px solid #0066cc;
}

.progress-summary {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
}

.success-count {
    color: #28a745;
    font-weight: 500;
}

.error-count {
    color: #dc3545;
    font-weight: 500;
}

.upload-results {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1rem;
    background: #fafafa;
}

.upload-results h4 {
    margin-bottom: 1rem;
    color: #333;
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.5rem;
}

.result-item {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-item.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.result-item.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
}

.result-item .success {
    color: #28a745;
    font-weight: bold;
}

.result-item .error {
    color: #dc3545;
    font-weight: bold;
}

.file-list {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.file-item {
    padding: 0.25rem 0;
    font-size: 0.9rem;
    color: #666;
}

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

.btn-danger {
    background: #dc3545;
    color: white;
    border: 1px solid #dc3545;
}

.btn-danger:hover {
    background: #c82333;
    border-color: #bd2130;
}

/* 進捗表示のレスポンシブ対応 */
@media (max-width: 768px) {
    .progress-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .progress-summary {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .upload-results {
        max-height: 200px;
    }
    
    .upload-progress {
        padding: 1rem;
    }
}