:root {
    --primary: #10b981;
    --primary-dark: #059669;
    --accent-glow: rgba(16, 185, 129, 0.4);
    --safe-area-bottom: env(safe-area-inset-bottom, 20px);
}

/* CRITICAL: Prevent conflict between our old .fab class and FontAwesome Brands (.fab) */
i.fab, i.fa-brands {
    position: static !important;
    width: auto !important;
    height: auto !important;
    border-radius: 0 !important;
    background: none !important;
    box-shadow: none !important;
    z-index: auto !important;
}

/* === MODO OSCURO (por defecto) === */
html, html[data-bg="dark"] {
    --bg-gradient: linear-gradient(135deg, #020617 0%, #0f172a 100%);
    --bg-solid: #020617;
    --glass: rgba(15, 23, 42, 0.8);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --input-bg: rgba(0, 0, 0, 0.3);
    --card-bg: rgba(255, 255, 255, 0.03);
}

/* === MODO CLARO === */
html[data-bg="light"] {
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --bg-solid: #f8fafc;
    --glass: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.12);
    --text: #0f172a;
    --text-muted: #475569;
    --input-bg: rgba(0, 0, 0, 0.05);
    --card-bg: rgba(255, 255, 255, 0.6);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg-gradient);
    background-color: var(--bg-solid);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text);
    overflow-x: hidden;
    padding-bottom: calc(80px + var(--safe-area-bottom));
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Glassmorphism */
.glass-panel {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
}

.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    transition: transform 0.3s ease, background 0.3s ease;
}

.glass-card:active {
    transform: scale(0.98);
}

/* Layout */
.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 1.5rem;
}

header {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--primary), #dcfce7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: var(--safe-area-bottom);
    left: 50%;
    transform: translateX(-50%);
    width: 98%;
    max-width: 500px;
    height: 60px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    padding: 0 2px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.55rem;
    gap: 2px;
    transition: color 0.3s ease;
    flex: 1;
    min-width: 0;
    text-align: center;
    padding: 4px 0;
}

