:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-gradient-start: #f3f4f6;
    --bg-gradient-end: #e5e7eb;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    line-height: 1.5;
}

.app-container {
    width: 100%;
    max-width: 1200px;
    /* Increased from 500px to allow full width feel */
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin: 0 auto;
}

header {
    text-align: center;
    padding: 1rem 0;
}

header h1 {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.generator-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 3rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    /* meaningful max-width for the generator functionality itself so inputs don't look absurd */
    max-width: 100%;
}

/* Password Display */
.password-display-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.password-field {
    flex: 1;
    position: relative;
}

#password-output {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1.25rem;
    font-family: monospace;
    color: var(--text-main);
    background-color: #f9fafb;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    transition: all 0.2s;
}

#password-output:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.icon-btn {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: #fdfdff;
}

.icon-btn:active {
    transform: scale(0.95);
}

/* Strength Meter */
.strength-meter-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.strength-bar-bg {
    width: 100%;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0%;
    background-color: var(--danger-color);
    /* Default weak */
    transition: width 0.3s ease, background-color 0.3s ease;
}

#strength-text {
    font-size: 0.875rem;
    font-weight: 500;
    text-align: right;
    color: var(--text-muted);
}

/* Return Button */
.return-btn {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: color 0.2s;
    background: white;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    box-shadow: var(--shadow-sm);
}

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

/* Controls */
.controls-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-top: 0.5rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

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

label {
    font-weight: 500;
    font-size: 0.95rem;
}

#length-value {
    font-weight: 600;
    color: var(--primary-color);
    background: #e0e7ff;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 9999px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

/* Options Grid */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-main);
    user-select: none;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    height: 20px;
    width: 20px;
    background-color: #fff;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    position: relative;
    transition: all 0.2s;
}

.checkbox-container:hover .checkmark {
    border-color: var(--primary-color);
}

.checkbox-container input:checked~.checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked~.checkmark:after {
    display: block;
}

/* Generate Button */
#generate-btn {
    width: 100%;
    padding: 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 0.5rem;
}

#generate-btn:hover {
    background-color: var(--primary-hover);
}

#generate-btn:active {
    transform: translateY(1px);
}

/* Ads Placeholder */
.ads-placeholder {
    width: 100%;
    min-height: 100px;
    background-color: #f3f4f6;
    /* Subtle bg for placeholder */
    border: 2px dashed #d1d5db;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #9ca3af;
    margin-bottom: 2rem;
}

.ad-content {
    text-align: center;
    font-size: 0.875rem;
}

footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: auto;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .options-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .generator-card {
        padding: 1.5rem;
    }
}

/* SEO Content Styles */
.seo-content {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 2.5rem;
    color: var(--text-main);
    line-height: 1.7;
    margin-bottom: 2rem;
}

.seo-content section {
    margin-bottom: 2.5rem;
}

.seo-content section:last-child {
    margin-bottom: 0;
}

.seo-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1.25rem;
    margin-top: 0;
}

.seo-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.75rem;
    margin-top: 1.5rem;
}

.seo-content p {
    margin-bottom: 1rem;
    color: #374151;
    /* Slightly lighter for body text */
}

.seo-content ul,
.seo-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.seo-content li {
    margin-bottom: 0.5rem;
    color: #374151;
}

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

/* Table Styles */
.table-responsive {
    overflow-x: auto;
    margin: 1.5rem 0;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    /* Force scroll on small screens */
    background: white;
}

.comparison-table th,
.comparison-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.comparison-table th {
    background-color: #f9fafb;
    font-weight: 600;
    color: var(--text-main);
}

.comparison-table tr:last-child td {
    border-bottom: none;
}

.weak-row td {
    background-color: #fef2f2;
}

.strong-row td {
    background-color: #f0fdf4;
}

.comparison-table .weak-row:hover td {
    background-color: #fee2e2;
}

.comparison-table .strong-row:hover td {
    background-color: #dcfce7;
}

/* Code snippet style */
.seo-content code {
    background-color: #f3f4f6;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 0.9em;
    color: var(--primary-color);
}

/* Steps list spacing */
.steps-list p {
    margin-bottom: 1.25rem;
}

/* Responsive typography */
@media (max-width: 640px) {
    .seo-content {
        padding: 1.5rem;
    }

    .seo-content h2 {
        font-size: 1.5rem;
    }

    .seo-content h3 {
        font-size: 1.125rem;
    }
}

/* Fix for return button overlap on mobile */
@media (max-width: 768px) {
    body {
        flex-direction: column;
        justify-content: flex-start;
    }

    .return-btn {
        position: static;
        align-self: flex-start;
        margin-bottom: 1.5rem;
        /* Ensure it doesn't touch the edge too much if padding is small */
        margin-left: 0.5rem;
    }

    .app-container {
        margin-top: 0;
        width: 100%;
    }
}