/* ===================================
   Changelog Manager - Stylesheet
   =================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --success-light: #dcfce7;
    --error: #dc2626;
    --error-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--gray-800);
    background: var(--gray-50);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* --- Header --- */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--gray-900);
    font-weight: 700;
    font-size: 1.25rem;
}

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

.nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    text-decoration: none;
    color: var(--gray-600);
    padding: 8px 16px;
    border-radius: var(--radius);
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--gray-900);
    background: var(--gray-100);
}

.nav-link.active {
    color: var(--primary);
    background: var(--primary-light);
}

/* --- Hero --- */
.hero {
    text-align: center;
    padding: 60px 20px 40px;
}

.hero h1 {
    font-size: 2.5rem;
    color: var(--gray-900);
    margin-bottom: 12px;
    font-weight: 800;
}

.hero p {
    font-size: 1.125rem;
    color: var(--gray-500);
    max-width: 600px;
    margin: 0 auto;
}

/* --- Cards --- */
.changelog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
    padding: 20px 0 60px;
}

.changelog-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all 0.3s;
    border: 1px solid var(--gray-200);
}

.changelog-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    padding: 24px 24px 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.project-name {
    font-size: 1.25rem;
    color: var(--gray-900);
    margin: 0;
}

.project-name a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

.project-name a:hover {
    color: var(--primary);
}

.badge {
    background: var(--gray-100);
    color: var(--gray-600);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.card-meta {
    display: flex;
    gap: 16px;
    padding: 12px 24px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.meta-icon {
    font-size: 1rem;
}

.card-content {
    padding: 0 24px;
    max-height: 300px;
    overflow-y: auto;
}

.card-content::-webkit-scrollbar {
    width: 6px;
}

.card-content::-webkit-scrollbar-track {
    background: transparent;
}

.card-content::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.card-footer {
    padding: 16px 24px 24px;
    border-top: 1px solid var(--gray-100);
    margin-top: 16px;
}

/* --- Changelog Content --- */
.changelog-content h3 {
    color: var(--gray-900);
    font-size: 1.1rem;
    margin: 20px 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary);
    display: inline-block;
}

.changelog-content h3:first-child {
    margin-top: 0;
}

.changelog-content ul {
    list-style: none;
    padding-left: 0;
    margin: 8px 0;
}

.changelog-content li {
    position: relative;
    padding-left: 20px;
    margin: 6px 0;
    color: var(--gray-700);
    font-size: 0.95rem;
    line-height: 1.7;
}

.changelog-content li::before {
    content: '•';
    color: var(--primary);
    font-weight: bold;
    position: absolute;
    left: 4px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    line-height: 1.4;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

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

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

.btn-lg {
    padding: 14px 32px;
    font-size: 1.05rem;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.empty-state h3 {
    color: var(--gray-700);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--gray-500);
}

.empty-text {
    color: var(--gray-500);
    text-align: center;
    padding: 20px;
}

/* --- Login Section --- */
.login-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 40px 20px;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 48px;
    max-width: 420px;
    width: 100%;
    text-align: center;
}

.login-card h2 {
    color: var(--gray-900);
    margin-bottom: 8px;
    font-size: 1.75rem;
}

.login-card > p {
    color: var(--gray-500);
    margin-bottom: 32px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- Forms --- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.form-group label {
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="file"] {
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

.inline-form {
    display: flex;
}

.inline-form .form-row {
    width: 100%;
}

/* --- Admin Section --- */
.admin-section {
    padding: 40px 0 60px;
}

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

.section-header h2 {
    color: var(--gray-900);
    font-size: 1.75rem;
}

.admin-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 32px;
    margin-bottom: 24px;
    border: 1px solid var(--gray-200);
}

.admin-card h3 {
    color: var(--gray-900);
    margin-bottom: 20px;
    font-size: 1.25rem;
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- File List --- */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 1px solid var(--gray-100);
    transition: all 0.2s;
}

.file-item:hover {
    background: var(--gray-100);
    border-color: var(--gray-200);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.file-folder {
    background: var(--primary-light);
    color: var(--primary);
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
}

.file-name {
    font-weight: 600;
    color: var(--gray-800);
}

.file-meta {
    color: var(--gray-500);
    font-size: 0.85rem;
}

.file-actions {
    display: flex;
    gap: 8px;
}

/* --- Project List --- */
.project-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.project-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 1px solid var(--gray-100);
    transition: all 0.2s;
}

.project-item:hover {
    background: var(--gray-100);
    border-color: var(--gray-200);
}

.project-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.project-name-display {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 1.05rem;
}

.project-count {
    color: var(--gray-500);
    font-size: 0.85rem;
}

/* --- Detail View / Timeline --- */
.detail-section {
    padding: 40px 0 60px;
    max-width: 900px;
    margin: 0 auto;
}

.detail-header {
    text-align: center;
    margin-bottom: 48px;
}

.back-link {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    margin-bottom: 16px;
    font-weight: 500;
}

.back-link:hover {
    text-decoration: underline;
}

.detail-header h1 {
    font-size: 2.25rem;
    color: var(--gray-900);
}

.changelog-timeline {
    position: relative;
    padding-left: 40px;
}

.timeline-item {
    position: relative;
    margin-bottom: 40px;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -40px;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.marker-dot {
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    border: 3px solid var(--white);
    box-shadow: var(--shadow);
    z-index: 1;
}

.marker-line {
    flex: 1;
    width: 2px;
    background: var(--gray-200);
    margin-top: 4px;
}

.timeline-item:last-child .marker-line {
    display: none;
}

.timeline-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.timeline-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-100);
    flex-wrap: wrap;
}

.filename {
    font-weight: 700;
    color: var(--gray-800);
}

.date, .size {
    color: var(--gray-500);
    font-size: 0.85rem;
}

.timeline-body {
    padding: 24px;
}

.timeline-body .changelog-content h3 {
    margin-top: 16px;
}

.timeline-body .changelog-content h3:first-child {
    margin-top: 0;
}

/* --- Alerts --- */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-weight: 500;
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: var(--error-light);
    color: var(--error);
    border: 1px solid #fecaca;
}

/* --- Footer --- */
.footer {
    margin-top: auto;
    padding: 24px 0;
    text-align: center;
    color: var(--gray-400);
    border-top: 1px solid var(--gray-200);
    background: var(--white);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.75rem;
    }

    .changelog-grid {
        grid-template-columns: 1fr;
    }

    .header-content {
        flex-direction: column;
        gap: 12px;
    }

    .form-row {
        flex-direction: column;
    }

    .form-row .form-group {
        width: 100%;
    }

    .file-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .file-item,
    .project-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .login-card {
        padding: 32px 24px;
    }

    .detail-header h1 {
        font-size: 1.75rem;
    }

    .timeline-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}
