/* Admin Specific Styles */

.hidden {
    display: none !important;
}

/* Login Screen */
.login-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--warm-light-gray);
}

.login-card {
    background-color: var(--white);
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-width: 400px;
    width: 100%;
    margin: 1rem;
}

.login-card h1 {
    color: var(--deep-navy);
    margin-bottom: 2rem;
    text-align: center;
}

.error-message {
    color: #d32f2f;
    font-size: 0.9rem;
    margin-top: 1rem;
    text-align: center;
}

.success-message {
    color: #388e3c;
    font-size: 0.9rem;
    margin-top: 1rem;
    text-align: center;
}

/* Admin Dashboard */
.logout-btn {
    background-color: var(--muted-teak);
    color: var(--white);
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.logout-btn:hover {
    background-color: var(--deep-navy);
}

.admin-container {
    width: calc(100% - 4in);
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* Admin Nav (tabs live in the header, next to the site title and logout button) */
.admin-navbar .nav-container {
    max-width: 1100px;
}

.admin-nav-menu {
    gap: 0.25rem;
}

.admin-nav-menu .tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--white);
    cursor: pointer;
    transition: all 0.3s ease;
}

.admin-nav-menu .tab-btn:hover {
    color: var(--soft-gold);
}

.admin-nav-menu .tab-btn.active {
    color: var(--soft-gold);
    border-bottom-color: var(--soft-gold);
}

.tab-content {
    display: none;
}

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

/* Form Elements */
.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: var(--muted-teak);
    font-size: 0.85rem;
}

#urlPreview {
    font-weight: 600;
    color: var(--deep-navy);
}

/* Rich Text Toolbar */
.rich-text-toolbar {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.rt-btn {
    background-color: var(--white);
    border: 1px solid #d9d4c8;
    border-radius: 4px;
    padding: 0.35rem 0.7rem;
    font-size: 0.9rem;
    color: var(--charcoal);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.rt-btn:hover:not(:disabled) {
    background-color: var(--warm-light-gray);
    border-color: var(--muted-teak);
}

.rt-btn.active {
    background-color: var(--deep-navy);
    border-color: var(--deep-navy);
    color: var(--white);
}

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

.rt-toolbar-divider {
    width: 1px;
    align-self: stretch;
    background-color: #d9d4c8;
    margin: 0 0.15rem;
}

div.section-content[contenteditable] {
    min-height: 6rem;
    padding: 0.75rem;
    border: 1px solid #d9d4c8;
    border-radius: 4px;
    background-color: var(--white);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.6;
}

div.section-content[contenteditable] ul,
div.section-content[contenteditable] ol {
    padding-left: 1.5rem;
    margin: 0.5rem 0;
}

div.section-content[contenteditable] ul ul,
div.section-content[contenteditable] ol ol,
div.section-content[contenteditable] ul ol,
div.section-content[contenteditable] ol ul {
    margin: 0;
}

/* Site Pages layout controls (alignment / section spacing / paragraph spacing preview) */
.page-field-style-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: flex-end;
    margin-bottom: 0.5rem;
    padding: 0.75rem;
    background-color: var(--warm-light-gray);
    border-radius: 4px;
}

.style-control-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.style-control-group label,
.style-control-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted-teak);
}

.align-btn-group {
    display: flex;
    gap: 0.25rem;
}

