/**
 * Registro de Micções - Controle de Intervalo Urinário
 * Desenvolvido por B20 Conteúdo Digital
 * https://www.b20.com.br
 */

/* ===== CSS VARIABLES (Paleta Uber Dark) ===== */
:root {
    /* Cores da paleta - NÃO ALTERE */
    --primary-color: #000000;
    --secondary-color: #FFFFFF;
    --accent-color: #276EF1;
    --surface-color: #5FB709;
    --text-color: #EEEEEE;
    
    /* Variações automáticas */
    --primary-hover: #1a1a1a;
    --primary-light: #f5f5f5;
    --bg-color: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #000000;
    --text-secondary: #666666;
    --text-muted: #999999;
    
    /* Cores de feedback */
    --success-color: #5FB709;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #276EF1;
    
    /* Sombras */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    
    /* Layout */
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    --spacing-unit: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    --header-padding: 20px;
    
    /* Tipografia */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-base: 16px;
    --font-size-sm: 14px;
    --font-size-lg: 18px;
    --font-size-xl: 24px;
    --font-size-2xl: 32px;
    --line-height: 1.6;
}

[data-theme="dark"] {
    --bg-color: #121212;
    --bg-secondary: #1e1e1e;
    --text-primary: #EEEEEE;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --primary-light: #2a2a2a;
}

/* ===== 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;
    touch-action: manipulation;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: var(--line-height);
    color: var(--text-primary);
    background-color: var(--bg-color);
    padding-top: 60px;
    padding-bottom: 70px;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== 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 var(--header-padding);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-logo {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.header-logo i {
    font-size: 24px;
    color: var(--accent-color);
}

.header-logo h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Desktop Navigation - Escondido no Mobile */
.desktop-nav {
    display: none;
}

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

.btn-icon {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.btn-icon:hover {
    background: var(--accent-color);
    color: var(--secondary-color);
    border-color: var(--accent-color);
    transform: rotate(15deg) scale(1.1);
    box-shadow: 0 0 15px rgba(39, 110, 241, 0.4);
}

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

.btn-icon i {
    font-size: 20px;
    transition: var(--transition);
}

/* Efeito específico para o ícone de lua/sol no toggle */
#theme-toggle:hover i {
    filter: drop-shadow(0 0 5px currentColor);
}

/* ===== BOTTOM NAVIGATION (Mobile) ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65px;
    background: var(--bg-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    padding: 0 10px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    border-top: 1px solid var(--primary-light);
}

.hidden {
    display: none;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    transition: var(--transition);
    min-width: 60px;
    flex: 1;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    z-index: 10;
}

.nav-item i {
    font-size: 22px;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-item span {
    font-size: 10px;
    white-space: nowrap;
}

.nav-item i,
.nav-item span {
    pointer-events: none;
}

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

.nav-item.active i {
    transform: scale(1.2) translateY(-2px);
}

/* FAB Central Ajustado */
.nav-item-fab {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    background: var(--accent-color);
    border-radius: 50%;
    margin-top: -32px;
    color: var(--secondary-color) !important;
    box-shadow: 0 8px 16px rgba(39, 110, 241, 0.3);
    border: 4px solid var(--bg-color);
    z-index: 1001;
}

.nav-item-fab i {
    font-size: 24px;
}

.nav-item-fab span {
    display: none;
}

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

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

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

/* ===== TIMER CONTAINER ===== */
.timer-container {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 16px;
    margin: 24px auto;
    max-width: 300px;
    text-align: center;
    border: 2px solid var(--accent-color);
    animation: pulse-soft 2s infinite;
}

.timer-label {
    display: block;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.timer-value {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--accent-color);
}

@keyframes pulse-soft {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(39, 110, 241, 0.2); }
    50% { transform: scale(1.02); box-shadow: 0 0 0 10px rgba(39, 110, 241, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(39, 110, 241, 0); }
}

/* ===== HERO SECTION ===== */
.hero-section {
    text-align: center;
    padding: 32px 16px;
}

