/* Dashboard CSS */
.dashboard-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.login-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    padding: 40px;
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.login-container h1 {
    color: #333;
    margin-bottom: 30px;
    font-size: 28px;
}

.login-form-container {
    text-align: left;
}

.login-form-container h2 {
    color: #555;
    margin-bottom: 20px;
    font-size: 20px;
}

/* Authentication Tabs */
.auth-tabs {
    display: flex;
    margin-bottom: 30px;
    background: #f8f9fa;
    border-radius: 10px;
    overflow: hidden;
}

.auth-tab {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
}

.auth-tab:hover {
    background: #e9ecef;
}

.auth-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Authentication Form Containers */
.auth-form-container {
    display: none;
    text-align: left;
}

.auth-form-container.active {
    display: block;
}

.auth-form-container h2 {
    color: #555;
    margin-bottom: 25px;
    font-size: 20px;
    text-align: center;
}

/* Authentication Error Messages */
.auth-error {
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 15px;
    display: none;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.auth-error.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.auth-error.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.auth-error i {
    font-size: 16px;
}

.auth-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 12px;
    color: #888;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.login-btn:hover {
    transform: translateY(-2px);
}

.login-footer {
    margin-top: 20px;
    color: #666;
}

.login-footer a {
    color: #667eea;
    text-decoration: none;
}

.login-footer a:hover {
    text-decoration: underline;
}

.login-error {
    color: #e74c3c;
    margin-top: 10px;
    padding: 10px;
    background: #fdf2f2;
    border-radius: 5px;
    border: 1px solid #e74c3c;
}