.align-btn {
    background-color: var(--white);
    border: 1px solid #d9d4c8;
    border-radius: 4px;
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
    color: var(--charcoal);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.align-btn:hover {
    background-color: var(--warm-light-gray);
    border-color: var(--muted-teak);
}

.align-btn.active {
    background-color: var(--deep-navy);
    border-color: var(--deep-navy);
    color: var(--white);
}

.tag-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-toggle-btn {
    background-color: var(--white);
    border: 2px solid #d9d4c8;
    border-radius: 999px;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--charcoal);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.tag-toggle-btn:hover {
    border-color: var(--muted-teak);
}

.tag-toggle-btn[data-tag="parents"].active {
    background-color: var(--soft-gold);
    border-color: var(--soft-gold);
    color: var(--white);
}

.tag-toggle-btn[data-tag="students"].active {
    background-color: var(--muted-teak);
    border-color: var(--muted-teak);
    color: var(--white);
}

.tag-toggle-btn[data-tag="teachers"].active {
    background-color: var(--deep-navy);
    border-color: var(--deep-navy);
    color: var(--white);
}

.section-spacing-select,
.line-height-select {
    padding: 0.35rem 0.5rem;
    border: 1px solid #d9d4c8;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--charcoal);
    background-color: var(--white);
}

div.section-content[contenteditable]:focus {
    outline: none;
    border-color: var(--muted-teak);
}

div.section-content[contenteditable]:empty::before {
    content: attr(data-placeholder);
    color: #999;
}

/* Article Management */
.article-item {
    border: 1px solid var(--warm-light-gray);
    border-radius: 4px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    background-color: var(--white);
    width: 100%;
    box-sizing: border-box;
}

.article-item h3 {
    color: var(--deep-navy);
    margin-bottom: 0.5rem;
    text-align: left;
    word-wrap: break-word;
}

.article-item .article-url {
    color: var(--muted-teak);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    display: block;
    word-wrap: break-word;
}

.article-item .article-excerpt {
    color: var(--charcoal);
    margin-bottom: 1rem;
    text-align: left;
    word-wrap: break-word;
}

.article-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-small {
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    flex: 1;
    min-width: 100px;
}

.btn-view {
    background-color: var(--muted-teak);
    color: var(--white);
}

.btn-view:hover {
    background-color: var(--deep-navy);
}

.btn-edit {
    background-color: #2e7d32;
    color: var(--white);
}

.btn-edit:hover {
    background-color: #1b5e20;
}

.btn-delete {
    background-color: #d32f2f;
    color: var(--white);
}

.btn-delete:hover {
    background-color: #b71c1c;
}

.no-articles {
    text-align: center;
    color: var(--charcoal);
    padding: 2rem;
}

/* Article Management Tiles */
#articlesList .article-preview {
    border-bottom: 1px solid var(--warm-light-gray);
    padding: 2rem 0;
    margin-bottom: 2rem;
}

#articlesList .article-preview:last-child {
    border-bottom: none;
}

#articlesList .article-preview h2 {
    color: var(--deep-navy);
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

#articlesList .article-preview p {
    text-align: left;
    margin-bottom: 0.75rem;
}

#articlesList .article-actions {
    margin-top: 1rem;
}

/* Article Sections */
.article-section {
    border: 2px solid var(--warm-light-gray);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background-color: #fafafa;
    position: relative;
}

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

.section-number {
    font-weight: 600;
    color: var(--deep-navy);
    font-size: 1.1rem;
}

.section-header-actions {
    display: flex;
    gap: 0.5rem;
}

.insert-section-btn {
    background-color: var(--muted-teak);
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.insert-section-btn:hover {
    background-color: var(--deep-navy);
}

.remove-section-btn {
    background-color: #d32f2f;
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.remove-section-btn:hover {
    background-color: #b71c1c;
}

.subtitle-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.subtitle-row .subtitle-input {
    flex: 1;
}

.remove-subtitle-btn {
    background-color: #d32f2f;
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
}

.remove-subtitle-btn:hover {
    background-color: #b71c1c;
}

.section-type-selector {
    margin-bottom: 1rem;
}

.section-type-selector label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--charcoal);
}

.section-type-selector select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.btn-secondary {
    background-color: var(--soft-gold);
    color: var(--deep-navy);
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: var(--muted-teak);
    color: white;
}

/* File Upload Styles */
.uploaded-files-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

.file-preview {
    border: 2px solid var(--warm-light-gray);
    border-radius: 8px;
    padding: 1rem;
    background-color: white;
    position: relative;
}

.file-preview img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.file-preview .file-icon {
    width: 100%;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--warm-light-gray);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-size: 3rem;
    color: var(--muted-teak);
}

