/* ============================================
   BIBLIA CALENDAR - Calendario Completo
   ============================================ */

/* Panel overlay */
.cal-panel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary);
    z-index: 200;
    overflow-y: auto;
    animation: calFadeIn 0.3s ease;
}
.cal-panel.active { display: block; }

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

/* Header */
.cal-header {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    box-shadow: 0 2px 8px var(--shadow-sm);
}

.cal-title {
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text-heading);
}

.cal-close {
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 1.1em;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.cal-close:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: rotate(90deg);
}

/* Body */
.cal-body {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px 16px 80px;
}

/* ============ MONTH NAV ============ */
.cal-month-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.cal-month-label {
    font-size: 1.15em;
    font-weight: 600;
    color: var(--text-heading);
    min-width: 180px;
    text-align: center;
}

.cal-nav-btn {
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 0.85em;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.cal-nav-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.cal-today-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 0.8em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.cal-today-btn:hover {
    background: var(--accent-hover);
}

/* ============ CALENDAR GRID ============ */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 20px;
}

.cal-day-name {
    text-align: center;
    font-size: 0.7em;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    padding: 8px 0;
    letter-spacing: 1px;
}

.cal-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    background: var(--bg-secondary);
    border: 1.5px solid transparent;
    min-height: 48px;
}
.cal-cell:hover {
    background: var(--bg-hover);
    border-color: var(--accent-border);
}
.cal-cell-empty {
    background: none;
    cursor: default;
    border: none;
}
.cal-cell-empty:hover {
    background: none;
    border-color: transparent;
}

.cal-cell-today {
    border-color: var(--accent-primary);
    background: var(--accent-light);
}
.cal-cell-today .cal-cell-num {
    color: var(--accent-primary);
    font-weight: 700;
}

.cal-cell-selected {
    background: var(--accent-primary) !important;
    border-color: var(--accent-primary) !important;
}
.cal-cell-selected .cal-cell-num {
    color: white !important;
    font-weight: 700;
}
.cal-cell-selected .cal-dot {
    background: white !important;
}

.cal-cell-num {
    font-size: 0.85em;
    font-weight: 500;
    color: var(--text-primary);
}

.cal-cell-dots {
    display: flex;
    gap: 3px;
    margin-top: 2px;
}

.cal-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
}

/* ============ DAY EVENTS ============ */
.cal-day-events {
    margin-top: 8px;
}

.cal-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.cal-day-title {
    font-size: 1em;
    font-weight: 600;
    color: var(--text-heading);
}

.cal-add-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.82em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.cal-add-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.cal-no-events {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-tertiary);
    font-size: 0.88em;
}

/* ============ EVENT CARDS ============ */
.cal-event-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-primary);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    transition: all 0.2s;
}
.cal-event-card:hover {
    box-shadow: 0 2px 12px var(--shadow-sm);
}

.cal-ev-top {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.cal-ev-icon {
    font-size: 1.3em;
    flex-shrink: 0;
    margin-top: 1px;
}

.cal-ev-info {
    flex: 1;
    min-width: 0;
}

.cal-ev-title {
    font-size: 0.95em;
    font-weight: 600;
    color: var(--text-heading);
    word-break: break-word;
}

.cal-ev-time {
    font-size: 0.78em;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.cal-ev-edit {
    background: none;
    border: 1.5px solid var(--border-color);
    border-radius: 6px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 0.85em;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.cal-ev-edit:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.cal-ev-extras {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
}

.cal-ev-desc {
    font-size: 0.82em;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 6px;
    white-space: pre-wrap;
}

.cal-ev-link {
    display: inline-block;
    font-size: 0.78em;
    color: var(--accent-primary);
    text-decoration: none;
    margin-bottom: 4px;
    word-break: break-all;
}
.cal-ev-link:hover { text-decoration: underline; }

.cal-ev-notes {
    font-size: 0.78em;
    color: var(--text-tertiary);
    font-style: italic;
    margin-top: 4px;
}

.cal-ev-recurring {
    font-size: 0.72em;
    color: var(--accent-primary);
    margin-top: 4px;
    font-weight: 500;
}

/* Attachments in event card */
.cal-ev-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.cal-ev-attach-thumb img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.2s;
}
.cal-ev-attach-thumb img:hover { transform: scale(1.1); }

.cal-ev-attach-file {
    font-size: 0.78em;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.cal-ev-attach-file audio {
    display: block;
    margin-top: 4px;
    width: 100%;
    max-width: 300px;
    height: 32px;
}

/* ============ UPCOMING ============ */
.cal-upcoming {
    margin-top: 8px;
}

.cal-upcoming-title {
    font-size: 1em;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-light);
}

.cal-upcoming-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s;
}
.cal-upcoming-item:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 2px 8px var(--shadow-sm);
}

