/**
 * Gerador de Sorteios Online
 * Desenvolvido por B20 Conteúdo Digital
 * https://www.b20.com.br
 */

/* ===== CSS VARIABLES ===== */
:root {
    /* Paleta Amazon Orange */
    --primary-color: #FF9900;
    --secondary-color: #232F3E;
    --accent-color: #37475A;
    --surface-color: #FFFFFF;
    --text-color: #146EB4;
    
    /* Variações automáticas */
    --primary-hover: #E68A00;
    --primary-light: #FFB84D;
    --bg-color: #F5F5F5;
    --text-muted: #6B7280;
    --border-color: #E5E7EB;
    --success-color: #10B981;
    --error-color: #EF4444;
    --warning-color: #F59E0B;
    
    /* Layout */
    --border-radius: 12px;
    --spacing-unit: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --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);
    
    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'Courier New', Courier, monospace;
}

/* Dark Mode */
[data-theme="dark"] {
    /* Backgrounds */
    --bg-color: #121212;
    --surface-color: #1E1E1E;

    /* Text Colors */
    --text-color: #F3F4F6;
    --text-muted: #9CA3AF;
    --primary-color: #FBBF24; /* Amarelo mais claro para melhor contraste */
    --secondary-color: #6B7280;
    --accent-color: #8B5CF6;

    /* Borders and Separators */
    --border-color: #374151;

    /* Interactive States */
    --primary-hover: #F59E0B;
    --primary-light: rgba(251, 191, 36, 0.1);

    /* Status Colors */
    --success-color: #10B981;
    --error-color: #EF4444;
    --warning-color: #F59E0B;

    /* Shadows with better visibility on dark */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: clamp(14px, 2.5vw, 18px);
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding-top: 60px;
    padding-bottom: 70px;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== HEADER ===== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--surface-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: var(--transition);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-color);
}

.header-logo img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: contain;
}

.header-logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
}

.desktop-nav {
    display: none;
}

.header-actions {
    display: flex;
    gap: 8px;
}

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

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

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

#language-toggle {
    gap: 4px;
}

.lang-text {
    font-size: 12px;
    font-weight: 600;
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65px;
    background: var(--surface-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    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: 8px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 11px;
    transition: var(--transition);
    min-width: 64px;
    min-height: 48px;
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: rgba(255, 153, 0, 0.2);
}

.nav-item i {
    font-size: 20px;
    transition: transform 0.2s ease;
}

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

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

.nav-item:hover {
    background: rgba(255, 153, 0, 0.1);
    color: var(--text-color);
}

.nav-item:active {
    background: rgba(255, 153, 0, 0.2);
    transform: scale(0.95);
    transition: all 0.1s ease;
}

/* ===== MAIN CONTENT ===== */
main {
    min-height: calc(100vh - 130px);
}

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

.section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.section.active {
    display: block;
}

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

/* ===== HERO SECTION ===== */
.hero-section {
    text-align: center;
    padding: 24px 0;
    margin-bottom: 32px;
}

.hero-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-color);
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
}

/* ===== RAFFLE TYPE SELECTOR ===== */
.raffle-type-selector {
    margin-bottom: 32px;
}

.raffle-type-selector h3 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: var(--text-color);
}

