/**
 * Gerador de Pregação - Styles
 * Desenvolvido por B20 Conteúdo Digital
 * https://www.b20.com.br
 */

/* CSS Variables - Paleta Maroon & Burgundy */
:root {
    /* Cores da paleta escolhida */
    --primary-color: #800000;
    --secondary-color: #8B0000;
    --accent-color: #A52A2A;
    --surface-color: #B22222;
    --text-color: #DC143C;

    /* Variações automáticas */
    --primary-hover: color-mix(in srgb, var(--primary-color) 85%, black);
    --primary-light: color-mix(in srgb, var(--primary-color) 15%, white);
    --bg-color: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: color-mix(in srgb, var(--text-primary) 60%, transparent);

    /* Layout */
    --border-radius: 12px;
    --spacing-unit: 8px;
    --transition: all 0.3s ease;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);

    /* Typography */
    --font-family-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-family-content: 'Crimson Pro', Georgia, serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0f0f0f;
        --surface-color: #1a1a1a;
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
        --text-muted: color-mix(in srgb, var(--text-primary) 60%, transparent);
        --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    }
}

[data-theme="dark"] {
    --bg-color: #0f0f0f;
    --surface-color: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: color-mix(in srgb, var(--text-primary) 60%, transparent);
}

[data-theme="light"] {
    --bg-color: #ffffff;
    --surface-color: #f8f9fa;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: color-mix(in srgb, var(--text-primary) 60%, transparent);
}

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

html {
    font-size: clamp(14px, 2.5vw, 18px);
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-color);
    padding-top: 60px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@media (max-width: 767px) {
    body {
        padding-bottom: 70px;
    }
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-family-content);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: calc(var(--spacing-unit) * 2);
    color: var(--text-primary);
}

h1 {
    font-size: var(--font-size-3xl);
}

h2 {
    font-size: var(--font-size-2xl);
}

h3 {
    font-size: var(--font-size-xl);
}

h4 {
    font-size: var(--font-size-lg);
}

/* Editor Section Styles */
.editor-header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: calc(var(--spacing-unit) * 3);
    padding-bottom: calc(var(--spacing-unit) * 2);
    border-bottom: 2px solid var(--primary-color-light);
}

.editor-content-wrapper {
    background-color: var(--card-bg);
    padding: calc(var(--spacing-unit) * 3);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
}

.editor-meta-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: calc(var(--spacing-unit) * 2);
    margin-bottom: var(--spacing-unit);
}

@media (max-width: 768px) {
    .editor-meta-inputs {
        grid-template-columns: 1fr;
    }
}

.editor-points-section {
    background: color-mix(in srgb, var(--primary-color) 4%, transparent);
    padding: calc(var(--spacing-unit) * 2);
    border-radius: var(--border-radius);
    margin: calc(var(--spacing-unit) * 3) 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.point-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-unit);
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text-secondary);
}

.points-container {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 2);
}

.edit-point-card {
    background: var(--bg-color);
    padding: calc(var(--spacing-unit) * 2);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
}

.edit-point-card:hover {
    border-color: var(--primary-color-light);
}

/* Typography Enhancements for Editor */
#editor-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* End Editor Section Styles */

p {
    margin-bottom: calc(var(--spacing-unit) * 2);
    color: var(--text-secondary);
}

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

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Header Fixo */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: var(--shadow-sm);
    z-index: 1000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    white-space: nowrap;
    gap: 16px;
    /* Ensure minimum space between sections */
}

.header-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
    /* Never shrink logo */
}

.header-logo h1 {
    font-size: clamp(1rem, 2vw, var(--font-size-lg));
    /* Responsive sizing */
    margin: 0;
    color: var(--primary-color);
    font-weight: 600;
    white-space: nowrap;
}

.header-logo-img {
    height: 40px;
    width: auto;
    margin-right: calc(var(--spacing-unit) * 1.5);
    object-fit: contain;
}

/* Desktop Navigation */
.desktop-nav {
    display: none;
    gap: 8px;
}