.nav-item span {
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

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

.nav-item i {
    font-size: 1.1rem;
}

/* Sections */
.section {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.section.active {
    display: block;
}

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

/* Inputs & Buttons (UNA SOLA VEZ) */
.form-group {
    margin-bottom: 1.2rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

input, textarea, select {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease, background 0.3s ease, color 0.3s ease;
}

input:focus {
    border-color: var(--primary);
}

.btn {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(to right, var(--primary), var(--primary-dark));
    color: white;
}

.btn-whatsapp {
    background: #25D366;
    color: white;
}

.btn-location {
    background: #ea4335;
    color: white;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    width: auto;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

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

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* List Items */
.list-item {
    margin-bottom: 1rem;
}

.list-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.list-item-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.list-item-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.list-item-body {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.list-item-actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    text-decoration: none;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.action-btn:active {
    transform: scale(0.9);
}

.action-btn i {
    pointer-events: none;
}

/* Floating Action Button */
.fab-button {
    position: fixed;
    bottom: calc(90px + var(--safe-area-bottom));
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 28px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px var(--accent-glow);
    z-index: 999;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

.modal-content {
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* Photo Features */
.photo-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.photo-preview-item {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
}

.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview-item .remove-photo {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(239, 68, 68, 0.8);
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
}

.revisita-photos-container {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.revisita-photo {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--glass-border);
}

/* Notes Module Styles */
.nota-card {
    border-radius: 10px;
    padding: 12px;
    color: #f1f5f9;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
    min-height: 100px;
    display: flex;
    flex-direction: column;
}

.nota-card:active {
    transform: scale(0.98);
}

.nota-title {
    font-weight: bold;
    font-size: 0.95rem;
    margin-bottom: 5px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    padding-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nota-content-preview {
    font-size: 0.8rem;
    opacity: 0.9;
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

.nota-date {
    font-size: 0.65rem;
    opacity: 0.6;
    text-align: right;
    margin-top: 5px;
    padding-right: 35px; /* Spacing for the share button */
}

.share-nota-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 28px;
    height: 28px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(255,255,255,0.1);
    z-index: 5;
}

.share-nota-btn:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.1);
}

.share-nota-btn i {
    font-size: 0.75rem;
    color: white;
}

/* ColorNote Styles */
.nota-yellow { background: linear-gradient(135deg, #d4a017 0%, #b8860b 100%); }
.nota-blue { background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%); }
.nota-red { background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); }
.nota-green { background: linear-gradient(135deg, #059669 0%, #047857 100%); }
.nota-purple { background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%); }
.nota-gray { background: linear-gradient(135deg, #475569 0%, #334155 100%); }

.color-circle {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s ease;
}

.color-circle.active {
    transform: scale(1.2);
    border-color: #fff;
    box-shadow: 0 0 10px rgba(255,255,255,0.5);
}

.color-circle.type-yellow { background: #d4a017; }
.color-circle.type-blue { background: #2563eb; }
.color-circle.type-red { background: #dc2626; }
.color-circle.type-green { background: #059669; }
.color-circle.type-purple { background: #7c3aed; }
.color-circle.type-gray { background: #475569; }

/* Checklist Item Styles */
.chk-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid var(--glass-border);
    gap: 10px;
}
.chk-item:last-child {
    border-bottom: none;
}
.chk-item-text {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text);
}
.chk-item.checked .chk-item-text {
    text-decoration: line-through;
    opacity: 0.5;
}

/* Floating Update Button */
.update-button {
    position: fixed;
    bottom: calc(85px + var(--safe-area-bottom));
    left: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 8px 32px var(--accent-glow);
    z-index: 2500;
    cursor: pointer;
    border: 2px solid white;
    animation: pulse-update 2s infinite, shake-update 0.5s ease-in-out infinite alternate;
    transition: transform 0.3s ease;
}

@keyframes shake-update {
    0% { transform: translateX(0); }
    25% { transform: translateX(-3px) rotate(-2deg); }
    50% { transform: translateX(3px) rotate(2deg); }
    75% { transform: translateX(-3px) rotate(-1deg); }
    100% { transform: translateX(0); }
}

.update-button:active {
    transform: scale(0.9);
}

@keyframes pulse-update {
    0% { box-shadow: 0 0 0 0 var(--accent-glow); }
    70% { box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Update Modal/Toast */
.update-panel {
    position: fixed;
    bottom: calc(100px + var(--safe-area-bottom));
    left: 10px;
    right: 10px;
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    display: none;
    z-index: 2600;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    animation: slide-up 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slide-up {
    from { transform: translateY(100%) scale(0.9); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.update-panel h4 {
    color: var(--primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.update-panel p {
    font-size: 0.85rem;
    margin-bottom: 1rem;
    white-space: pre-line;
    color: var(--text);
    opacity: 0.9;
}

.update-footer {
    display: flex;
    gap: 10px;
}

.chk-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.chk-item.checked .chk-checkbox {
    background: var(--primary);
}
.chk-item.checked .chk-checkbox::after {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    color: white;
    font-size: 12px;
}

/* Switch Slider Overlay */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--glass-border);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

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

input:focus + .slider {
    box-shadow: 0 0 8px var(--accent-glow);
}

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

/* FAQ Accordion Styles */
.faq-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.faq-item {
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-question {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    user-select: none;
    transition: background 0.2s ease;
}

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

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

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease;
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.faq-answer p {
    padding: 15px;
    margin: 0;
}

.faq-item.active {
    border-color: var(--primary);
    background: rgba(16, 185, 129, 0.05);
}

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

.faq-item.active .faq-question i {
    transform: rotate(180deg);
}

.faq-item.active .faq-answer {
    max-height: 500px; /* Arbitrary large height */
    border-top: 1px solid rgba(16, 185, 129, 0.1);
}