.file-info {
    font-size: 0.85rem;
    color: var(--charcoal);
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.file-name {
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
}

.file-size {
    color: var(--muted-teak);
    font-size: 0.8rem;
}

.remove-file-btn {
    width: 100%;
    background-color: #d32f2f;
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.remove-file-btn:hover {
    background-color: #b71c1c;
}

.download-section {
    background-color: #e3f2fd;
    border: 2px solid #2196f3;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
}

.download-section h4 {
    color: var(--deep-navy);
    margin-bottom: 1rem;
}

.download-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.download-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background-color: white;
    border-radius: 4px;
    border: 1px solid #bbdefb;
}

.download-item-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.download-icon {
    font-size: 1.5rem;
}

.download-btn {
    background-color: var(--deep-navy);
    color: white;
    padding: 0.5rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.download-btn:hover {
    background-color: var(--muted-teak);
}

/* Section-specific file attachments */
.section-attachments {
    border-top: 2px dashed #ddd;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    background-color: #f9f9f9;
    padding: 1rem;
    border-radius: 6px;
}

.section-attachments h4 {
    margin-bottom: 0.75rem;
}

.section-files-list {
    margin-top: 1rem;
}

.section-file-item {
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.file-preview-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.file-preview-icon {
    flex-shrink: 0;
}

.file-icon-small {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--warm-light-gray);
    border-radius: 4px;
    font-size: 2.5rem;
}

.file-preview-info {
    flex: 1;
}

.file-preview-info strong {
    color: var(--deep-navy);
}

.file-description {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.remove-file-btn-small {
    background-color: #d32f2f;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    flex-shrink: 0;
}

.remove-file-btn-small:hover {
    background-color: #b71c1c;
}

/* Section attachments display in article */
.section-attachments-display {
    background-color: #f0f7ff;
    border-left: 4px solid var(--deep-navy);
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 4px;
}

.attachment-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #d0e4f7;
}

.attachment-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.attachment-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.attachment-content {
    flex: 1;
}

.attachment-content p {
    margin: 0 0 0.5rem 0;
    color: var(--charcoal);
    font-weight: 500;
}

.attachment-download {
    display: inline-block;
    background-color: var(--deep-navy);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.attachment-download:hover {
    background-color: var(--muted-teak);
}

.no-articles {
    text-align: center;
    color: var(--charcoal);
    padding: 2rem;
}

/* Footer (inherits from main styles.css) */
footer {
    margin-top: 2rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    /* Navbar responsive adjustments for admin */
    .nav-container {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .site-title {
        text-align: center;
        margin-bottom: 0;
    }
    
    .logout-btn {
        width: 100%;
        max-width: 200px;
    }

    .login-card {
        padding: 2rem;
    }

    .admin-container {
        width: calc(100% - 0.5in);
        padding: 0 1rem;
    }

    .admin-tabs {
        flex-direction: column;
        gap: 0;
    }

    .tab-btn {
        padding: 0.75rem 1rem;
        text-align: left;
    }

    .article-item {
        padding: 1rem;
    }

    .article-actions {
        flex-direction: row;
        gap: 0.5rem;
    }
    
    .btn-small {
        flex: 1;
        min-width: 0;
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .content-card {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .site-title {
        font-size: 1.25rem;
    }
    
    
    .article-item {
        padding: 0.75rem;
    }
    
    .article-item h3 {
        font-size: 1.1rem;
    }
    
    .article-actions {
        gap: 0.5rem;
    }
    
    .btn-small {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    .logout-btn {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
    }
    
    .content-card {
        padding: 1.25rem;
    }
    
    .admin-container {
        margin: 1rem auto;
    }
}

/* File Viewers - Images, PDFs, Videos */
.article-content figure {
    margin: 2rem 0;
}

.article-content figure img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.article-content figure img:hover {
    transform: scale(1.02);
}

.article-content figure figcaption {
    text-align: center;
    margin-top: 0.75rem;
    color: var(--muted-teak);
    font-size: 0.9rem;
    font-style: italic;
}

/* PDF Viewer */
.article-content iframe {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    width: 100%;
    min-height: 600px;
}

/* Video Player */
.article-content video {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Attachment Display (for other files) */
.article-content .section-attachments-display {
    margin: 1.5rem 0;
}

.article-content .attachment-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: #f8f8f8;
    border-radius: 8px;
    margin-bottom: 1rem;
    transition: background-color 0.2s ease;
}

.article-content .attachment-item:hover {
    background: #f0f0f0;
}

.article-content .attachment-item .attachment-icon {
    font-size: 2rem;
    margin-right: 1rem;
}

.article-content .attachment-item .attachment-content {
    flex: 1;
}

.article-content .attachment-item a {
    color: var(--muted-teak);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.article-content .attachment-item a:hover {
    color: var(--deep-navy);
    text-decoration: underline;
}

/* Responsive adjustments for viewers */
@media (max-width: 768px) {
    .article-content iframe {
        min-height: 400px;
    }
}