.cal-upcoming-date {
    font-size: 0.72em;
    font-weight: 600;
    color: var(--accent-primary);
    background: var(--accent-light);
    padding: 4px 8px;
    border-radius: 6px;
    min-width: 50px;
    text-align: center;
    text-transform: uppercase;
}

.cal-upcoming-icon {
    font-size: 1.2em;
    flex-shrink: 0;
}

.cal-upcoming-info { flex: 1; min-width: 0; }

.cal-upcoming-name {
    font-size: 0.88em;
    font-weight: 500;
    color: var(--text-primary);
}

.cal-upcoming-time {
    font-size: 0.72em;
    color: var(--text-tertiary);
}

/* ============ MODAL ============ */
.cal-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--modal-overlay);
    z-index: 250;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: calFadeIn 0.2s ease;
}

.cal-modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px var(--shadow-lg);
}

.cal-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 5;
    border-radius: 16px 16px 0 0;
}

.cal-modal-title {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-heading);
}

.cal-modal-close {
    background: none;
    border: none;
    font-size: 1.3em;
    cursor: pointer;
    color: var(--text-tertiary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s;
}
.cal-modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.cal-modal-body {
    padding: 16px 20px;
}

.cal-modal-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px 16px;
    border-top: 1px solid var(--border-color);
}

.cal-modal-spacer { flex: 1; }

/* ============ FORM FIELDS ============ */
.cal-field {
    margin-bottom: 14px;
}

.cal-field-row {
    display: flex;
    gap: 12px;
}
.cal-field-half { flex: 1; }

.cal-label {
    display: block;
    font-size: 0.78em;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cal-label-check {
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: none;
    font-weight: 500;
    cursor: pointer;
}
.cal-label-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
}

.cal-input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.9em;
    font-family: inherit;
    transition: border-color 0.2s;
    outline: none;
}
.cal-input:focus { border-color: var(--accent-primary); }
.cal-input::placeholder { color: var(--text-tertiary); }

.cal-select {
    cursor: pointer;
    appearance: auto;
}

.cal-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.88em;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    min-height: 50px;
}
.cal-textarea:focus { border-color: var(--accent-primary); }
.cal-textarea::placeholder { color: var(--text-tertiary); }

/* Attachments zone */
.cal-attachments-zone {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cal-attach-btn {
    background: var(--bg-tertiary);
    border: 1.5px dashed var(--border-color);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.82em;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    font-family: inherit;
}
.cal-attach-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.cal-attach-hint {
    font-size: 0.72em;
    color: var(--text-tertiary);
}

.cal-attachments-list {
    margin-top: 8px;
}

.cal-attach-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 4px;
    font-size: 0.82em;
}

.cal-attach-preview {
    width: 40px;
    height: 30px;
    object-fit: cover;
    border-radius: 4px;
}

.cal-attach-name {
    flex: 1;
    color: var(--text-secondary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal-attach-remove {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 0.9em;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.15s;
    flex-shrink: 0;
}
.cal-attach-remove:hover { background: var(--bg-hover); color: var(--favorite-color); }

/* ============ BUTTONS ============ */
.cal-btn-save {
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 9px 20px;
    font-size: 0.88em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.cal-btn-save:hover { background: var(--accent-hover); }

.cal-btn-cancel {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 0.88em;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.cal-btn-cancel:hover { background: var(--bg-hover); }

.cal-btn-delete {
    background: none;
    color: var(--favorite-color);
    border: 1.5px solid var(--favorite-color);
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 0.82em;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.cal-btn-delete:hover { background: rgba(231,76,60,0.08); }

/* ============ MOBILE ============ */
@media (max-width: 768px) {
    .cal-body { padding: 12px 8px 80px; }
    .cal-cell { min-height: 40px; }
    .cal-cell-num { font-size: 0.75em; }
    .cal-field-row { flex-direction: column; gap: 0; }
    .cal-modal-content { max-height: 95vh; border-radius: 12px; }
    .cal-month-nav { gap: 6px; }
    .cal-month-label { font-size: 1em; min-width: 140px; }
}
@media (max-width: 480px) {
    .cal-cell { min-height: 36px; padding: 2px; }
    .cal-cell-num { font-size: 0.7em; min-width: 20px; min-height: 20px; }
    .cal-modal-content {
        border-radius: 16px 16px 0 0;
        max-height: 90vh;
        margin: auto 0 0;
    }
    .cal-modal-overlay { align-items: flex-end; }
    .cal-btn-save, .cal-btn-delete, .cal-btn-cancel {
        padding: 12px 16px;
        font-size: 0.88em;
        min-height: 44px;
    }
}
