:root {
    --bg-dark: #0a0a0f;
    --card-bg: rgba(20, 20, 28, 0.6);
    --primary: #00f0ff;
    --primary-dim: rgba(0, 240, 255, 0.1);
    --secondary: #7000ff;
    --danger: #ff0055;
    --success: #00ff9d;
    --text-main: #ffffff;
    --text-muted: #8a8a9b;
    --border: rgba(255, 255, 255, 0.08);
    --glow: 0 0 20px rgba(0, 240, 255, 0.3);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    position: relative;
    padding: 2rem 0;
}

/* Background Effects */
.background-globes {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.globe {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
}

.globe-1 {
    width: 400px;
    height: 400px;
    background: var(--secondary);
    top: -10%;
    left: -10%;
    animation: float 20s infinite alternate;
}

.globe-2 {
    width: 500px;
    height: 500px;
    background: var(--primary);
    bottom: -10%;
    right: -10%;
    animation: float 15s infinite alternate-reverse;
}

@keyframes float {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(50px, 50px);
    }
}

.container {
    width: 100%;
    max-width: 1000px;
    padding: 2rem;
    z-index: 1;
}

/* Typography */
header {
    text-align: center;
    margin-bottom: 3rem;
}

.badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 50px;
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.1);
}

/* Offline Indicator */
.offline-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: rgba(255, 165, 0, 0.15);
    border: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: 50px;
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: #ffa500;
    margin: 0 auto 1rem;
    max-width: 400px;
    animation: pulse 2s infinite;
    box-shadow: 0 0 15px rgba(255, 165, 0, 0.2);
}

.offline-indicator svg {
    flex-shrink: 0;
    animation: rotate 3s linear infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

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

/* Online Notification */
.online-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    background: var(--success);
    color: var(--bg-dark);
    border-radius: 12px;
    font-weight: 600;
    z-index: 10000;
    box-shadow: 0 4px 20px rgba(0, 255, 157, 0.3);
    animation: slideIn 0.3s ease-out;
    font-family: 'Outfit', sans-serif;
}

.online-notification.fade-out {
    animation: slideOut 0.3s ease-in forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Offline Mode Styling */
body.offline-mode .generator-card {
    border-color: rgba(255, 165, 0, 0.3);
}

body.offline-mode .primary-btn {
    background: linear-gradient(135deg, #ffa500, #ff8c00);
}

h1 {
    font-size: 3.5rem;
    line-height: 1.1;
    font-weight: 700;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #fff 0%, #a5a5b5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
}

h1 span {
    font-weight: 300;
    font-size: 2.5rem;
    color: var(--text-muted);
}

p {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.6;
    margin: 0 auto 3rem auto;
    max-width: 600px;
}

/* Card Styling */
.generator-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    margin-bottom: 3rem;

    /* 2-Column Grid Layout */
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
        "controls meta"
        "output transport"
        "actions transport";
    gap: 2.5rem;
    align-items: start;
}

.generator-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0.5;
}

/* Assign Grid Areas */
.controls {
    grid-area: controls;
    margin-bottom: 0;
    justify-content: flex-start;
    display: flex;
    flex-wrap: wrap;
    /* Allow wrapping */
    gap: 1.5rem;
    /* Space between toggles */
}

.output-group {
    grid-area: output;
}

.meta-data-grid {
    grid-area: meta;
    margin-bottom: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.transport-section {
    grid-area: transport;
    margin-bottom: 0;
}

.action-buttons {
    grid-area: actions;
}

/* Responsive Adjustments */
@media (max-width: 900px) {
    .generator-card {
        grid-template-columns: 1fr;
        grid-template-areas:
            "controls"
            "output"
            "actions"
            "meta"
            "transport";
    }

    .meta-data-grid {
        grid-template-columns: 1fr 1fr;
    }

    .controls {
        justify-content: center;
    }
}

.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 50px;
    border: 1px solid var(--border);
    white-space: nowrap;
    /* Prevent label wrapping inside the pill */
}

.toggle-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

.toggle-label.highlight {
    color: var(--text-main);
}

/* Switch UI */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--danger);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

/* Inputs & Labels */
label {
    display: block;
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
    letter-spacing: 1px;
}

.input-wrapper {
    position: relative;
    margin-bottom: 1rem;
    /* Reduced for strength meter */
}

input[type="text"] {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem;
    padding-right: 90px;
    /* Space for buttons */
    font-family: 'Space Mono', monospace;
    color: var(--primary);
    font-size: 1.1rem;
    outline: none;
    transition: all 0.3s ease;
}

input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-dim);
}

