/* CSS Variables */
:root {
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent-primary: #3b82f6;
    --accent-secondary: #1d4ed8;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --border-color: #cbd5e1;
    --shadow: rgba(15, 23, 42, 0.08);
    --shadow-hover: rgba(15, 23, 42, 0.15);
    --card-bg: #ffffff;
    --input-bg: #ffffff;
    --button-bg: #3b82f6;
    --button-hover: #2563eb;
}

/* Global responsive rules to prevent overflow */
* {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

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

/* Header */
header {
    background: var(--accent-primary);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-bottom: 2rem;
    position: relative;
}

.logo {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.logo a {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.logo a:hover {
    opacity: 0.9;
}

.logo-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.logo a:hover .logo-icon {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Breadcrumbs */
.breadcrumbs {
    margin: 1.5rem 0;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.breadcrumb-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.9rem;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-item a {
    color: var(--accent-primary);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.breadcrumb-item a:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-secondary);
}

.breadcrumb-item.active span {
    color: var(--text-primary);
    font-weight: 600;
    padding: 0.25rem 0.5rem;
}

.breadcrumb-separator {
    margin: 0 0.5rem;
    color: var(--text-secondary);
    font-weight: 300;
    user-select: none;
}

/* Main content */
main {
    margin-bottom: 3rem;
}

.generators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Generator cards */
.generator-card, .card {
    background: var(--card-bg);
    border-radius: 6px;
    box-shadow: 0 4px 6px var(--shadow);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--border-color);
}

.generator-card:hover, .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--shadow-hover);
}

.card-header {
    background: var(--accent-primary);
    color: white;
    padding: 1.5rem;
    text-align: center;
}

.card-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.card-header p {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 300;
}

.card-content {
    padding: 1.5rem;
}

/* Form elements */
.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

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

/* Checkbox group */
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

/* Buttons */
.generate-btn, .btn {
    width: 100%;
    background: var(--button-bg);
    color: white;
    border: none;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1rem;
}

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

.btn-secondary {
    background: var(--text-secondary);
}

.generate-btn:hover, .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow-hover);
}

.btn-primary:hover {
    background: var(--button-hover);
}

.btn-secondary:hover {
    background: var(--text-primary);
}

.generate-btn:active, .btn:active {
    transform: translateY(0);
}

/* Results */
.result, .result-container {
    min-height: 60px;
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    font-size: 1.1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    word-wrap: break-word;
    transition: all 0.3s ease;
}

.result.success {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    animation: resultPop 0.3s ease;
}

.result.yes {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.result.no {
    background: var(--error);
    color: white;
    border-color: var(--error);
}

@keyframes resultPop {
    0% {
        transform: scale(0.95);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Footer */
footer {
    background: var(--text-primary);
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: 3rem;
}

footer p {
    opacity: 0.8;
}

/* Footer navigation */
.footer-nav {
    margin-top: 1rem;
    text-align: center;
}

.footer-nav a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    margin: 0 1rem;
    font-size: 0.9rem;
}

.footer-nav a:hover {
    color: white;
}

/* Loading animation */
.loading {
    display: inline-block;
    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;
}

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

/* Copy functionality */
.copy-btn {
    background: var(--success);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 0.5rem;
    transition: background 0.2s ease;
}

.copy-btn:hover {
    background: #059669;
}

.copy-btn.copied {
    background: var(--accent-primary);
}

.copy-btn.copied::after {
    content: " ✓";
}

/* Homepage specific styles */
.intro-section {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.intro-section h2 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.intro-section p, .description {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 800px;
    margin: 0 auto 1rem auto;
    line-height: 1.7;
}

.generator-link {
    display: block;
    width: 100%;
    background: var(--accent-primary);
    color: white;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-top: 1rem;
    text-align: center;
    box-sizing: border-box;
}

.generator-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow-hover);
    background: var(--button-hover);
}

/* Ad cards */
.ad-card {
    border: 2px dashed #e2e8f0;
    background: linear-gradient(135deg, #fafafa, #f5f5f5);
    position: relative;
}

.ad-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(0,0,0,0.02) 10px,
        rgba(0,0,0,0.02) 20px
    );
    pointer-events: none;
}

.ad-card .card-header h2 {
    color: #6b7280;
    font-size: 1.1rem;
    opacity: 0.8;
    font-weight: 500;
}

.ad-card:hover {
    transform: none;
    border-color: #d1d5db;
}

.ad-content {
    position: relative;
    z-index: 1;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-content .adsbygoogle {
    width: 100%;
    min-height: 150px;
}

/* Content ads within articles */
.content-ad {
    margin: 2rem 0;
    padding: 1rem;
    background: linear-gradient(135deg, #f9fafb, #f3f4f6);
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    text-align: center;
    position: relative;
}

.content-ad::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 15px,
        rgba(0,0,0,0.02) 15px,
        rgba(0,0,0,0.02) 30px
    );
    pointer-events: none;
    border-radius: 6px;
}

.ad-label {
    font-size: 0.9rem;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
}

.ad-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Article ad styles (in-article format) */
.article-ad {
    margin: 2.5rem 0;
    padding: 1.2rem;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 2px dashed #f59e0b;
    border-radius: 10px;
    text-align: center;
    position: relative;
}

.article-ad::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 12px,
        rgba(245, 158, 11, 0.1) 12px,
        rgba(245, 158, 11, 0.1) 24px
    );
    pointer-events: none;
    border-radius: 8px;
}

