/* Editron - Modern Light UI */
:root {
    /* Modern Light Palette */
    --bg-color: #f8fafc;
    /* Slate 50 */
    --card-bg: #ffffff;
    /* White */
    --input-bg: #f1f5f9;
    /* Slate 100 */

    --primary-color: #3b82f6;
    /* Vibrant Blue */
    --primary-hover: #2563eb;
    /* Darker Blue */
    --accent-color: #6366f1;
    /* Indigo Accent */

    --text-color: #1e293b;
    /* Slate 800 */
    --text-muted: #64748b;
    /* Slate 500 */
    --border-color: #e2e8f0;
    /* Slate 200 */

    --success-color: #10b981;
    /* Emerald */
    --error-color: #ef4444;
    /* Red */

    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);

    --radius: 12px;
}

/* Credit badge in nav bar */
.credit-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.3px;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.35);
}

/* Credit cost pill inside action buttons */
.credit-cost-badge {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.45);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 20px;
    letter-spacing: 0.3px;
    margin-left: 8px;
    vertical-align: middle;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
}

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

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 10px;
    opacity: 0;
    animation: fadeInDown 0.8s ease-out forwards;
}

header h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 5px;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
}

/* Layout */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
    opacity: 0;
    animation: fadeInUp 0.8s ease-out 0.2s forwards;
}

/* Editor Section */
.editor-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 20px;
    border: 1px solid var(--border-color);
    position: sticky;
    top: 30px;
    height: auto;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.editor-card:hover {
    box-shadow: var(--shadow-lg);
}

.form-group {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    color: var(--text-color);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Textarea */
textarea {
    width: 100%;
    flex-grow: 1;
    min-height: 350px;
    padding: 15px;
    background-color: var(--input-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.6;
    resize: none;
    transition: all 0.2s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.char-count {
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
    font-feature-settings: "tnum";
}

/* Button */
.btn-submit {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: var(--primary-color);
    color: white;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.2);
}

.btn-submit:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(59, 130, 246, 0.3);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    background: #ffffff;
    color: var(--text-muted);
    text-align: center;
    padding: 30px;
}

.empty-state p {
    font-size: 1rem;
    margin-top: 10px;
}

/* Result Cards */
.result-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 25px;
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

/* Processing State */
.processing-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    background: #ffffff !important;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    text-align: center;
    padding: 40px;
    z-index: 10;
}

/* Spinner Styles */
.spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
}

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

.processing-state .loader-rings {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 30px;
}

.loader-rings div {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin-loader 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.loader-rings div:nth-child(2) {
    width: 70%;
    height: 70%;
    top: 15%;
    left: 15%;
    border-top-color: var(--accent-color);
    animation-direction: reverse;
    animation-duration: 0.8s;
}

.loader-rings div:nth-child(3) {
    width: 40%;
    height: 40%;
    top: 30%;
    left: 30%;
    border-top-color: var(--success-color);
    animation-duration: 1.5s;
}

@keyframes spin-loader {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.processing-state h3 {
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 15px;
    font-weight: 800;
}

.processing-state .status-msg {
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 600;
    min-height: 1.6em;
    transition: opacity 0.3s ease;
}

.processing-state .status-subtext {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 15px;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary-color), var(--accent-color));
}

.result-card h2 {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--text-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    letter-spacing: 0.02em;
}

/* Content Typography */
.spot-text {
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.7;
    color: var(--text-color);
}

.article-text {
    color: var(--text-color);
    font-size: 0.95rem;
    line-height: 1.8;
}

.article-text h3 {
    color: var(--primary-color);
    margin-top: 25px;
    margin-bottom: 15px;
    font-size: 1.4rem;
    font-weight: 700;
}

.article-text p {
    margin-bottom: 15px;
}

.keyword-tag {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.85rem;
    margin-right: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    border: 1px solid rgba(59, 130, 246, 0.2);
    display: inline-block;
    transition: all 0.2s;
}

.keyword-tag:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

.meta-description {
    color: var(--text-muted);
    font-style: italic;
    background: var(--input-bg);
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
    font-size: 0.9rem;
}

/* Copy Button */
.copy-btn {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* Headline Scoring Styles */
.headline-item {
    background: #ffffff;
    padding: 18px;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    list-style: none;
}

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

.headline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 10px;
}

.headline-text {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-color);
    line-height: 1.4;
    flex-grow: 1;
}

.copy-btn-mini {
    background: var(--input-bg);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.copy-btn-mini:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.headline-scores {
    display: flex;
    gap: 15px;
    margin-top: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.score-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 6px 14px;
    border-radius: 50px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.score-ctr {
    color: #facc15;
}

.score-seo {
    color: #10b981;
}

.score-reason {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.8;
}

.score-bar-bg {
    width: 80px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.ctr-fill {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.seo-fill {
    background: linear-gradient(90deg, #34d399, #10b981);
}

.headline-list {
    list-style: none;
    padding: 0;
}

/* Dashboard & Google Trends */
.dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    align-items: start;
}

.trends-sidebar {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 25px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 30px;
}

.trends-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.trends-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
}

.trend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: var(--input-bg);
    border: 1px solid transparent;
    transition: all 0.2s;
    text-decoration: none;
}

.trend-item:hover {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.05);
    transform: translateX(5px);
}

.trend-rank {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary-color);
    opacity: 0.5;
    min-width: 30px;
}

.trend-info {
    flex-grow: 1;
}

.trend-topic {
    display: block;
    color: var(--text-color);
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    transition: color 0.2s;
}

.trend-topic:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.trend-traffic {
    display: block;
    font-size: 0.75rem;
    color: var(--success-color);
    font-weight: 700;
}

.trend-btn {
    color: var(--text-muted);
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.trend-item:hover .trend-btn {
    opacity: 1;
}

/* App Navigation Bar */
.app-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    margin-bottom: 30px;
    gap: 20px;
    border-bottom: 1px solid var(--border-color);
}

.nav-left,
.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card-bg);
    padding: 6px 16px;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.nav-user img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--primary-color);
}

.nav-user span {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-color);
}

.nav-user .credit-badge {
    color: #ffffff !important;
    font-weight: 700;
    font-size: 0.72rem;
}

.nav-logout {
    color: var(--error-color) !important;
    font-size: 0.9rem;
    font-weight: 700;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 5px;
    border: 2px solid var(--bg-color);
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Responsive */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

    .editor-card {
        position: static;
        height: auto;
    }

    textarea {
        min-height: 250px;
    }

    .empty-state {
        height: auto;
        padding: 60px 20px;
    }

    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .trends-sidebar {
        position: static;
        order: 2;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .app-nav {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .nav-left,
    .nav-right {
        width: 100%;
        justify-content: center;
    }

    .nav-user {
        order: -1;
    }
}