@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Base Colors - Slate Palette (Dark Theme) */
    --bg-body: #0f172a;
    /* Slate 950 */
    --bg-surface: #1e293b;
    /* Slate 800 */
    --bg-surface-hover: #334155;
    /* Slate 700 */

    /* Primary / Accent - Indigo/Violet */
    --primary: #6366f1;
    /* Indigo 500 */
    --primary-hover: #4f46e5;
    /* Indigo 600 */
    --primary-light: #818cf8;
    /* Indigo 400 */

    /* Text Colors */
    --text-main: #f8fafc;
    /* Slate 50 */
    --text-secondary: #94a3b8;
    /* Slate 400 */
    --text-muted: #64748b;
    /* Slate 500 */

    /* Status Colors */
    --success: #10b981;
    /* Emerald 500 */
    --success-bg: rgba(16, 185, 129, 0.1);
    --danger: #ef4444;
    /* Red 500 */
    --danger-hover: #dc2626;
    /* Red 600 */
    --danger-bg: rgba(239, 68, 68, 0.1);

    /* UI Elements */
    --border: #334155;
    /* Slate 700 */
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
}

/* =========================================
   Layout & Common
   ========================================= */
.page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.dashboard-container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* =========================================
   Buttons
   ========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    outline: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-danger {
    background-color: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.2);
}

.btn-danger:hover:not(:disabled) {
    background-color: rgba(239, 68, 68, 0.2);
}

.btn-google {
    background-color: white;
    color: #1f2937;
    border: 1px solid #e5e7eb;
}

.btn-google:hover {
    background-color: #f9fafb;
}

/* =========================================
   Login Page
   ========================================= */
#loginPage {
    background: radial-gradient(circle at top center, #1e293b 0%, #0f172a 100%);
}

.login-container {
    width: 100%;
    max-width: 440px;
}

.login-box {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 48px 40px;
    box-shadow: var(--shadow-lg);
}

.login-box h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: white;
    text-align: center;
}

.subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 32px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-field {
    width: 100%;
    padding: 12px 16px;
    background-color: #0f172a;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: white;
    font-size: 0.95rem;
    transition: var(--transition);
}

.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
    outline: none;
}

.divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--border);
}

.divider span {
    padding: 0 10px;
}

.login-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* =========================================
   Dashboard Header & Nav
   ========================================= */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.header-left h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
}

.user-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.dashboard-nav {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
}

.tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background-color: var(--bg-surface);
    color: var(--primary-light);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

/* =========================================
   Tab Content Area
   ========================================= */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: white;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-select {
    padding: 10px 16px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    cursor: pointer;
    font-family: inherit;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* =========================================
   Projects Grid
   ========================================= */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
}

.project-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    border-color: var(--primary-light);
}

.project-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
}

.project-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.project-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: white;
    margin-bottom: 8px;
}

.project-category {
    display: inline-block;
    padding: 4px 10px;
    background-color: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 12px;
    align-self: start;
}

.project-author {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.project-link {
    display: inline-block;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
    margin-bottom: auto;
}

.project-link:hover {
    color: white;
    text-decoration: underline;
}

.project-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.btn-edit {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary-light);
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s;
}

.btn-edit:hover {
    background-color: rgba(99, 102, 241, 0.2);
}

.btn-delete {
    background-color: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s;
}

.btn-delete:hover:not(:disabled) {
    background-color: rgba(239, 68, 68, 0.2);
}

/* =========================================
   Admins List
   ========================================= */
.admins-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-info h3 {
    color: white;
    font-size: 1rem;
    margin-bottom: 4px;
}

.admin-email {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.admin-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    background-color: var(--primary);
    color: white;
    font-size: 0.7rem;
    border-radius: 4px;
    vertical-align: middle;
}

/* =========================================
   Modal & Forms
   ========================================= */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    /* Display is handled by JS (flex/none) */
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* When JS sets display: flex, we want the content to animate in */
.modal[style*="display: flex"] .modal-content,
.modal[style*="display: block"] .modal-content,
.modal[style*="display:flex"] .modal-content {
    animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-content {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 95%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-2xl);
    position: relative;
}

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

.modal-header h2 {
    font-size: 1.25rem;
    color: white;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: white;
}

.project-form {
    padding: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    background-color: #0f172a;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: white;
    font-size: 0.95rem;
}

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

/* Image Upload UI */
.image-upload-container {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.02);
}

.choose-image-btn {
    display: inline-block;
    width: auto;
    margin: 0 auto;
    cursor: pointer;
}

.image-preview-container {
    margin-top: 16px;
    position: relative;
    display: inline-block;
}

.image-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.btn-remove-image {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.upload-progress {
    margin-top: 12px;
}

.progress-bar {
    height: 6px;
    background-color: var(--bg-surface-hover);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--success);
    width: 0%;
    transition: width 0.3s;
}

.upload-status {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-hint {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.btn-submit {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    font-size: 1rem;
}

/* =========================================
   Utilities / Messages
   ========================================= */
.auth-message,
.form-message {
    margin-top: 16px;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    text-align: center;
    display: none;
}

.success {
    background-color: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.error {
    background-color: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.loading,
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 1rem;
}

.empty-state-text {
    font-size: 1.1rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .header-left {
        width: 100%;
    }

    #logoutBtn {
        align-self: flex-end;
    }

    .dashboard-nav {
        flex-wrap: wrap;
    }

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

    .form-group.full-width {
        grid-column: span 1;
    }

    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-add-top {
        margin-left: 0;
        width: 100%;
    }
}

/* Add these styles to your existing styles.css file */

/* Textarea styling for description field */
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: white;
    background-color: #0f172a;
    resize: vertical;
    min-height: 100px;
    transition: all 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea::placeholder {
    color: #94a3b8;
}

/* Project description in cards */
.project-description {
    margin: 12px 0;
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Ensure full-width class works properly */
.form-group.full-width {
    grid-column: 1 / -1;
}

/* Character counter (optional - if you want to add one later) */
.char-counter {
    display: block;
    text-align: right;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
}