.hero-logo-container {
    width: 100px;
    height: 100px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.footer-logo {
    height: 24px;
    width: auto;
    object-fit: contain;
}

.hero-section h2 {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.hero-subtitle {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    max-width: 400px;
    margin: 0 auto;
}

/* ===== ACTION SECTION ===== */
.action-section {
    text-align: center;
    padding: 24px 16px;
}

.btn-primary {
    background: var(--accent-color);
    color: var(--secondary-color);
    border: none;
    padding: 16px 32px;
    border-radius: var(--border-radius);
    font-size: var(--font-size-lg);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

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

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

.btn-primary.register-success {
    background: var(--success-color);
    transform: scale(0.95);
}

.btn-large {
    padding: 20px 40px;
    font-size: var(--font-size-xl);
}

.action-hint {
    margin-top: 12px;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

/* ===== BUTTONS ===== */
.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--primary-light);
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-base);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-danger {
    background: var(--danger-color);
    color: var(--secondary-color);
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-base);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-icon-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

@media (max-width: 480px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-actions-group {
        width: 100%;
        justify-content: space-between;
    }
}

.section-header h2,
.section-header h3 {
    font-size: var(--font-size-xl);
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

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

.link-view-all {
    color: var(--accent-color);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 600;
    transition: var(--transition);
}

.link-view-all:hover {
    text-decoration: underline;
}

/* ===== RECORDS LIST ===== */
.records-list,
.records-preview {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.record-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.record-main-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.record-comment-section {
    width: 100%;
    border-top: 1px solid var(--primary-light);
    padding-top: 12px;
}

.comment-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-color);
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--primary-light);
    transition: var(--transition);
}

.comment-input-wrapper:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(39, 110, 241, 0.1);
}

.comment-input-wrapper i {
    color: var(--text-muted);
    font-size: 14px;
}

.comment-input {
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    width: 100%;
    outline: none;
    font-family: inherit;
}

.comment-input::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.record-comment-preview {
    margin-top: 8px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-style: italic;
}

.record-comment-preview i {
    color: var(--accent-color);
    margin-top: 3px;
    font-size: 12px;
}

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

.record-info {
    flex: 1;
}

.record-datetime {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.record-interval {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.record-interval i {
    color: var(--accent-color);
}

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

.btn-delete {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--danger-color);
    color: var(--secondary-color);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-delete:hover {
    background: #c82333;
    transform: scale(1.1);
}

/* ===== QUICK STATS ===== */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-top: 32px;
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    transition: var(--transition);
    border-top: 4px solid var(--accent-color);
}

.stat-card:nth-child(2) { border-top-color: var(--surface-color); }
.stat-card:nth-child(3) { border-top-color: var(--warning-color); }

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

.stat-card i {
    font-size: 32px;
    color: var(--accent-color);
}

.stat-card:nth-child(2) i { color: var(--surface-color); }
.stat-card:nth-child(3) i { color: var(--warning-color); }

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 2px;
}

.stat-value {
    font-size: var(--font-size-xl);
    font-weight: 800;
    color: var(--text-primary);
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card-large {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    transition: var(--transition);
    border: 1px solid var(--primary-light);
}

.stat-card-large:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-5px);
    border-color: var(--accent-color);
}

.stat-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
    transition: var(--transition);
}

.stat-card-large:hover .stat-icon {
    background: var(--accent-color);
    color: var(--secondary-color);
}

.stat-icon i {
    font-size: 28px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value-large {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-primary);
}

.stats-info-box {
    background: var(--primary-light);
    border-left: 4px solid var(--accent-color);
    padding: 16px;
    border-radius: var(--border-radius-sm);
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.stats-info-box i {
    color: var(--accent-color);
    font-size: 20px;
    margin-top: 2px;
}

.stats-info-box p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

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

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

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

.faq-question:hover {
    background: var(--primary-light);
}

.faq-icon {
    font-size: 24px;
    font-weight: 300;
    color: var(--accent-color);
    transition: transform 0.3s ease;
}

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

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

.faq-question[aria-expanded="true"] + .faq-answer {
    padding: 0 16px 16px;
    max-height: 500px;
    opacity: 1;
}

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

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    border: 2px dashed var(--primary-light);
    margin: 20px 0;
}

.empty-state i {
    font-size: 64px;
    color: var(--accent-color);
    opacity: 0.3;
    margin-bottom: 24px;
    display: block;
}

.empty-state h3 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal[hidden] {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 100%;
    animation: modalSlideUp 0.3s ease;
}

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

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--primary-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.modal-body p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--primary-light);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: var(--bg-color);
    padding: 12px 24px;
    border-radius: var(--border-radius);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    max-width: 90%;
    pointer-events: none;
}

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

.toast-icon {
    font-size: 20px;
}

.toast-message {
    font-size: var(--font-size-sm);
    font-weight: 500;
}

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

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

.toast.info {
    background: var(--info-color);
}

/* ===== FOOTER ===== */
.app-footer {
    text-align: center;
    padding: 40px 20px 8rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--primary-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.app-footer p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

.footer-brand {
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.footer-brand i {
    color: var(--accent-color);
}

.b20-link {
    color: var(--accent-color);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    padding: 4px 8px;
    border-radius: 4px;
}

.b20-link:hover {
    background: rgba(39, 110, 241, 0.1);
    color: #1e5dd1;
    text-decoration: underline;
}

.footer-divider {
    width: 40px;
    height: 2px;
    background: var(--primary-light);
    margin: 8px 0;
}

/* ===== 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;
}

/* ===== LOADING SKELETON ===== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--border-radius-sm);
}

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