/* Admin Panel Styles */

:root {
    --admin-primary: #1d8a9b;
    --admin-danger: #dc3545;
    --admin-success: #28a745;
    --admin-warning: #ffc107;
    --admin-bg: #f8f9fa;
    --admin-sidebar: #2c3e50;
    --admin-text: #333;
    --admin-border: #dee2e6;
}

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

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--admin-bg);
    color: var(--admin-text);
}

/* Login Screen */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1d8a9b 0%, #2c3e50 100%);
    padding: 2rem;
}

.login-container {
    background: white;
    border-radius: 16px;
    padding: 3rem;
    max-width: 450px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-family: 'Montserrat', sans-serif;
    font-size: 2rem;
    color: #1d8a9b;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #666;
    font-size: 0.95rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Admin Dashboard */
.admin-dashboard {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-header {
    background: white;
    border-bottom: 1px solid var(--admin-border);
    padding: 1.5rem 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.admin-header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-header h1 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.75rem;
    color: #1d8a9b;
}

.admin-header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.admin-main {
    flex: 1;
    padding: 2rem;
}

.admin-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Action Bar */
.action-bar {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.search-box {
    flex: 1;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--admin-border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--admin-primary);
}

/* Projects List */
.projects-list {
    display: grid;
    gap: 1.5rem;
}

.project-item {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: box-shadow 0.3s;
}

.project-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.project-thumbnail {
    width: 200px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
}

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

.project-info {
    flex: 1;
}

.project-info h3 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.25rem;
    color: #1f1f1f;
    margin-bottom: 0.5rem;
}

.project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: #666;
}

.project-meta-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.project-type-badge {
    display: inline-block;
    background: #e8f4f6;
    color: #1d8a9b;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.project-description {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: auto;
}

/* Project Item Content Layout */
.project-item > .project-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--admin-primary);
    color: white;
}

.btn-primary:hover {
    background: #166d7a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(29, 138, 155, 0.3);
}

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

.btn-secondary:hover {
    background: #5a6268;
}

.btn-outline {
    background: white;
    border: 2px solid var(--admin-border);
    color: var(--admin-text);
}

.btn-outline:hover {
    border-color: var(--admin-primary);
    color: var(--admin-primary);
}

.btn-danger {
    background: var(--admin-danger);
    color: white;
}

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

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

.btn-icon {
    padding: 0.5rem;
    width: 36px;
    height: 36px;
    justify-content: center;
}

/* Forms */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 0.75rem;
    border: 2px solid var(--admin-border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--admin-primary);
}

.form-group small {
    color: #666;
    font-size: 0.85rem;
}

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

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--admin-border);
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    border: 1px solid #f5c6cb;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    border: 1px solid #c3e6cb;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
}

.modal-small {
    max-width: 500px;
}

.modal-header {
    padding: 2rem;
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    color: #1f1f1f;
}

.modal-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #f0f0f0;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}

.modal-body {
    padding: 2rem;
}

.project-form {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Loading Spinner */
.loading-spinner {
    text-align: center;
    padding: 4rem 2rem;
    color: #666;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-header-content {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .admin-header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: 100%;
    }

    .project-images-section {
        flex-direction: column;
        gap: 1rem;
    }

    .cover-photo-thumb,
    .project-thumbnail {
        width: 100%;
        height: 200px;
    }

    .project-actions {
        flex-direction: row;
        justify-content: stretch;
    }
    
    .project-actions .btn {
        flex: 1;
    }

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

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Drag and Drop Zone */
.drop-zone {
    border: 3px dashed var(--admin-border);
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--admin-primary);
    background: #e8f4f6;
}

.drop-zone.drag-over {
    transform: scale(1.02);
}

.drop-zone-content {
    pointer-events: none;
}

.drop-zone-content svg {
    color: var(--admin-primary);
    margin-bottom: 1rem;
}

.drop-zone-content p {
    margin: 0.5rem 0;
    color: #555;
}

.drop-zone-content strong {
    color: var(--admin-primary);
}

.drop-zone-hint {
    font-size: 0.85rem;
    color: #888;
}

/* Image Preview List */
.image-preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.image-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
    border: 2px solid var(--admin-border);
}

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

.image-preview-item .remove-image {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: background 0.2s;
}

.image-preview-item .remove-image:hover {
    background: rgba(220, 53, 69, 1);
}

.image-preview-item .image-url-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.7rem;
    padding: 4px 6px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Toggle URL Input Button */
.btn-link {
    background: none;
    border: none;
    color: var(--admin-primary);
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: underline;
    padding: 0;
}

.btn-link:hover {
    color: #156b78;
}

/* Tab Buttons */
.tab-buttons {
    display: flex;
    gap: 0.5rem;
    margin-right: 1rem;
}

.tab-btn {
    padding: 0.6rem 1.25rem;
    border: 2px solid var(--admin-primary);
    background: white;
    color: var(--admin-primary);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: rgba(29, 138, 155, 0.1);
}

.tab-btn.active {
    background: var(--admin-primary);
    color: white;
}

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

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

.checkbox-label span {
    font-weight: 500;
}

/* Large Modal for Blog Posts */
.modal-large .modal-content {
    max-width: 900px;
}

/* Blog Post Status Badge */
.post-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.post-status.published {
    background: #d4edda;
    color: #155724;
}

.post-status.draft {
    background: #fff3cd;
    color: #856404;
}

/* Featured Image Preview */
.drop-zone-small {
    min-height: 120px;
    padding: 1rem;
}

.drop-zone-small .drop-zone-content svg {
    width: 32px;
    height: 32px;
}

.drop-zone-small .drop-zone-content p {
    font-size: 0.9rem;
    margin: 0.5rem 0 0;
}

.featured-image-preview {
    margin-top: 1rem;
    display: none;
}

.featured-image-preview.has-image {
    display: block;
}

.featured-preview-item {
    position: relative;
    max-width: 400px;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
    border: 2px solid var(--admin-border);
}

.featured-preview-item img {
    width: 100%;
    height: auto;
    max-height: 250px;
    object-fit: cover;
    display: block;
}

.featured-preview-item .remove-image {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    transition: background 0.2s;
}

.featured-preview-item .remove-image:hover {
    background: rgba(220, 53, 69, 1);
}

/* Project/Blog Post Image Sections in List View */
.project-images-section {
    display: flex;
    gap: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
}

.cover-photo-section {
    flex-shrink: 0;
}

.gallery-photos-section {
    flex-grow: 1;
}

.image-section-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.cover-photo-thumb {
    width: 200px;
    height: 150px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #dee2e6;
}

.gallery-thumbs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.gallery-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.more-images {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9ecef;
    border-radius: 4px;
    font-weight: 600;
    color: #6c757d;
    font-size: 0.875rem;
}

.no-image {
    width: 200px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9ecef;
    border-radius: 6px;
    color: #6c757d;
    font-size: 0.875rem;
}
