﻿/* ======= CSS Variables (Design System) ======= */
:root {
    --bg-color: #f3f6f9;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --accent-color: #f43f5e;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.05), 0 4px 6px -4px rgba(0,0,0,0.02);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.08);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark-mode {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --primary-color: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-light: #1e3a8a;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.5);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.6);
}

/* ======= Global Reset ======= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.d-none { display: none !important; }

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

/* ======= Header ======= */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.logo-link {
    text-decoration: none;
    color: inherit;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo {
    width: 40px;
    height: 40px;
}

.app-name {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.app-name span { color: var(--primary-color); }

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}
.nav-link:hover { color: var(--primary-color); }

.icon-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}
.icon-btn:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

/* ======= Hero / Intro Section ======= */
.hero-section {
    text-align: center;
    padding: 2rem 0 3rem;
}

.hero-section h1 {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-section p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ======= Cards / Panels ======= */
.panel-section {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
}

/* ======= Best Practices Section ======= */
.best-practices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.practice-card {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    transition: var(--transition);
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.practice-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.practice-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.practice-card h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.practice-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.tools-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.tool-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: var(--radius-full);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
    border: 1px solid transparent;
}

.tool-link:hover {
    background: var(--primary-color);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* ======= Network Selector ======= */
.network-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

.network-btn {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
    padding: 1.25rem 0.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.network-btn i { font-size: 2rem; }

.network-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--primary-light);
}

.network-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Network-specific colors */
.network-btn[data-network="facebook"].active { background: #1877F2; border-color: #1877F2; box-shadow: 0 4px 12px rgba(24,119,242,0.3); }
.network-btn[data-network="instagram"].active { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); border-color: #dc2743; box-shadow: 0 4px 12px rgba(220,39,67,0.3); }
.network-btn[data-network="x"].active { background: #000; border-color: #000; }
.dark-mode .network-btn[data-network="x"].active { background: #fff; border-color: #fff; color: #000; }
.network-btn[data-network="tiktok"].active { background: #010101; border-color: #010101; box-shadow: 0 0 12px rgba(37,244,238,0.3); }
.dark-mode .network-btn[data-network="tiktok"].active { background: #25f4ee; border-color: #25f4ee; color: #010101; }
.network-btn[data-network="linkedin"].active { background: #0A66C2; border-color: #0A66C2; box-shadow: 0 4px 12px rgba(10,102,194,0.3); }

/* ======= Content Type Grid ======= */
.content-type-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.content-type-btn {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-full);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: var(--transition);
}

.content-type-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.content-type-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* ======= Form Inputs ======= */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

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

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.input-group label i {
    font-size: 1rem;
    color: var(--primary-color);
}

input[type="text"],
input[type="date"],
input[type="time"],
textarea,
select {
    width: 100%;
    padding: 0.85rem 1rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    transition: var(--transition);
    outline: none;
}

textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

option {
    background-color: var(--bg-color);
    color: var(--text-primary);
}

.char-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: right;
    margin-top: -0.25rem;
}

.char-count.warning { color: var(--warning-color); }
.char-count.danger { color: var(--danger-color); }

/* ======= Hashtag input ======= */
.hashtag-input-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    min-height: 48px;
    align-items: center;
    cursor: text;
    transition: var(--transition);
}

.hashtag-input-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.hashtag-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 500;
    animation: tagAppear 0.2s ease-out;
}

@keyframes tagAppear {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.hashtag-tag .remove-tag {
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.hashtag-tag .remove-tag:hover { opacity: 1; }

.hashtag-input {
    border: none !important;
    outline: none !important;
    background: transparent !important;
    padding: 0.35rem !important;
    font-size: 0.95rem;
    flex: 1;
    min-width: 120px;
    box-shadow: none !important;
}

/* ======= Analyze Button ======= */
.btn {
    padding: 0.85rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: 'Outfit', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    color: white;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}
.btn-primary:active { transform: translateY(0); }

.btn-analyze {
    width: 100%;
    padding: 1.1rem;
    font-size: 1.15rem;
    border-radius: var(--radius-md);
    margin-top: 0.5rem;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}
.btn-outline:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-small { padding: 0.6rem 1.25rem; font-size: 0.9rem; }

.btn-icon { padding: 0.6rem; width: 40px; height: 40px; }

/* ======= REPORT SECTION ======= */
.report-section {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Global Score */
.score-overview {
    display: flex;
    align-items: center;
    gap: 3rem;
    padding: 2.5rem;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.score-circle-container {
    position: relative;
    width: 180px;
    height: 180px;
    min-width: 180px;
}

.score-circle-bg {
    fill: none;
    stroke: var(--border-color);
    stroke-width: 8;
}

.score-circle-progress {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.3s ease;
}

.score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-number {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
}

.score-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.score-details {
    flex: 1;
}

.score-details h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.score-details p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.score-summary-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.score-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 500;
}

.score-tag.excellent { background: rgba(16,185,129,0.1); color: #10b981; }
.score-tag.good { background: rgba(59,130,246,0.1); color: #3b82f6; }
.score-tag.average { background: rgba(245,158,11,0.1); color: #f59e0b; }
.score-tag.poor { background: rgba(239,68,68,0.1); color: #ef4444; }

/* ======= Report Layout (Chart + Checklist) ======= */
.report-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* ======= Radar Chart ======= */
.chart-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.chart-card canvas {
    max-height: 400px;
}

.chart-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    justify-content: center;
}

/* ======= Checklist ======= */
.checklist-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    padding: 2rem;
    max-height: 600px;
    overflow-y: auto;
}

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

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

.checklist-card::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-full);
}

.checklist-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    align-items: flex-start;
    animation: fadeInUp 0.3s ease-out;
}

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

.checklist-score-badge {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
}

.badge-excellent { background: linear-gradient(135deg, #10b981, #059669); }
.badge-good { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.badge-average { background: linear-gradient(135deg, #f59e0b, #d97706); }
.badge-poor { background: linear-gradient(135deg, #ef4444, #dc2626); }

.checklist-content {
    flex: 1;
}

.checklist-content h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.checklist-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.checklist-content .tip {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ======= Download Actions ======= */
.download-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.btn-download {
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
}

.btn-download:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-download i { font-size: 1.3rem; }

/* ======= Score colors utility ======= */
.color-excellent { color: #10b981; }
.color-good { color: #3b82f6; }
.color-average { color: #f59e0b; }
.color-poor { color: #ef4444; }

/* ======= Loading animation ======= */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.loading-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 3rem;
    text-align: center;
    box-shadow: var(--shadow-xl);
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-card p {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* ======= Footer ======= */
.footer {
    text-align: center;
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.footer a:hover { text-decoration: underline; }

/* ======= Responsive ======= */
@media (max-width: 1024px) {
    .report-grid { grid-template-columns: 1fr; }
    .score-overview { flex-direction: column; text-align: center; gap: 1.5rem; }
    .score-summary-tags { justify-content: center; }
    .network-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .app-container { padding: 0 1rem; }
    .hero-section h1 { font-size: 1.75rem; }
    .form-grid { grid-template-columns: 1fr; }
    .best-practices-grid { grid-template-columns: 1fr; }
    .network-grid { grid-template-columns: repeat(3, 1fr); }
    .checklist-card { max-height: none; }
    .panel-section { padding: 1.5rem; }
    .score-overview { padding: 1.5rem; }
    .score-circle-container { width: 140px; height: 140px; min-width: 140px; }
    .score-number { font-size: 2.25rem; }
}

@media (max-width: 640px) {
    .header { flex-direction: column; gap: 1rem; text-align: center; }
    .network-grid { grid-template-columns: repeat(2, 1fr); }
    .download-actions { flex-direction: column; }
    .btn-download { width: 100%; justify-content: center; }
}
