/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #64748b; /* Button color also linked to main title color on each devotional */
    --primary-dark: #cd570e; /* Button hover color */
    --secondary-color: #f59e0b;
    --success-color: #58df79;
    --background: #ffffff;
    --surface: #f8fafc;
    --surface-elevated: #ffffff;
    --text-primary: #eef1f6;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --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);
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-logo {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

.loading-content h2 {
    font-size: 1.5rem;
    font-weight: 300;
    margin-bottom: 2rem;
}

.loading-bar {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    background: white;
    border-radius: 2px;
    animation: loading 2s ease-in-out;
}

@keyframes loading {
    0% { width: 0%; }
    100% { width: 100%; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Main App */
.main-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* Header */
.app-header {
    background: var(--surface-elevated);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.app-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.progress-ring-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring-circle {
    transition: stroke-dasharray 0.5s ease;
}

.progress-text {
    position: absolute;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Screens */
.screen {
    flex: 1;
    padding: 1.5rem;
    display: none;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

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

/* Welcome Screen */
.welcome-content {
    text-align: center;
    padding: 2rem 0;
}

.welcome-custom-image {
    margin-bottom: 2rem;
    display: flex;
}

.custom-series-image {
    width: 100%;
    max-width: 600px;
    height: auto;
    object-fit: cover;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 768px) {
    .welcome-custom-image {
        margin-left: -1rem;
        margin-right: -1rem;
        margin-bottom: 2rem;
    }

    .custom-series-image {
        height: calc(100vw * 9 / 16);
        object-fit: cover;
    }
}

@media (min-width: 800px) {
    .custom-series-image {
        max-height: 450px;
    }
}

.welcome-content h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.welcome-content p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

/* Responsive image sizing */
@media (max-width: 768px) {
    .welcome-image {
        width: 150px;
        height: 150px;
    }
}

@media (max-width: 480px) {
    .welcome-image {
        width: 120px;
        height: 120px;
    }
}

/* Buttons */
.btn {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: inline-block;
}

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

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

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

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

.btn-complete {
    width: 100%;
    margin-top: 2rem;
    background: var(--success-color);
    color: white;
    font-size: 1.125rem;
    position: relative;
}

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

.btn-complete.completed {
    background: var(--success-color);
}

.btn-complete .check-icon {
    position: absolute;
    right: 1rem;
    font-size: 1.5rem;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

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

/* Devotional Screen */
.devotional-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.day-indicator {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Content Cards */
.content-card {
    background: var(--surface-elevated);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease;
}

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

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.scripture-text {
    font-size: 1.125rem;
    line-height: 1.8;
    margin-bottom: 1rem;
    font-style: italic;
}

.scripture-reference {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: right;
}

.reflection-text, .prayer-text {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* Completion Screen */
.completion-content {
    text-align: center;
    padding: 2rem 0;
}

.completion-illustration {
    font-size: 5rem;
    margin-bottom: 2rem;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.2); }
}

.completion-content h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.completion-content p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

.completion-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface-elevated);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-item:hover {
    transform: translateY(-2px);
}

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

.nav-icon {
    font-size: 1.5rem;
    color: var(--text-muted);
}

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

/* Days Grid */
.days-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.day-card {
    background: var(--surface-elevated);
    border-radius: var(--radius-md);
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
}

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

.day-number {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.day-status {
    font-size: 1.25rem;
    color: var(--success-color);
    margin-top: 0.5rem;
    height: 1.5rem;
    animation: fadeInScale 0.5s ease;
}

@keyframes fadeInScale {
    0% { 
        opacity: 0;
        transform: scale(0.5);
    }
    100% { 
        opacity: 1;
        transform: scale(1);
    }
}

.day-card.completed {
    background: var(--surface-elevated);
    border: 2px solid var(--success-color);
}

.day-card.completed .day-number {
    color: var(--text-primary);
}

.day-card.completed .day-status {
    color: var(--success-color);
    font-weight: bold;
    font-size: 1.5rem;
}

@keyframes checkmarkAppear {
    0% {
        transform: scale(0) rotate(-45deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.day-status {
    animation: checkmarkAppear 0.6s ease-out;
}

.checkmark-overlay {
    animation: checkmarkAppear 0.8s ease-out !important;
}

/* Responsive adjustments for days grid */
@media (max-width: 768px) {
    .days-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.75rem;
    }

    .day-card {
        padding: 1rem 0.5rem;
    }

    .day-number {
        font-size: 1.25rem;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-header {
        padding: 1rem;
    }

    .screen {
        padding: 1rem;
    }

    .welcome-content h2,
    .completion-content h2 {
        font-size: 1.75rem;
    }

    .btn-complete {
        font-size: 1rem;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --surface: #1e293b;
        --surface-elevated: #334155;
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-muted: #64748b;
        --border-color: #475569;
    }

    body {
        background: var(--background);
    }
}

/* Tablet Optimization */
@media (min-width: 769px) and (max-width: 1024px) {
    .main-app {
        max-width: 768px;
        margin: 0 auto;
    }

    .bottom-nav {
        position: relative;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Touch Targets */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
    }

    .nav-item {
        min-width: 44px;
        min-height: 44px;
    }
}