.input-actions-right {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 0.5rem;
}

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

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

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

.clipboard-msg {
    position: absolute;
    right: 0;
    top: -25px;
    font-size: 0.8rem;
    color: var(--primary);
    opacity: 0;
    transition: opacity 0.3s;
}

.clipboard-msg.visible {
    opacity: 1;
}

/* Strength Meter */
.strength-container {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--danger));
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px var(--danger);
}

/* QR Code Section */
.qr-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: white;
    margin-top: 1rem;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    padding: 0;
    /* Animated padding handled in JS/Logic or static */
}

.qr-container.visible {
    padding: 1rem;
    max-height: 200px;
}


/* Meta Data Grid */
.meta-data-grid {
    display: grid;
    /* grid-template-columns set in container rules */
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.code-block-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.code-block {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
    word-break: break-all;
    min-height: 80px;
    display: flex;
    align-items: center;
    flex: 1;
}

.copy-btn-small {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.copy-btn-small:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary);
}

.copy-btn-small.copied {
    color: var(--success);
}

.code-block.small {
    font-size: 0.7rem;
    max-height: 100px;
    overflow-y: auto;
}

.transport-section {
    margin-bottom: 2.5rem;
}

.transport-section .code-block {
    max-height: none;
    min-height: 80px;
    overflow-y: visible;
    word-break: break-word;
    white-space: normal;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
}

.primary-btn {
    flex: 1;
    padding: 1.2rem;
    border: none;
    border-radius: 12px;
    background: var(--text-main);
    color: var(--bg-dark);
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s;
}

.secondary-btn {
    width: 60px;
    padding: 1.2rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-main);
}

.secondary-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.primary-btn:hover {
    transform: translateY(-2px);
}

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

.btn-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 240, 255, 0.4) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.primary-btn:hover .btn-glow {
    opacity: 1;
}

/* FAQ Section */
.faq-section {
    width: 100%;
    margin: 0 auto;
}

.faq-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--text-main);
}

.faq-item {
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
}

.faq-question {
    width: 100%;
    text-align: left;
    padding: 1.2rem;
    background: none;
    border: none;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s;
}

.faq-question:hover {
    background: rgba(255, 255, 255, 0.05);
}

.faq-question:after {
    content: '+';
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--primary);
}

.faq-question.active:after {
    content: '-';
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: rgba(0, 0, 0, 0.2);
}

.faq-answer p {
    padding: 1.2rem;
    font-size: 1rem;
    color: var(--text-muted);
}

/* Loading State */
.loading {
    opacity: 0.8;
    cursor: wait;
}

.mono-font {
    font-family: 'Space Mono', monospace;
}

/* Theme Toggle Button */
.theme-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.3s;
}

.theme-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--primary);
}

/* Word Count Select */
.word-select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    color: var(--text-main);
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
}

.word-select:focus {
    border-color: var(--primary);
}

/* Light Theme */
body.light-theme {
    --bg-dark: #f5f5f7;
    --card-bg: rgba(255, 255, 255, 0.8);
    --text-main: #1a1a2e;
    --text-muted: #6b6b7a;
    --border: rgba(0, 0, 0, 0.1);
    --primary: #0066ff;
    --primary-dim: rgba(0, 102, 255, 0.1);
}

body.light-theme .globe-1,
body.light-theme .globe-2 {
    opacity: 0.2;
}

body.light-theme input[type="text"] {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .code-block {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .toggle-wrapper {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .word-select {
    background: rgba(0, 0, 0, 0.05);
}

body.light-theme .theme-btn {
    background: rgba(0, 0, 0, 0.1);
}

/* Footer */
.site-footer {
    text-align: center;
    margin-top: 3rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

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

.footer-copyright {
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.7;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    h1 {
        font-size: 2rem;
    }

    h1 span {
        font-size: 1.5rem;
    }

    .container {
        padding: 1rem;
    }

    .generator-card {
        padding: 1.5rem;
        border-radius: 16px;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .toggle-wrapper {
        padding: 0.6rem 1rem;
        justify-content: space-between;
    }

    .theme-btn {
        align-self: center;
    }

    input[type="text"] {
        font-size: 0.9rem;
        padding: 1rem;
        padding-right: 70px;
    }

    .primary-btn {
        padding: 1rem;
        font-size: 1rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .secondary-btn {
        width: 100%;
    }

    .faq-question {
        font-size: 0.95rem;
        padding: 1rem;
    }

    .footer-links {
        gap: 1.5rem;
    }

    .badge {
        font-size: 0.7rem;
        padding: 0.3rem 0.8rem;
    }
}