@media (min-width: 768px) {
    .desktop-nav {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .desktop-nav .nav-link {
        padding: 8px 12px;
        border-radius: 50px;
        color: var(--text-secondary);
        text-decoration: none !important;
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        font-weight: 500;
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 0.9rem;
        letter-spacing: 0.01em;
        white-space: nowrap;
    }

    .desktop-nav .nav-link i {
        font-size: 1em;
    }

    .desktop-nav .nav-link:hover {
        background-color: color-mix(in srgb, var(--primary-color) 8%, transparent);
        color: var(--primary-color);
        transform: translateY(-1px);
    }

    .desktop-nav .nav-link.active {
        background-color: var(--primary-color);
        color: white;
        box-shadow: 0 2px 8px color-mix(in srgb, var(--primary-color) 30%, transparent);
        transform: translateY(0);
        font-weight: 600;
    }

    /* Hide text on tablets/small laptops to prevent cutting */
    .desktop-nav .nav-link span {
        display: none;
    }

    /* Adjust padding for icon-only mode */
    .desktop-nav .nav-link {
        padding: 8px 14px;
        justify-content: center;
    }

    .desktop-nav .nav-link i {
        font-size: 1.25em;
        /* Larger icons when text is hidden */
        margin: 0;
    }
}

@media (min-width: 1024px) {
    .desktop-nav {
        gap: 12px;
    }

    /* Restore text on larger screens */
    .desktop-nav .nav-link span {
        display: inline;
    }

    .desktop-nav .nav-link {
        padding: 8px 18px;
        font-size: 0.95rem;
        gap: 8px;
        justify-content: flex-start;
    }

    .desktop-nav .nav-link i {
        font-size: 1.1em;
        /* Reset icon size */
    }
}

@media (min-width: 768px) {
    .bottom-nav {
        display: none !important;
    }
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Bottom Navigation (Mobile) */
/* Bottom Navigation (Mobile) */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(60px + env(safe-area-inset-bottom, 0));
    background: color-mix(in srgb, var(--bg-color) 85%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    /* Align content to top of bar */
    padding-top: 8px;
    /* Padding from top edge */
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.06);
    border-top: 1px solid color-mix(in srgb, var(--text-primary) 5%, transparent);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 10px;
    /* Small legible label */
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 60px;
    opacity: 0.65;
    position: relative;
    border-radius: 8px;
}

.nav-item i {
    font-size: 22px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy transition */
    margin-bottom: 2px;
}

.nav-item span {
    font-weight: 500;
    letter-spacing: 0.02em;
}

.nav-item.active {
    color: var(--primary-color);
    opacity: 1;
}

.nav-item.active i {
    transform: translateY(-2px) scale(1.1);
    filter: drop-shadow(0 2px 4px color-mix(in srgb, var(--primary-color) 30%, transparent));
}

.nav-item.active span {
    font-weight: 600;
}

.nav-item:active i {
    transform: scale(0.9);
}

/* Container */
.container {
    max-width: 100%;
    padding: 16px;
    margin: 0 auto;
}

@media (min-width: 768px) {
    .container {
        max-width: 720px;
        padding: 24px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 960px;
    }
}

@media (min-width: 1440px) {
    .container {
        max-width: 1200px;
    }
}

/* Sections */
.section {
    display: none;
    min-height: calc(100vh - 60px);
    padding: calc(var(--spacing-unit) * 3) 0;
}

.section.active {
    display: block;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: calc(var(--spacing-unit) * 1);
    padding: calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 3);
    border: none;
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: var(--font-size-base);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
    min-width: 44px;
    margin: 10px 0;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

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

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

.btn-secondary {
    background: var(--surface-color);
    color: var(--text-primary);
    border: 1px solid color-mix(in srgb, var(--text-primary) 20%, transparent);
}

.btn-secondary:hover:not(:disabled) {
    background: color-mix(in srgb, var(--surface-color) 80%, var(--primary-color));
    transform: translateY(-1px);
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
    transform: translateY(-2px);
}

.btn-sm {
    padding: calc(var(--spacing-unit) * 1) calc(var(--spacing-unit) * 2);
    font-size: var(--font-size-sm);
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--surface-color);
    transform: scale(1.1);
}

.btn-help {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--surface-color);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: var(--font-size-xs);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Forms */
.form-group {
    margin-bottom: calc(var(--spacing-unit) * 3);
}

.form-group label {
    display: block;
    margin-bottom: calc(var(--spacing-unit) * 1);
    font-weight: 500;
    color: var(--text-primary);
}

