/* ============================================================================
   File: app/static/css/main.css
   Digital Garden Style with Depth and Color
   ============================================================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(135deg, var(--background-color) 0%, #e8f1f5 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ============================================================================
   Navigation with Depth
   ============================================================================ */

.main-nav {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.main-nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

.main-nav .logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.main-nav .logo:hover {
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    position: relative;
    padding: 0.5rem 0;
    transition: all 0.3s ease;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: width 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

/* Navigation Search */
.nav-search {
    flex-shrink: 0;
}

.nav-search-input {
    padding: 0.4rem 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    width: 180px;
    transition: all 0.3s ease;
}

.nav-search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.nav-search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.25);
    width: 220px;
}

/* ============================================================================
   Articles Grid - Digital Garden Style
   ============================================================================ */

main {
    padding: 3rem 0;
}

.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.article-card {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Colorful accent on hover */
.article-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.article-card:hover::before {
    transform: scaleX(1);
}

.article-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--secondary-color);
}

.article-card h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
    line-height: 1.3;
}

.article-card h2 a {
    color: var(--text-color);
    text-decoration: none;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.3s ease;
}

.article-card h2 a:hover {
    background: linear-gradient(to right, var(--secondary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ============================================================================
   Date Display with Color Coding
   ============================================================================ */

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.date-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.date-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.date-info:nth-child(1) .date-label {
    color: var(--primary-color);
}

.date-info:nth-child(2) .date-label {
    color: var(--secondary-color);
}

.date-info:nth-child(3) .date-label {
    color: var(--accent-color);
}

.date-info time {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
}

/* ============================================================================
   Tags with Gradient Backgrounds
   ============================================================================ */

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, var(--accent-color), var(--secondary-color));
}

.excerpt {
    color: var(--text-light);
    line-height: 1.6;
}

/* ============================================================================
   Full Article View
   ============================================================================ */

.article-full {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 3rem;
    box-shadow: var(--shadow);
    max-width: 800px;
    margin: 2rem auto;
}

.article-header {
    border-bottom: 3px solid;
    border-image: linear-gradient(90deg, var(--primary-color), var(--accent-color)) 1;
    padding-bottom: 2rem;
    margin-bottom: 2rem;
}

.article-header h1 {
    font-size: 2.5rem;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.article-dates {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.date-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.date-group .date-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    color: var(--text-light);
}

.date-group time {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* ============================================================================
   Article Content Styling
   ============================================================================ */

.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.article-content h2 {
    font-size: 1.8rem;
    margin: 2rem 0 1rem;
    color: var(--primary-color);
    border-left: 4px solid var(--accent-color);
    padding-left: 1rem;
}

.article-content h3 {
    font-size: 1.4rem;
    margin: 1.5rem 0 0.75rem;
    color: var(--secondary-color);
}

.article-content p {
    margin-bottom: 1.5rem;
}

.article-content a {
    color: var(--secondary-color);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.article-content a:hover {
    border-bottom-color: var(--accent-color);
}

.article-content code {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--primary-color);
    border: 1px solid var(--border-color);
}

.article-content pre {
    background: var(--code-background);
    color: #abb2bf;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.article-content pre code {
    background: none;
    padding: 0;
    border: none;
    color: inherit;
}

.article-content blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--text-light);
    background: linear-gradient(to right, rgba(243, 156, 18, 0.1), transparent);
    padding: 1rem 1.5rem;
    border-radius: 0 8px 8px 0;
}

/* ============================================================================
   Editor Interface
   ============================================================================ */

.editor-container {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.editor-toolbar {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.editor-metadata {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.editor-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

.editor-pane, .preview-pane {
    min-height: 600px;
}

.editor-pane h3, .preview-pane h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.CodeMirror {
    height: 600px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
}

.preview-pane {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    overflow-y: auto;
    background: white;
}

/* ============================================================================
   Buttons with Gradients
   ============================================================================ */

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-edit {
    background: linear-gradient(135deg, var(--accent-color), #e67e22);
    color: white;
}

.save-status {
    margin-left: auto;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 6px;
}

.save-status.saving {
    background: #ffc107;
    color: #000;
}

.save-status.success {
    background: #28a745;
    color: white;
}

.save-status.error {
    background: #dc3545;
    color: white;
}

/* ============================================================================
   Footer
   ============================================================================ */

footer {
    margin-top: 4rem;
    padding: 2rem 0;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    text-align: center;
}

.footer-login {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    opacity: 0.7;
}

.footer-login a {
    color: white;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.footer-login a:hover {
    border-bottom-color: white;
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

@media (max-width: 768px) {
    .articles-grid {
        grid-template-columns: 1fr;
    }

    .editor-split {
        grid-template-columns: 1fr;
    }

    .article-meta, .article-dates {
        flex-direction: column;
        gap: 0.5rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .article-full {
        padding: 1.5rem;
    }
}
