/* ===== CSS Variables ===== */
:root {
    --color-primary: #6366f1;
    --color-primary-dark: #4f46e5;
    --color-secondary: #8b5cf6;
    --color-success: #10b981;
    --color-error: #ef4444;
    --color-warning: #f59e0b;

    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-border: #e2e8f0;
    --color-text: #1e293b;
    --color-text-secondary: #64748b;
    --color-text-muted: #94a3b8;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

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

[data-theme="dark"] {
    --color-bg: #0f172a;
    --color-surface: #1e293b;
    --color-border: #334155;
    --color-text: #f1f5f9;
    --color-text-secondary: #cbd5e1;
    --color-text-muted: #94a3b8;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    transition: var(--transition);
}

/* ===== Header ===== */
.header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 1.25rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] .header {
    background: rgba(30, 41, 59, 0.8);
}

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

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

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

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    text-decoration: none;
}

.btn-icon:hover {
    background: var(--color-bg);
    color: var(--color-primary);
}

/* ===== Main Content ===== */
.main-content {
    padding: 2rem 0;
    min-height: calc(100vh - 100px);
}

.grid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

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

/* ===== Panel ===== */
.panel {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transition: var(--transition);
}

.panel-header {
    padding: 2rem;
    border-bottom: 1px solid var(--color-border);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(139, 92, 246, 0.05));
}

.panel-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

.panel-form {
    position: sticky;
    top: 120px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

.panel-preview {
    position: sticky;
    top: 120px;
    max-height: calc(100vh - 140px);
    display: flex;
    flex-direction: column;
}

.preview-actions {
    display: flex;
    gap: 0.5rem;
}

/* ===== Form ===== */
.content-form {
    padding: 2rem;
}

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

.label-top {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

.input-wrapper {
    position: relative;
}

.input-wrapper input,
.input-wrapper textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 0.9375rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.input-wrapper textarea {
    resize: vertical;
    min-height: 100px;
}

.input-wrapper label {
    position: absolute;
    left: 1rem;
    top: 1rem;
    color: var(--color-text-muted);
    font-size: 0.9375rem;
    pointer-events: none;
    transition: var(--transition);
    background: var(--color-surface);
    padding: 0 0.25rem;
}

.input-wrapper input:focus,
.input-wrapper textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-wrapper input:focus + label,
.input-wrapper input:not(:placeholder-shown) + label,
.input-wrapper textarea:focus + label,
.input-wrapper textarea:not(:placeholder-shown) + label {
    top: -0.5rem;
    font-size: 0.75rem;
    color: var(--color-primary);
    font-weight: 600;
}

.helper-text {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}

.helper-text a {
    color: var(--color-primary);
    text-decoration: none;
}

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

.char-counter {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    pointer-events: none;
}

.toggle-password {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.toggle-password:hover {
    color: var(--color-primary);
}

/* ===== Radio Cards ===== */
.radio-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.radio-card {
    position: relative;
    cursor: pointer;
}

.radio-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.radio-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    transition: var(--transition);
}

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

.radio-card input:checked + .radio-content {
    border-color: var(--color-primary);
    background: rgba(99, 102, 241, 0.05);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* ===== Buttons ===== */
.btn {
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

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

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

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

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-loader {
    display: none;
}

.btn.loading .btn-text {
    visibility: hidden;
}

.btn.loading .btn-loader {
    display: block;
    position: absolute;
}

.spinner {
    animation: rotate 2s linear infinite;
    width: 20px;
    height: 20px;
}

.spinner .path {
    stroke: white;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

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

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

.form-actions {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

/* ===== Preview ===== */
.preview-content {
    padding: 2rem;
    flex: 1;
    overflow-y: auto;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--color-text-secondary);
}

.empty-state svg {
    margin-bottom: 1.5rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.empty-state p {
    max-width: 300px;
    font-size: 0.875rem;
}

/* ===== Generated Content Styles ===== */
.content-section {
    margin-bottom: 2rem;
}

.content-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.seo-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 1rem;
    line-height: 1.3;
}

.meta-description {
    padding: 1rem;
    background: rgba(99, 102, 241, 0.05);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    font-size: 0.9375rem;
}

.generated-content {
    margin-top: 2rem;
}

.generated-content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.generated-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 2rem 0 1rem;
    color: var(--color-primary);
}

.generated-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.5rem 0 1rem;
}

.generated-content p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.generated-content ul {
    margin: 1rem 0;
    padding-left: 0;
    list-style: none;
}

.generated-content li {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    position: relative;
    line-height: 1.6;
}

.generated-content li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--color-primary);
    font-weight: bold;
    font-size: 1.2em;
}

.generated-content li strong {
    color: var(--color-text);
    font-weight: 600;
}

.generated-content strong {
    font-weight: 600;
    color: var(--color-primary);
}

/* ===== Toast Notification ===== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateY(150%);
    transition: transform 0.3s ease;
    z-index: 1000;
    max-width: 400px;
}

.toast.show {
    transform: translateY(0);
}

.toast.success {
    border-left: 4px solid var(--color-success);
}

.toast.error {
    border-left: 4px solid var(--color-error);
}

.toast.warning {
    border-left: 4px solid var(--color-warning);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .panel-form,
    .panel-preview {
        position: static;
        max-height: none;
    }

    .radio-group {
        grid-template-columns: 1fr;
    }

    .toast {
        right: 1rem;
        left: 1rem;
        bottom: 1rem;
    }
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ===== Loading State ===== */
.skeleton {
    background: linear-gradient(90deg, var(--color-border) 25%, var(--color-bg) 50%, var(--color-border) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ===== Validation Stats ===== */
.validation-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1rem;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--color-surface);
    border-radius: var(--radius-sm);
}

.stat-item.stat-full {
    grid-column: 1 / -1;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.stat-item.stat-full .stat-value {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--color-text-secondary);
}

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

.stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
}

.stat-value.stat-good {
    color: var(--color-success);
}

.stat-value.stat-medium {
    color: var(--color-warning);
}

.stat-value.stat-poor,
.stat-value.stat-warning {
    color: var(--color-error);
}

/* ===== Validation Warnings and Errors ===== */
.validation-warnings,
.validation-errors {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.warning-item {
    padding: 0.75rem 1rem;
    background: rgba(245, 158, 11, 0.1);
    border-left: 3px solid var(--color-warning);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--color-text);
}

.error-item {
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid var(--color-error);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--color-text);
}

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

/* ===== Passive Voice Examples ===== */
.passive-examples {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.passive-example {
    padding: 1rem;
    background: rgba(245, 158, 11, 0.05);
    border-left: 3px solid var(--color-warning);
    border-radius: var(--radius-sm);
}

.example-sentence {
    font-size: 0.875rem;
    color: var(--color-text);
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.example-highlight {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.example-highlight strong {
    color: var(--color-warning);
    font-weight: 600;
}