/* Dashboard Content */
.dashboard-header {
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px 0;
    margin-bottom: 30px;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    color: #333;
    margin: 0;
    font-size: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logout-btn {
    padding: 8px 16px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.logout-btn:hover {
    background: #c0392b;
}

/* Stats Section */
.stats-section {
    max-width: 1200px;
    margin: 0 auto 30px;
    padding: 0 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card i {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 15px;
}

.stat-card h3 {
    color: #555;
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
}

.stat-card p {
    color: #333;
    font-size: 2em;
    font-weight: bold;
    margin: 0;
}

/* Navigation Section */
.navigation-section {
    max-width: 1200px;
    margin: 0 auto 30px;
    padding: 0 20px;
}

.nav-tabs {
    display: flex;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.nav-tab {
    flex: 1;
    padding: 15px 20px;
    background: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.nav-tab:hover {
    background: #f8f9fa;
    color: #333;
}

.nav-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.nav-tab i {
    font-size: 18px;
}

/* View Content */
.view-content {
    display: none;
}

.view-content.active {
    display: block;
}

/* Filters Section */
.filters-section {
    max-width: 1200px;
    margin: 0 auto 30px;
    padding: 0 20px;
}

.filters {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filters input,
.filters select {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
}

.filters input {
    flex: 1;
    min-width: 200px;
}

.filters input:focus,
.filters select:focus {
    outline: none;
    border-color: #667eea;
}

.filters .btn {
    margin-left: auto;
}

/* Upload Section */
.upload-section {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.upload-section h2 {
    color: #333;
    margin-bottom: 30px;
    text-align: center;
    font-size: 28px;
}

.upload-form {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="file"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.file-info {
    font-size: 12px;
    color: #888;
    margin-top: 5px;
}

/* Checkbox Styling */
.checkbox-group {
    margin-bottom: 25px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    margin-bottom: 5px;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    margin-right: 10px;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: #667eea;
    border-color: #667eea;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 12px;
}

.checkbox-help {
    font-size: 12px;
    color: #888;
    margin-left: 30px;
}

/* Upload Preview */
.upload-preview {
    margin: 20px 0;
    text-align: center;
}

.upload-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.upload-submit-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    padding: 12px 30px;
    font-size: 16px;
}

.upload-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

/* Gallery Section */
.gallery-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.gallery-section h2 {
    color: #333;
    margin-bottom: 30px;
    text-align: center;
    font-size: 28px;
}

.gallery-controls {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group label {
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

.filter-group select {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: white;
    min-width: 120px;
}

.gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.gallery-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.no-gallery-items {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-gallery-items i {
    font-size: 4em;
    margin-bottom: 20px;
    color: #ccc;
}

.no-gallery-items p {
    font-size: 18px;
    margin-bottom: 20px;
}

/* Gallery Item Cards */
.gallery-item {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-5px);
}

.gallery-item-image {
    height: 200px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.gallery-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item-info {
    padding: 20px;
}

.gallery-item-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #333;
}

.gallery-item-meta {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
}

.gallery-item-scores {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.gallery-score-badge {
    padding: 4px 8px;
    background: #e9ecef;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    color: #495057;
}

.gallery-item-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 10px;
}

/* Upload Status Messages */
.upload-status {
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.upload-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.upload-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.upload-status i {
    font-size: 16px;
}

/* Preview Container */
.preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 10px;
    max-width: 100%;
    overflow: hidden;
}

.preview-image {
    max-width: 100%;
    max-height: 300px;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    object-fit: contain;
}

.preview-info {
    margin-top: 10px;
    font-size: 14px;
    color: #666;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .nav-tabs {
        flex-direction: column;
    }
    
    .nav-tab {
        border-bottom: 1px solid #e0e0e0;
    }
    
    .nav-tab:last-child {
        border-bottom: none;
    }
    
    .filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .gallery-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .upload-form {
        padding: 20px;
    }
}

/* Quilts Section */
.quilts-section {
    max-width: 1200px;
    margin: 0 auto 30px;
    padding: 0 20px;
}

.quilts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.quilt-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.quilt-card:hover {
    transform: translateY(-5px);
}

.quilt-image {
    height: 200px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.quilt-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.quilt-image-placeholder {
    color: #ccc;
    text-align: center;
}

.quilt-info {
    padding: 20px;
}

.quilt-title {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 18px;
    font-weight: 600;
}

.quilt-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 14px;
    color: #666;
}

.quilt-status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-pending { background: #fff3cd; color: #856404; }
.status-processing { background: #cce5ff; color: #004085; }
.status-completed { background: #d4edda; color: #155724; }
.status-failed { background: #f8d7da; color: #721c24; }

.quilt-scores {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.score-badge {
    padding: 4px 8px;
    background: #e9ecef;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    color: #495057;
}

.quilt-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.quilt-actions .btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 5px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

/* Loading and No Quilts */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading i {
    font-size: 2em;
    margin-bottom: 10px;
}

.no-quilts {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.no-quilts i {
    font-size: 4em;
    margin-bottom: 20px;
    color: #ccc;
}

.no-quilts p {
    font-size: 18px;
    margin-bottom: 20px;
}

.no-quilts a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.no-quilts a:hover {
    text-decoration: underline;
}

/* Pagination */
.pagination-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.pagination-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.pagination-info span {
    color: #666;
    font-weight: 500;
}

.pagination-info button {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.pagination-info button:hover:not(:disabled) {
    background: #5a6fd8;
}

.pagination-info button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Modal */
.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: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.quilt-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.quilt-detail-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.quilt-detail-grid h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 18px;
}

.quilt-detail-grid p {
    margin-bottom: 10px;
    color: #555;
}

.quilt-detail-grid label {
    display: block;
    margin-bottom: 10px;
    color: #555;
}

.quilt-detail-grid input[type="checkbox"] {
    margin-right: 8px;
}

.analysis-scores {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.analysis-scores span {
    padding: 8px 12px;
    background: #e9ecef;
    border-radius: 20px;
    font-weight: 600;
    color: #495057;
}

.analysis-text {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.analysis-text h4 {
    color: #333;
    margin-bottom: 10px;
}

.analysis-text p {
    color: #555;
    line-height: 1.6;
    margin: 0;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filters input,
    .filters select,
    .upload-btn {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .quilts-grid {
        grid-template-columns: 1fr;
    }
    
    .quilt-detail-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .pagination-info {
        flex-direction: column;
        gap: 10px;
    }
}