* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2D6A4F;
    --primary-dark: #1B4332;
    --secondary-color: #B8860B;
    --background: #F5F5DC;
    --card-bg: #FFFFFF;
    --text-primary: #1A202C;
    --text-secondary: #4A5568;
    --error-color: #E53E3E;
    --success-color: #2D6A4F;
    --verse-bg: #E8F5E9;
    --verse-border: #2D6A4F;
}

/* iOS Install Banner */
.ios-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 12px 16px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    z-index: 9999;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.ios-install-content {
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.ios-install-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
}

.ios-install-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ios-install-text strong {
    font-size: 15px;
    color: #1a1a1a;
}

.ios-install-text span {
    font-size: 13px;
    color: #666;
}

.ios-share-icon {
    display: inline-block;
    font-size: 16px;
    color: #007AFF;
    font-weight: bold;
}

.ios-install-text kbd {
    display: inline-block;
    padding: 2px 6px;
    font-size: 11px;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 1px 0 #bbb;
}

.ios-install-close {
    background: #f0f0f0;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--background);
    min-height: 100vh;
    color: var(--text-primary);
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--background);
}

/* Header */
.header {
    padding: 20px;
    background: var(--background);
    text-align: center;
}

.header-images {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
}

.logo-container {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 12px;
}

.pastores-img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 12px;
    border: 3px solid var(--primary-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Calendar in header */
.calendar-section-header {
    margin-top: 16px;
}

.calendar-toggle-small {
    background: transparent;
    border: 1px solid var(--primary-color);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s;
}

.calendar-toggle-small:hover {
    background: var(--primary-color);
    color: white;
}

/* Calendario personalizado */
.custom-calendar {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-top: 10px;
}

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

.calendar-month {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
}

.calendar-nav {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--primary-color);
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: background 0.2s;
}

.calendar-nav:hover {
    background: var(--verse-bg);
}

.calendar-nav:disabled {
    color: #ccc;
    cursor: not-allowed;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 10px;
}

.calendar-weekdays span {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 5px 0;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: none;
    color: var(--text-secondary);
}

.calendar-day:hover:not(.disabled):not(.empty) {
    background: var(--verse-bg);
}

.calendar-day.available {
    color: var(--primary-color);
    font-weight: 600;
    background: #E8F5E9;
}

.calendar-day.available:hover {
    background: var(--primary-color);
    color: white;
}

.calendar-day.selected {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.calendar-day.today {
    border: 2px solid var(--primary-color);
}

.calendar-day.disabled {
    color: #ddd;
    cursor: not-allowed;
}

.calendar-day.empty {
    cursor: default;
}

.calendar-day.future {
    color: #ccc;
    cursor: not-allowed;
    text-decoration: line-through;
}

/* Leyenda del calendario */
.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot.available {
    background: #E8F5E9;
    border: 2px solid var(--primary-color);
}

.legend-dot.unavailable {
    background: #f5f5f5;
    border: 2px solid #ddd;
}

.title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.date {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    padding: 0 16px 24px;
}

/* Devotional Card */
.devotional-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 16px;
}

.devotional-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 16px;
}

.verse-box {
    background: var(--verse-bg);
    border-left: 4px solid var(--verse-border);
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 20px;
}

.verse {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
}