/* Mobile ad styles (only visible on mobile) */
.mobile-ad {
    margin: 1.5rem 0;
    padding: 1rem;
    background: linear-gradient(135deg, #e0f2fe, #b3e5fc);
    border: 2px dashed #0288d1;
    border-radius: 8px;
    text-align: center;
    position: relative;
    display: none; /* Hidden by default */
}

.mobile-ad::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(2, 136, 209, 0.1) 10px,
        rgba(2, 136, 209, 0.1) 20px
    );
    pointer-events: none;
    border-radius: 6px;
}

/* Show mobile ads only on mobile devices */
@media (max-width: 768px) {
    .mobile-ad {
        display: block;
    }
}

.ad-wrapper .adsbygoogle {
    width: 100%;
    max-width: 100%;
}

.about-section {
    margin-top: 3rem;
    padding: 2rem;
    background: var(--card-bg);
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.about-section h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.feature {
    text-align: center;
    padding: 1rem;
}

.feature h3 {
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.feature p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Single page generator styles */
.page-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    align-items: start;
}

.generator-section {
    position: sticky;
    top: 2rem;
}

.generator-card.single {
    margin-bottom: 0;
}

.content-section, .info-section {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    line-height: 1.7;
}

.content-section h2 {
    color: var(--accent-primary);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
    border-bottom: 3px solid var(--accent-primary);
    padding-bottom: 1rem;
}

.content-section h3 {
    color: var(--text-primary);
    font-size: 1.4rem;
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.content-section h3:before {
    content: "📋";
    font-size: 1.2rem;
}

.content-section h4 {
    color: var(--accent-primary);
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.8rem;
}

.content-section h5 {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.content-section p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 1.2rem;
    max-width: 75ch;
}

.content-section ul {
    margin: 1rem 0 1.5rem 1.5rem;
    color: var(--text-secondary);
}

.content-section li {
    margin-bottom: 0.8rem;
    line-height: 1.6;
}

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

/* Numbered lists styling */
.content-section ol {
    margin: 1rem 0 1.5rem 1.5rem;
    color: var(--text-secondary);
    counter-reset: list-counter;
    list-style: none;
}

.content-section ol li {
    margin-bottom: 0.8rem;
    line-height: 1.6;
    counter-increment: list-counter;
    position: relative;
    padding-left: 2rem;
}

.content-section ol li::before {
    content: counter(list-counter) ".";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--accent-primary);
    font-weight: 700;
    font-size: 1.1rem;
}

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

/* Special styled sections */
.character-types, .password-strength {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.char-type, .strength-level {
    background: var(--bg-tertiary);
    padding: 1.5rem;
    border-radius: 6px;
    border-left: 4px solid var(--accent-primary);
}

.char-type h5, .strength-level h4 {
    margin-top: 0;
    color: var(--accent-primary);
}

.char-type p, .strength-level p {
    margin-bottom: 0;
    font-size: 0.95rem;
}

.info-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    margin-bottom: 1.5rem;
}

.info-card h2 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.info-card p, .info-card li {
    color: var(--text-secondary);
    line-height: 1.6;
}

.info-card ul {
    margin: 0.5rem 0 0 1.5rem;
}

/* Large button and result for ja/nej page */
.large-btn {
    padding: 1.5rem 2rem;
    font-size: 1.2rem;
    font-weight: 700;
}

.large-result {
    min-height: 80px;
    font-size: 2rem;
    font-weight: 700;
}

/* Error styling */
.error {
    color: white;
    background: var(--error);
    border: 1px solid var(--error);
    padding: 1rem;
    border-radius: 4px;
    text-align: center;
    margin: 1rem 0;
}

/* Enhanced single card layout */
.generator-card.single {
    grid-column: span 2;
    max-width: 800px;
    margin: 0 auto 0 auto;
}

/* Responsive design */
@media (max-width: 768px) {
    .generators-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .logo {
        font-size: 2rem;
    }
    
    .logo-icon {
        width: 40px;
        height: 40px;
    }
    
    .checkbox-group {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .page-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .generator-section {
        position: static;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-nav a {
        display: block;
        margin: 0.5rem 0;
    }
    
    /* Ensure result containers don't overflow */
    .result, .result-container {
        max-width: 100%;
        overflow-x: auto;
        word-break: break-word;
        box-sizing: border-box;
    }
    
    .generator-card.single {
        grid-column: span 1;
    }
    
    /* Content section mobile optimizations */
    .content-section, .info-section {
        padding: 1.5rem;
    }
    
    .content-section h2 {
        font-size: 1.5rem;
        text-align: left;
    }
    
    .content-section h3 {
        font-size: 1.2rem;
        margin-top: 2rem;
    }
    
    .content-section h4 {
        font-size: 1.1rem;
        margin-top: 1.5rem;
    }
    
    .character-types, .password-strength {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .char-type, .strength-level {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    header {
        padding: 1.5rem 0;
    }
    
    .logo {
        font-size: 1.75rem;
    }
    
    .logo-icon {
        width: 32px;
        height: 32px;
    }
    
    .tagline {
        font-size: 1rem;
    }
    
    .card-content {
        padding: 1rem;
    }
    
    /* Force containers to stay within viewport */
    .container, .generator-section, .result, .result-container {
        max-width: 100vw;
        overflow-x: hidden;
        box-sizing: border-box;
    }
    
    /* Content section extra small screens */
    .content-section {
        padding: 1rem;
    }
    
    .content-section h2 {
        font-size: 1.3rem;
        padding-bottom: 0.5rem;
    }
    
    .content-section h3 {
        font-size: 1.1rem;
        margin-top: 1.5rem;
    }
    
    .content-section ul {
        margin-left: 1rem;
    }
}