/* MicroSpark App Styles */
:root {
    --primary-color: #3498db;  /* Blue */
    --success-color: #2ecc71;  /* Green */
    --physical-color: #e74c3c;  /* Red */
    --mindfulness-color: #8e44ad;  /* Purple */
    --learning-color: #f39c12;  /* Orange */
    --creativity-color: #16a085;  /* Teal */
    --productivity-color: #27ae60;  /* Green */
    --social-color: #e67e22;  /* Orange */
    
    --iphone-width: 375px;
    --iphone-height: 812px;
    --iphone-radius: 40px;
    --status-bar-height: 44px;
    --nav-bar-height: 83px;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.5;
    color: #333;
}

/* iPhone Frame and Structure */
.iphone-frame {
    position: relative;
    width: var(--iphone-width);
    height: var(--iphone-height);
    background-color: white;
    border-radius: var(--iphone-radius);
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    margin: 20px auto;
}

.app-container {
    position: absolute;
    top: var(--status-bar-height);
    left: 0;
    right: 0;
    bottom: var(--nav-bar-height);
    overflow-y: auto;
    background-color: #f9f9fb;
    -webkit-overflow-scrolling: touch; /* For smooth scrolling on iOS */
    user-select: none; /* Prevent text selection for app-like feel */
}

/* Status Bar */
.status-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: var(--status-bar-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    background-color: white;
    color: #000;
    font-size: 14px;
    font-weight: 600;
    z-index: 100;
}

.status-bar-time {
    letter-spacing: 1px;
}

.status-bar-icons {
    display: flex;
    gap: 6px;
}

/* Navigation Bar */
.nav-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-bar-height);
    display: flex;
    justify-content: space-around;
    align-items: center;
    background-color: white;
    box-shadow: 0 -1px 0 0 rgba(0, 0, 0, 0.05);
    z-index: 100;
    border-radius: 0 0 var(--iphone-radius) var(--iphone-radius);
    padding-bottom: 20px; /* iOS home indicator space */
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #8e8e93;
    font-size: 10px;
    gap: 4px;
}

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

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

/* Common UI Components */
.btn {
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.btn-full {
    width: 100%;
}

.btn-rounded {
    border-radius: 50px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}

/* Toggle Buttons */
.toggle-container {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding: 4px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.toggle-container::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}

.toggle-btn {
    white-space: nowrap;
    padding: 8px 12px;
    border-radius: 100px;
    font-size: 14px;
    background-color: #f2f2f7;
    color: #3a3a3c;
    border: none;
    cursor: pointer;
}

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

/* Challenge Cards */
.challenge-card {
    display: flex;
    background-color: white;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.challenge-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-right: 16px;
    flex-shrink: 0;
    color: white;
}

.challenge-icon.physical {
    background-color: var(--physical-color);
}

.challenge-icon.mindfulness {
    background-color: var(--mindfulness-color);
}

.challenge-icon.learning {
    background-color: var(--learning-color);
}

.challenge-icon.creativity {
    background-color: var(--creativity-color);
}

.challenge-icon.productivity {
    background-color: var(--productivity-color);
}

.challenge-icon.social {
    background-color: var(--social-color);
}

.challenge-info {
    flex-grow: 1;
}

.challenge-title {
    font-weight: 600;
    margin: 0 0 4px 0;
}

.challenge-description {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 8px 0;
}

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

.time-badge {
    background-color: #f2f2f7;
    color: #3a3a3c;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
}

.difficulty {
    display: flex;
    gap: 3px;
    font-size: 8px;
}

/* Recommendation Screen */
.recommendation-header {
    text-align: center;
    padding: 20px 16px;
    background-color: #fff;
    position: relative;
}

.recommendation-title {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
}

.recommendation-subtitle {
    color: #6b7280;
    margin: 4px 0 0 0;
}

.recommendation-cards {
    padding: 16px;
}

.suggestion-card {
    background-color: white;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    border-left: 4px solid;
}

.suggestion-card.physical {
    border-left-color: var(--physical-color);
}

.suggestion-card.mindfulness {
    border-left-color: var(--mindfulness-color);
}

.suggestion-card.learning {
    border-left-color: var(--learning-color);
}

.suggestion-card.creativity {
    border-left-color: var(--creativity-color);
}

.suggestion-card.productivity {
    border-left-color: var(--productivity-color);
}

.suggestion-card.social {
    border-left-color: var(--social-color);
}

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

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.card-time {
    background-color: #f2f2f7;
    color: #3a3a3c;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
}

.card-description {
    margin: 0 0 16px 0;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.5;
}

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

.card-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: #6b7280;
}

.start-challenge-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

/* Active Challenge Screen */
.active-challenge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
    text-align: center;
}

.progress-ring {
    position: relative;
    width: 250px;
    height: 250px;
}

.progress-ring-circle {
    transition: stroke-dashoffset 0.35s;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    stroke-dasharray: 729; /* 2πr */
    stroke-dashoffset: 182; /* Represents 75% completion (25% remaining) */
}

.progress-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.timer {
    font-size: 48px;
    font-weight: 700;
    margin: 0;
    line-height: 1;
}

/* Stats and Heatmap */
.stats-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background-color: white;
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

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

.stat-label {
    font-size: 12px;
    color: #6b7280;
}

.heatmap {
    background-color: white;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 6px;
}

.heatmap-day {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    border-radius: 2px;
    transition: transform 0.1s;
}

.heatmap-day:hover {
    transform: scale(1.15);
    z-index: 1;
}

.heatmap-tooltip {
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.heatmap-day:hover .heatmap-tooltip {
    opacity: 1;
}

/* Badge Grid */
.badge-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.badge-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #e5e5ea;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.badge-unlocked .badge-icon {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.badge-name {
    font-size: 12px;
    text-align: center;
    color: #3a3a3c;
}

/* Profile Settings */
.preference-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px;
    border-radius: 8px;
    background-color: #f2f2f7;
    font-size: 12px;
    color: #3a3a3c;
}

.preference-chip.active {
    color: white;
}

.preference-chip.active.physical {
    background-color: var(--physical-color);
}

.preference-chip.active.mindfulness {
    background-color: var(--mindfulness-color);
}

.preference-chip.active.creativity {
    background-color: var(--creativity-color);
}

.preference-chip.active.learning {
    background-color: var(--learning-color);
}

.preference-chip.active.productivity {
    background-color: var(--productivity-color);
}

.preference-chip.social {
    background-color: #f2f2f7;
}

.toggle-switch {
    position: relative;
    width: 40px;
    height: 24px;
    background-color: #e5e5ea;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.toggle-switch.active {
    background-color: var(--success-color);
}

.toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toggle-switch.active .toggle-knob {
    transform: translateX(16px);
}

.settings-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.settings-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #f2f2f7;
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-icon {
    width: 24px;
    margin-right: 12px;
    text-align: center;
    color: #3a3a3c;
}

.settings-item-text {
    flex-grow: 1;
}

/* Phone Grid for Demo */
.phone-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 40px;
    padding: 20px 0;
}

.phone-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.phone-label {
    margin-top: 16px;
    font-weight: 500;
    color: #333;
    font-size: 16px;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Make app look native on iOS */
@supports (-webkit-touch-callout: none) {
    * {
        -webkit-tap-highlight-color: transparent;
    }
    
    input, button, select, textarea {
        -webkit-appearance: none;
    }
}