.form-input,
.form-select {
    width: 100%;
    padding: calc(var(--spacing-unit) * 2);
    border: 2px solid color-mix(in srgb, var(--text-primary) 20%, transparent);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 16px;
    background: var(--bg-color);
    color: var(--text-primary);
    transition: var(--transition);
    min-height: 48px;
}

/* Share Actions in Settings */
.share-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.share-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    height: auto;
    width: 100%;
    margin: 0;
    transition: all 0.3s ease;
}

.share-btn i {
    font-size: 24px;
    margin-bottom: 4px;
}

.share-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-sm);
}



.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 20%, transparent);
}

.form-input.error,
.form-select.error {
    border-color: #dc3545;
}

.form-error {
    color: #dc3545;
    font-size: var(--font-size-sm);
    margin-top: calc(var(--spacing-unit) * 1);
    display: none;
}

.form-error.show {
    display: block;
}

.form-help {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-top: calc(var(--spacing-unit) * 1);
}

.form-actions {
    display: flex;
    gap: calc(var(--spacing-unit) * 2);
    flex-wrap: wrap;
}

@media (max-width: 767px) {
    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }
}

/* Cards */
.card {
    background: var(--bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: calc(var(--spacing-unit) * 3);
    transition: var(--transition);
    border: 1px solid color-mix(in srgb, var(--text-primary) 10%, transparent);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: calc(var(--spacing-unit) * 6) 0;
    margin-bottom: calc(var(--spacing-unit) * 6);
}

.hero-content h2 {
    font-size: var(--font-size-3xl);
    margin-bottom: calc(var(--spacing-unit) * 3);
    color: var(--primary-color);
}

.hero-content p {
    font-size: var(--font-size-lg);
    margin-bottom: calc(var(--spacing-unit) * 4);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions {
    display: flex;
    gap: calc(var(--spacing-unit) * 2);
    justify-content: center;
    flex-wrap: wrap;
}

@media (max-width: 767px) {
    .hero-actions {
        flex-direction: column;
        align-items: center;
    }

    .hero-actions .btn {
        width: 100%;
        max-width: 280px;
    }
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: calc(var(--spacing-unit) * 3);
    margin-bottom: calc(var(--spacing-unit) * 6);
}

.feature-card {
    background: var(--bg-color);
    padding: calc(var(--spacing-unit) * 4);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: var(--transition);
    border: 1px solid color-mix(in srgb, var(--text-primary) 10%, transparent);
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto calc(var(--spacing-unit) * 3);
}

.feature-icon i {
    font-size: 24px;
    color: var(--primary-color);
}

.feature-card h3 {
    margin-bottom: calc(var(--spacing-unit) * 2);
    color: var(--text-primary);
}

/* Generator Layout */
.generator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: calc(var(--spacing-unit) * 4);
    flex-wrap: wrap;
    gap: calc(var(--spacing-unit) * 2);
}

.ai-toggle-container {
    display: flex;
    align-items: center;
    gap: calc(var(--spacing-unit) * 1);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: var(--transition);
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
}

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

input:checked+.toggle-slider:before {
    transform: translateX(26px);
}

.toggle-label {
    font-weight: 500;
    color: var(--text-primary);
}

.generator-layout {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 4);
}

.generator-form,
.generator-preview {
    background: var(--bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: calc(var(--spacing-unit) * 3);
    border: 1px solid color-mix(in srgb, var(--text-primary) 10%, transparent);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: calc(var(--spacing-unit) * 3);
    flex-wrap: wrap;
    gap: calc(var(--spacing-unit) * 2);
}

.preview-actions {
    display: flex;
    gap: calc(var(--spacing-unit) * 1);
    flex-wrap: wrap;
}

.sermon-preview {
    min-height: 400px;
    padding: calc(var(--spacing-unit) * 3);
    background: var(--surface-color);
    border-radius: var(--border-radius);
    font-family: var(--font-family-content);
    line-height: 1.8;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: calc(var(--spacing-unit) * 6);
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: calc(var(--spacing-unit) * 3);
    color: var(--text-muted);
}

.empty-state h3,
.empty-state h4 {
    margin-bottom: calc(var(--spacing-unit) * 2);
    color: var(--text-secondary);
}

/* History */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: calc(var(--spacing-unit) * 4);
    flex-wrap: wrap;
    gap: calc(var(--spacing-unit) * 2);
}