.devotional-text {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Audio Container */
.audio-container {
    margin-top: 20px;
}

.audio-error {
    background: #FEE2E2;
    border: 1px solid #FECACA;
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

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

.error-text {
    color: var(--error-color);
    font-size: 14px;
}

.play-button {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px 24px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background-color 0.2s, transform 0.1s;
}

.play-button:hover {
    background: var(--primary-dark);
}

.play-button:active {
    transform: scale(0.98);
}

.play-button.playing {
    background: var(--secondary-color);
}

.play-button.disabled,
.play-button:disabled {
    background: #9CA3AF;
    cursor: not-allowed;
    opacity: 0.7;
}

.play-button.disabled:hover,
.play-button:disabled:hover {
    transform: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.play-icon {
    font-size: 16px;
}

/* Progress Bar */
.progress-container {
    margin-top: 16px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #E2E8F0;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.progress-bar::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.time-display {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Calendar Section */
.calendar-section {
    margin-bottom: 16px;
}

.calendar-toggle {
    width: 100%;
    background: var(--card-bg);
    border: 2px dashed #CBD5E0;
    border-radius: 12px;
    padding: 14px;
    font-size: 16px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.calendar-toggle:hover {
    border-color: var(--primary-color);
    background: #F7FAFC;
}

.calendar-container {
    margin-top: 12px;
    padding: 16px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.date-picker {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 2px solid #E2E8F0;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

.date-picker:focus {
    border-color: var(--primary-color);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.1s, opacity 0.2s;
}

.btn:active {
    transform: scale(0.98);
}

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

.btn-share:hover {
    background: var(--primary-dark);
}

.btn-notification {
    background: var(--secondary-color);
    color: white;
    border: none;
    width: 100%;
}

.btn-notification:hover {
    background: #9A7209;
}

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

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

.btn-history:hover {
    background: var(--verse-bg);
}

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

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #E2E8F0;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-body {
    padding: 16px 20px;
    overflow-y: auto;
}

.history-item {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: var(--background);
    cursor: pointer;
    transition: background-color 0.2s;
}

.history-item:hover {
    background: #E2E8F0;
}

.history-item-date {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.history-item-title {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* PWA Install Banner */
.install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--primary-color);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    z-index: 999;
}

.install-banner p {
    font-size: 14px;
    flex: 1;
}

.install-btn {
    background: white;
    color: var(--primary-color);
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.dismiss-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

/* Responsive */
@media (max-width: 480px) {
    .title {
        font-size: 22px;
    }
    
    .devotional-title {
        font-size: 18px;
    }
    
    .devotional-card {
        padding: 16px;
        border-radius: 12px;
    }
    
    .logo {
        width: 100px;
    }
    
    .btn {
        padding: 14px 20px;
        font-size: 15px;
    }
    
    .play-button {
        padding: 14px 20px;
        font-size: 16px;
    }
}

@media (max-width: 360px) {
    .title {
        font-size: 20px;
    }
    
    .devotional-title {
        font-size: 16px;
    }
    
    .devotional-card {
        padding: 12px;
    }
    
    .logo {
        width: 80px;
    }
    
    .header {
        padding: 16px;
    }
}

@media (min-width: 768px) {
    .app-container {
        max-width: 600px;
    }
    
    .devotional-card {
        padding: 32px;
    }
    
    .logo {
        width: 150px;
    }
}

/* Safe area for iOS */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .action-buttons {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ============ Botones de acción mejorados ============ */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.secondary-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.btn-download {
    background: var(--secondary-color);
    color: white;
    border: none;
}

.btn-download:hover {
    background: #9A7209;
}

.btn-download.downloaded {
    background: var(--success-color);
}

.btn-downloads-link {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    padding: 14px 20px;
    font-size: 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-downloads-link:hover {
    background: var(--verse-bg);
}

/* Toast animation */
@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    85% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* ============ Login styles ============ */
.login-container {
    max-width: 400px;
    margin: 60px auto;
    padding: 20px;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    text-align: center;
}

.login-logo {
    width: 80px;
    margin-bottom: 20px;
}

.login-title {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-input {
    padding: 14px 16px;
    border: 2px solid #E2E8F0;
    border-radius: 10px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

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

.login-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.login-btn:hover {
    background: var(--primary-dark);
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-error {
    color: var(--error-color);
    font-size: 14px;
    margin-top: 10px;
}

.logout-btn {
    background: transparent;
    color: var(--error-color);
    border: 1px solid var(--error-color);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #FED7D7;
}

.btn-notifications {
    background: #FF6B35;
    color: white;
    border: none;
}

.btn-notifications:hover {
    background: #E55A2B;
}

.btn-notifications.active {
    background: #2D6A4F;
}


/* Campanita de notificaciones */
.notification-bell {
    cursor: pointer;
    font-size: 0.7em;
    vertical-align: middle;
    margin-left: 8px;
    opacity: 0.7;
    transition: all 0.3s ease;
    animation: bellRing 2s ease-in-out infinite;
}

.notification-bell:hover {
    opacity: 1;
    transform: scale(1.2);
}

.notification-bell.active {
    color: #2D6A4F;
    opacity: 1;
    animation: none;
}

.notification-bell.denied {
    opacity: 0.3;
    cursor: not-allowed;
    animation: none;
}

@keyframes bellRing {
    0%, 100% { transform: rotate(0); }
    10% { transform: rotate(15deg); }
    20% { transform: rotate(-15deg); }
    30% { transform: rotate(10deg); }
    40% { transform: rotate(-10deg); }
    50% { transform: rotate(0); }
}
