/* GIMHub UI - Modernized for 2025/2026 */
/* Ghost Theme with Glassmorphism */

/* ========================================
   CSS Variables - Warmer Ghost Theme
   ======================================== */
:root {
    /* Warmer backgrounds */
    --bg-primary: #0f1114;
    --bg-secondary: #181b20;
    --bg-tertiary: #242830;

    /* Glassmorphism */
    --glass-bg: rgba(30, 34, 42, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.05);

    /* Warmer text */
    --text-primary: #e8ecf2;
    --text-secondary: #9ca3ae;
    --text-link: #6eb5ff;
    --text-muted: #6b7280;

    /* Borders */
    --border-color: #363b44;
    --border-glow: rgba(110, 181, 255, 0.3);

    /* Softer accents */
    --accent-color: #2d9a47;
    --accent-hover: #38b254;
    --accent-glow: rgba(45, 154, 71, 0.4);

    /* Status colors */
    --warning-color: #e5a832;
    --danger-color: #e54545;
    --info-color: #5e9eff;

    /* Ghost/ethereal theme */
    --ghost-purple: #9f7aea;
    --ghost-blue: #63b3ed;
    --ghost-glow: rgba(159, 122, 234, 0.15);
}

/* ========================================
   Base Reset & Typography
   ======================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    letter-spacing: -0.011em;
}

/* Fluid typography */
h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

h2 {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 600;
    letter-spacing: -0.02em;
}

h3 {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    font-weight: 600;
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    text-decoration: underline;
}

/* ========================================
   Accessibility
   ======================================== */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent-color);
    color: white;
    padding: 8px 16px;
    z-index: 1000;
    border-radius: 0 0 4px 0;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
    text-decoration: none;
}