.history-actions {
    display: flex;
    gap: calc(var(--spacing-unit) * 2);
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    min-width: 250px;
    padding: 10px 16px 10px 40px;
    border: 1px solid color-mix(in srgb, var(--text-primary) 20%, transparent);
    border-radius: 20px;
    font-family: inherit;
    font-size: var(--font-size-sm);
    background: var(--bg-color);
    color: var(--text-primary);
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 10%, transparent);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 3);
}

.history-item {
    background: var(--bg-color);
    border: 1px solid color-mix(in srgb, var(--text-primary) 10%, transparent);
    border-radius: var(--border-radius);
    padding: calc(var(--spacing-unit) * 3);
    margin-bottom: calc(var(--spacing-unit) * 2);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 2);
}

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

/* History Item Responsive Improvements */
.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: calc(var(--spacing-unit) * 1.5);
}

.history-item-info {
    width: 100%;
}

.history-item-info h3 {
    margin: 0 0 calc(var(--spacing-unit) * 1);
    color: var(--primary-color);
    font-size: var(--font-size-lg);
    line-height: 1.4;
}

.history-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--spacing-unit) * 1.5);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: calc(var(--spacing-unit) * 1);
}

.history-item-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: color-mix(in srgb, var(--surface-color) 50%, transparent);
    padding: 2px 8px;
    border-radius: 4px;
}

.history-item-preview {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.5;
    margin-bottom: calc(var(--spacing-unit) * 2);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-actions {
    display: flex;
    gap: calc(var(--spacing-unit) * 1);
    margin-top: auto;
    padding-top: calc(var(--spacing-unit) * 2);
    border-top: 1px dashed color-mix(in srgb, var(--text-primary) 10%, transparent);
    justify-content: flex-end;
    flex-wrap: wrap;
}

.history-item-actions .btn {
    padding: 8px 16px;
    font-size: var(--font-size-sm);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 767px) {
    .history-item-actions {
        justify-content: stretch;
        width: 100%;
    }

    .history-item-actions .btn {
        flex: 1 1 45%;
        /* Botões ocupam aprox 50% em mobile */
        justify-content: center;
        margin: 0;
        /* Remover margem extra se houver */
    }

    .history-item-meta {
        gap: 8px;
    }

    .history-item-meta span {
        font-size: var(--font-size-xs);
    }

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

    .history-actions {
        justify-content: space-between;
    }

    .search-box {
        flex-grow: 1;
    }

    .search-box input {
        min-width: unset;
    }
}

/* Settings */
.settings-grid {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 4);
    max-width: 800px;
    margin: 0 auto;
}

.settings-card {
    background: var(--bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: calc(var(--spacing-unit) * 4);
    border: 1px solid color-mix(in srgb, var(--text-primary) 10%, transparent);
}

.settings-card h3 {
    display: flex;
    align-items: center;
    gap: calc(var(--spacing-unit) * 2);
    margin-bottom: calc(var(--spacing-unit) * 3);
    color: var(--primary-color);
}

.setting-item {
    margin-bottom: calc(var(--spacing-unit) * 3);
}

.setting-item:last-child {
    margin-bottom: 0;
}

/* FAQ */
.faq-section {
    margin-top: calc(var(--spacing-unit) * 8);
}

.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    border: 1px solid color-mix(in srgb, var(--text-primary) 15%, transparent);
    border-radius: var(--border-radius);
    margin-bottom: calc(var(--spacing-unit) * 2);
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: calc(var(--spacing-unit) * 3);
    background: var(--surface-color);
    border: none;
    text-align: left;
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.faq-question:hover {
    background: color-mix(in srgb, var(--surface-color) 80%, var(--primary-color));
}

.faq-icon {
    font-size: var(--font-size-lg);
    font-weight: bold;
    color: var(--primary-color);
    transition: transform 0.3s ease;
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    padding: calc(var(--spacing-unit) * 3);
    background: var(--bg-color);
    border-top: 1px solid color-mix(in srgb, var(--text-primary) 10%, transparent);
}

.faq-answer[hidden] {
    display: none;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 1);
}

.toast {
    background: var(--text-primary);
    color: var(--bg-color);
    padding: calc(var(--spacing-unit) * 2) calc(var(--spacing-unit) * 3);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 320px;
    text-align: center;
}

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