.type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.type-card {
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.type-card i {
    font-size: 32px;
    color: var(--text-muted);
    transition: var(--transition);
}

.type-card span {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}

.type-card small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.type-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.type-card.active {
    background: var(--primary-light);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.type-card.active i,
.type-card.active span,
.type-card.active small {
    color: white;
}

/* ===== RAFFLE CONFIG ===== */
.raffle-config {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.config-section {
    margin-bottom: 24px;
}

.config-section h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--text-color);
}

.input-group {
    position: relative;
}

.participants-textarea {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: var(--font-family);
    font-size: 1rem;
    resize: vertical;
    background: var(--surface-color);
    color: var(--text-color);
    transition: var(--transition);
}

.participants-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.participants-textarea::placeholder {
    color: var(--text-muted);
}

.input-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.participant-count {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.participant-count i {
    color: var(--primary-color);
}

/* Number Range Inputs */
.number-range-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.input-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.input-field input {
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background: var(--surface-color);
    color: var(--text-color);
    transition: var(--transition);
}

.input-field input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.input-field input::placeholder {
    color: var(--text-muted);
}

/* Options */
.options-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.option-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.option-field input {
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background: var(--bg-color);
    color: var(--text-color);
    transition: var(--transition);
}

.option-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.option-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.option-checkbox label {
    cursor: pointer;
    color: var(--text-color);
    font-size: 0.9rem;
}

/* ===== BUTTONS ===== */
.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    text-decoration: none;
    min-height: 48px;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--surface-color);
    box-shadow: var(--shadow-sm);
}

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

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-primary:disabled {
    background: var(--text-muted);
    color: var(--surface-color);
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--surface-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.btn-large {
    width: 100%;
    padding: 16px 24px;
    font-size: 1.1rem;
}

.btn-draw {
    margin-top: 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
}

/* ===== RESULTS SECTION ===== */
.results-section {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-top: 24px;
    box-shadow: var(--shadow-lg);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.results-header h3 {
    font-size: 1.25rem;
    color: var(--text-color);
}

.results-animation {
    text-align: center;
    padding: 48px 24px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 1s linear infinite;
}

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

.results-animation p {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.results-content {
    animation: fadeIn 0.5s ease;
}

.winner-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.winner-card {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-md);
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.winner-card .winner-icon {
    font-size: 32px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.winner-card .winner-info {
    flex: 1;
}

.winner-card .winner-position {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-bottom: 4px;
}

.winner-card .winner-name {
    font-size: 1.25rem;
    font-weight: 700;
}

.results-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.results-actions button {
    flex: 1;
    min-width: 140px;
}

/* ===== HISTORY SECTION ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 1.5rem;
    color: var(--text-color);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.history-item {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.history-type {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--primary-light);
    color: var(--primary-color);
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.history-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.history-winners {
    margin-top: 12px;
}

.history-winner {
    padding: 8px 12px;
    background: var(--bg-color);
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-color);
}

.history-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.history-actions button {
    flex: 1;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 64px 24px;
}

.empty-state i {
    font-size: 64px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

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

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ===== FAQ SECTION ===== */
.faq-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.faq-item {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.faq-question {
    width: 100%;
    padding: 20px;
    background: transparent;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    text-align: left;
    transition: var(--transition);
}

.faq-question:hover {
    background: var(--bg-color);
}

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

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

.faq-answer {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-answer:not([hidden]) {
    padding: 0 20px 20px;
    max-height: 500px;
}

.faq-answer p {
    color: var(--text-muted);
    line-height: 1.6;
}

/* ===== ABOUT SECTION ===== */
.about-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 32px 0;
}

.about-card {
    background: var(--surface-color);
    padding: 24px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

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

.about-card i {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.about-card h3 {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 8px;
}

.about-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.about-features {
    background: var(--surface-color);
    padding: 24px;
    border-radius: var(--border-radius);
    margin: 32px 0;
    box-shadow: var(--shadow-md);
}

.about-features h3 {
    font-size: 1.25rem;
    color: var(--text-color);
    margin-bottom: 16px;
}

.features-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.features-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-color);
}

.features-list i {
    color: var(--success-color);
    font-size: 1.1rem;
}

.about-privacy {
    background: var(--surface-color);
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

.about-privacy h3 {
    font-size: 1.25rem;
    color: var(--text-color);
    margin-bottom: 12px;
}

.about-privacy p {
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.6;
}

/* ===== TOAST NOTIFICATION ===== */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--surface-color);
    color: var(--text-color);
    border: 2px solid var(--border-color);
    padding: 16px 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2000;
    max-width: 90%;
    text-align: center;
    font-weight: 500;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--success-color);
    color: var(--surface-color);
    border-color: var(--success-color);
}

.toast.error {
    background: var(--error-color);
    color: var(--surface-color);
    border-color: var(--error-color);
}

.toast.warning {
    background: var(--warning-color);
    color: var(--surface-color);
    border-color: var(--warning-color);
}

/* ===== FOOTER ===== */
.app-footer {
    text-align: center;
    padding: 24px 16px;
    background: var(--surface-color);
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 48px;
}

.footer-logo {
    margin-bottom: 12px;
}

.footer-logo img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: contain;
}

.app-footer p {
    margin: 4px 0;
}

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

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

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

.privacy-link {
    color: var(--primary-color);
    font-weight: 500;
}

.privacy-link:hover {
    text-decoration: underline;
}

/* ===== UTILITY CLASSES ===== */
.hidden {
    display: none !important;
}

.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;
}