:focus-visible {
    outline: 2px solid var(--text-link);
    outline-offset: 2px;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   Layout
   ======================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ========================================
   Header - Glassmorphism
   ======================================== */
header {
    background: rgba(24, 27, 32, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.logo:hover {
    text-decoration: none;
}

.logo-icon {
    height: 48px;
    width: auto;
    filter: drop-shadow(0 0 8px var(--ghost-glow));
    transition: filter 0.3s ease;
}

.logo:hover .logo-icon {
    filter: drop-shadow(0 0 20px var(--ghost-purple));
}

nav {
    display: flex;
    gap: 24px;
}

nav a {
    color: var(--text-primary);
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

nav a:hover {
    background: var(--glass-bg);
    text-decoration: none;
}

nav a i {
    margin-right: 6px;
}

/* ========================================
   Main Content
   ======================================== */
main {
    padding: 24px 0;
    min-height: calc(100vh - 140px);
}

/* ========================================
   Footer
   ======================================== */
footer {
    background: rgba(24, 27, 32, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    padding: 24px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ========================================
   Cards - Glassmorphism
   ======================================== */
.card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow:
        inset 0 1px 0 var(--glass-highlight),
        0 4px 24px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    border-color: rgba(110, 181, 255, 0.2);
    box-shadow:
        inset 0 1px 0 var(--glass-highlight),
        0 8px 32px rgba(0, 0, 0, 0.4);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

/* Fallback for browsers without backdrop-filter */
@supports not (backdrop-filter: blur(12px)) {
    .card, header, footer {
        background: var(--bg-secondary);
    }
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    font-size: 14px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn i {
    font-size: 14px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-color), #2d8a47);
    color: white;
    border: none;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--accent-glow);
    text-decoration: none;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--glass-bg);
    border-color: var(--text-link);
    transform: translateY(-1px);
    text-decoration: none;
}

.btn:focus-visible {
    outline: 2px solid var(--text-link);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--border-glow);
}

/* ========================================
   Labels/Tags
   ======================================== */
.label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.label-open {
    background-color: var(--accent-color);
    color: white;
}

.label-closed {
    background-color: #8957e5;
    color: white;
}

/* ========================================
   Grid System
   ======================================== */
.grid {
    display: grid;
    gap: 16px;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

/* ========================================
   Bento Grid (Homepage)
   ======================================== */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 16px;
}

.bento-hero {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 24px;
    background: linear-gradient(180deg, var(--ghost-glow), transparent);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.bento-stat {
    grid-column: span 3;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 24px;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.bento-stat:hover {
    border-color: var(--ghost-purple);
    transform: translateY(-2px);
}

.bento-featured {
    grid-column: span 8;
}

.bento-activity {
    grid-column: span 4;
}

.bento-full {
    grid-column: 1 / -1;
}

.bento-half {
    grid-column: span 6;
}

/* ========================================
   Repository Card
   ======================================== */
.repo-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.repo-card:hover {
    transform: translateY(-2px);
    border-color: var(--ghost-purple);
    box-shadow: 0 12px 40px var(--ghost-glow);
}

.repo-card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.repo-card-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.repo-card-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

.repo-card-stats i {
    margin-right: 4px;
}

/* ========================================
   Activity Feed
   ======================================== */
.activity-feed {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item:hover {
    background-color: var(--glass-bg);
    margin: 0 -12px;
    padding: 12px;
    border-radius: 8px;
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ghost-purple), var(--ghost-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-time {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ========================================
   Forms
   ======================================== */
input, textarea, select {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-primary);
    width: 100%;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--text-link);
    box-shadow: 0 0 0 3px var(--border-glow);
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 16px;
}

/* ========================================
   Utility Classes
   ======================================== */
.text-secondary {
    color: var(--text-secondary);
}

.text-center {
    text-align: center;
}

.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.my-4 { margin-top: 16px; margin-bottom: 16px; }

/* ========================================
   Code Blocks
   ======================================== */
pre {
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    border: 1px solid var(--border-color);
}

code {
    font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 13px;
}

/* ========================================
   File Tree
   ======================================== */
.file-tree {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.file-tree-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    transition: all 0.2s ease;
}

.file-tree-item:last-child {
    border-bottom: none;
}

.file-tree-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--ghost-purple);
    transform: scaleY(0);
    transition: transform 0.2s ease;
}

.file-tree-item:hover {
    background-color: rgba(159, 122, 234, 0.1);
    padding-left: 20px;
}

.file-tree-item:hover::before {
    transform: scaleY(1);
}

.file-icon {
    width: 20px;
    text-align: center;
    color: var(--text-secondary);
}

.file-icon.folder {
    color: var(--text-link);
}

/* ========================================
   Breadcrumbs
   ======================================== */
.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
    font-size: 14px;
}

.breadcrumbs span {
    color: var(--text-secondary);
}

.breadcrumbs a {
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.breadcrumbs a:hover {
    background-color: var(--glass-bg);
    text-decoration: none;
}

/* ========================================
   Stats
   ======================================== */
.stats {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary), var(--ghost-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ========================================
   Highlight (Code Syntax)
   ======================================== */
.highlight {
    background-color: var(--bg-tertiary) !important;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid var(--border-color);
}

.highlight pre {
    margin: 0;
    padding: 16px;
    border: none;
}

.highlight .linenos {
    color: var(--text-secondary);
    padding-right: 16px;
    border-right: 1px solid var(--border-color);
    margin-right: 16px;
    user-select: none;
}

/* ========================================
   Markdown Content
   ======================================== */
.markdown-body {
    line-height: 1.7;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    margin-top: 24px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.markdown-body p {
    margin-bottom: 16px;
}

.markdown-body ul, .markdown-body ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.markdown-body table {
    border-collapse: collapse;
    margin-bottom: 16px;
    width: 100%;
}

.markdown-body th, .markdown-body td {
    border: 1px solid var(--border-color);
    padding: 10px 16px;
}

.markdown-body th {
    background-color: var(--bg-tertiary);
}

.markdown-body code {
    background-color: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
}

.markdown-body pre code {
    background: none;
    padding: 0;
}

/* ========================================
   Alerts
   ======================================== */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert i {
    font-size: 16px;
}

.alert-success {
    background-color: rgba(45, 154, 71, 0.15);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
}

.alert-error {
    background-color: rgba(229, 69, 69, 0.15);
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
}

.alert-warning {
    background-color: rgba(229, 168, 50, 0.15);
    border: 1px solid var(--warning-color);
    color: var(--warning-color);
}

.alert-info {
    background-color: rgba(94, 158, 255, 0.15);
    border: 1px solid var(--info-color);
    color: var(--info-color);
}

/* ========================================
   Responsive Breakpoints
   ======================================== */

/* Large devices */
@media (max-width: 1024px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .bento-stat {
        grid-column: span 6;
    }

    .bento-featured, .bento-activity {
        grid-column: 1 / -1;
    }
}

/* Medium devices */
@media (max-width: 768px) {
    main {
        padding: 16px 0;
    }

    .card {
        padding: 16px;
    }

    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }

    .bento-half {
        grid-column: 1 / -1;
    }

    .file-tree-item {
        padding: 12px 16px;
        min-height: 48px;
    }

    .btn {
        min-height: 44px;
    }
}

/* Small devices */
@media (max-width: 640px) {
    header .container {
        flex-direction: column;
        gap: 16px;
    }

    nav {
        width: 100%;
        justify-content: center;
    }

    .bento-stat {
        grid-column: 1 / -1;
    }

    .stats {
        flex-direction: column;
        gap: 16px;
        align-items: center;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .btn {
        padding: 10px 14px;
        font-size: 15px;
    }

    .breadcrumbs {
        font-size: 13px;
    }

    .bento-hero {
        padding: 32px 16px;
    }
}