.toast.success {
    background: #28a745;
}

.toast.error {
    background: #dc3545;
}

.toast.warning {
    background: #ffc107;
    color: #212529;
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.loading-content {
    background: var(--bg-color);
    padding: calc(var(--spacing-unit) * 4);
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid color-mix(in srgb, var(--primary-color) 20%, transparent);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto calc(var(--spacing-unit) * 2);
}

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

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

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 20px;
}

.modal-content {
    background: var(--bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(var(--spacing-unit) * 3);
    border-bottom: 1px solid color-mix(in srgb, var(--text-primary) 15%, transparent);
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--surface-color);
    color: var(--text-primary);
}

.modal-body {
    padding: calc(var(--spacing-unit) * 3);
}

/* Footer */
.app-footer {
    background: var(--surface-color);
    padding: calc(var(--spacing-unit) * 4) 0;
    margin-top: calc(var(--spacing-unit) * 8);
    text-align: center;
    border-top: 1px solid color-mix(in srgb, var(--text-primary) 15%, transparent);
}

.app-footer p {
    margin-bottom: calc(var(--spacing-unit) * 1);
    color: var(--text-secondary);
}

.b20-link {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.b20-link:hover {
    text-decoration: underline;
    transform: scale(1.05);
}

.footer-links {
    margin-top: calc(var(--spacing-unit) * 2);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: calc(var(--spacing-unit) * 2);
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.footer-links span {
    color: var(--text-muted);
}


/* Responsive Adjustments & Normalization */
@media (max-width: 767px) {
    body {
        padding-bottom: 70px;
    }

    /* Container Padding */
    .container {
        padding: 16px;
    }

    /* Header & Nav */
    .desktop-nav {
        display: none !important;
    }

    .bottom-nav {
        display: flex;
    }

    /* Generator Layout */
    .generator-header {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .generator-header h2 {
        text-align: center;
    }

    .ai-toggle-container {
        justify-content: center;
        width: 100%;
    }

    /* Forms */
    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    /* Hero */
    .hero-actions {
        flex-direction: column;
        width: 100%;
    }

    .hero-actions .btn {
        width: 100%;
    }

    .hero-content h2 {
        font-size: var(--font-size-2xl);
    }

    /* History & Cards */
    .history-header {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .history-actions {
        flex-direction: column;
        width: 100%;
    }

    .search-box {
        width: 100%;
    }

    .search-box input {
        min-width: unset;
    }

    .history-item-actions {
        justify-content: stretch;
    }

    .history-item-actions .btn {
        flex: 1 1 100%;
        /* Full width on small mobile */
    }

    /* Editor */
    .editor-header-main {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        text-align: center;
    }

    .editor-actions-main {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .editor-actions-main .btn {
        width: 100%;
    }

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

    /* Layout Grids */
    .features-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    /* Touch Targets */
    .btn,
    .form-input,
    .form-select,
    .nav-item {
        min-height: 48px;
        /* Better touch area */
    }
}

/* Tablet (Small) Specific */
@media (min-width: 480px) and (max-width: 768px) {
    .history-item-actions .btn {
        flex: 1 1 45%;
        /* 2 buttons per row on tablet/large phone */
    }

    .editor-actions-main {
        flex-direction: row;
    }
}


/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus Styles */
button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print Styles */
@media print {

    .app-header,
    .bottom-nav,
    .btn,
    .modal,
    .toast-container,
    .loading-overlay {
        display: none !important;
    }

    body {
        padding: 0;
        font-size: 12pt;
        line-height: 1.4;
    }

    .section {
        display: block !important;
        page-break-inside: avoid;
    }
}

/* Utility Classes */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-1 {
    margin-bottom: calc(var(--spacing-unit) * 1) !important;
}

.mb-2 {
    margin-bottom: calc(var(--spacing-unit) * 2) !important;
}

.mb-3 {
    margin-bottom: calc(var(--spacing-unit) * 3) !important;
}

.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg,
            color-mix(in srgb, var(--text-primary) 10%, transparent) 25%,
            color-mix(in srgb, var(--text-primary) 5%, transparent) 50%,
            color-mix(in srgb, var(--text-primary) 10%, transparent) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--border-radius);
}

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

    100% {
        background-position: -200% 0;
    }
}