/**
 * Nutrition Developer Pro - Public Styles
 */

/* Variables */
:root {
    --ndp-primary: #27ae60;
    --ndp-primary-dark: #1e8449;
    --ndp-secondary: #3498db;
    --ndp-danger: #e74c3c;
    --ndp-warning: #f39c12;
    --ndp-success: #27ae60;
    --ndp-text: #333;
    --ndp-text-light: #666;
    --ndp-border: #ddd;
    --ndp-bg: #f9f9f9;
    --ndp-radius: 8px;
    --ndp-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Base */
.ndp-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.ndp-card {
    background: #fff;
    border: 1px solid var(--ndp-border);
    border-radius: var(--ndp-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--ndp-shadow);
}

.ndp-card-header {
    border-bottom: 2px solid var(--ndp-primary);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.ndp-card-header h2,
.ndp-card-header h3 {
    margin: 0;
    color: var(--ndp-text);
}

/* Buttons */
.ndp-button {
    display: inline-block;
    padding: 10px 20px;
    background: var(--ndp-primary);
    color: #fff;
    border: none;
    border-radius: var(--ndp-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s;
}

.ndp-button:hover {
    background: var(--ndp-primary-dark);
    color: #fff;
}

.ndp-button-secondary {
    background: var(--ndp-secondary);
}

.ndp-button-outline {
    background: transparent;
    border: 2px solid var(--ndp-primary);
    color: var(--ndp-primary);
}

.ndp-button-outline:hover {
    background: var(--ndp-primary);
    color: #fff;
}

.ndp-button-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* Forms */
.ndp-form-group {
    margin-bottom: 15px;
}

.ndp-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--ndp-text);
}

.ndp-input,
.ndp-select,
.ndp-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--ndp-border);
    border-radius: var(--ndp-radius);
    font-size: 14px;
    transition: border-color 0.2s;
}

.ndp-input:focus,
.ndp-select:focus,
.ndp-textarea:focus {
    outline: none;
    border-color: var(--ndp-primary);
}

/* Grid */
.ndp-grid {
    display: grid;
    gap: 20px;
}

.ndp-grid-2 { grid-template-columns: repeat(2, 1fr); }
.ndp-grid-3 { grid-template-columns: repeat(3, 1fr); }
.ndp-grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .ndp-grid-2,
    .ndp-grid-3,
    .ndp-grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Dashboard */
.ndp-dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.ndp-stat-card {
    background: linear-gradient(135deg, var(--ndp-primary) 0%, #2ecc71 100%);
    color: #fff;
    padding: 20px;
    border-radius: var(--ndp-radius);
    text-align: center;
}

.ndp-stat-card.secondary {
    background: linear-gradient(135deg, var(--ndp-secondary) 0%, #5dade2 100%);
}

.ndp-stat-card.warning {
    background: linear-gradient(135deg, var(--ndp-warning) 0%, #f5b041 100%);
}

.ndp-stat-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.ndp-stat-value {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
}

.ndp-stat-label {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 5px;
}

/* Progress Bars */
.ndp-progress {
    height: 24px;
    background: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.ndp-progress-bar {
    height: 100%;
    background: var(--ndp-primary);
    border-radius: 12px;
    transition: width 0.3s ease;
}

.ndp-progress-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 600;
    color: var(--ndp-text);
}

/* Recipe Cards */
.ndp-recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.ndp-recipe-card {
    background: #fff;
    border-radius: var(--ndp-radius);
    overflow: hidden;
    box-shadow: var(--ndp-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.ndp-recipe-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.ndp-recipe-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.ndp-recipe-content {
    padding: 15px;
}

.ndp-recipe-title {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: var(--ndp-text);
}

.ndp-recipe-meta {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: var(--ndp-text-light);
}

.ndp-recipe-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ndp-recipe-nutrition {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--ndp-border);
}

.ndp-nutrition-item {
    text-align: center;
}

.ndp-nutrition-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--ndp-primary);
}

.ndp-nutrition-label {
    font-size: 11px;
    color: var(--ndp-text-light);
}

/* Favorite Button */
.ndp-favorite-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: #ccc;
    transition: color 0.2s;
}

.ndp-favorite-btn:hover,
.ndp-favorite-btn.active {
    color: #e74c3c;
}

/* Food Journal */
.ndp-journal-day {
    margin-bottom: 25px;
}

.ndp-meal-section {
    background: #fff;
    border: 1px solid var(--ndp-border);
    border-radius: var(--ndp-radius);
    margin-bottom: 15px;
}

.ndp-meal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--ndp-bg);
    border-bottom: 1px solid var(--ndp-border);
}

.ndp-meal-title {
    font-weight: 600;
    color: var(--ndp-text);
}

.ndp-meal-calories {
    font-size: 14px;
    color: var(--ndp-primary);
    font-weight: 600;
}

.ndp-meal-items {
    padding: 10px 15px;
}

.ndp-meal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

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

.ndp-meal-item-name {
    flex: 1;
}

.ndp-meal-item-serving {
    color: var(--ndp-text-light);
    font-size: 13px;
    margin: 0 15px;
}

.ndp-meal-item-calories {
    font-weight: 500;
    min-width: 60px;
    text-align: right;
}

.ndp-add-food-btn {
    width: 100%;
    padding: 10px;
    background: var(--ndp-bg);
    border: 2px dashed var(--ndp-border);
    border-radius: var(--ndp-radius);
    color: var(--ndp-text-light);
    cursor: pointer;
    transition: all 0.2s;
}

.ndp-add-food-btn:hover {
    border-color: var(--ndp-primary);
    color: var(--ndp-primary);
}

/* Shopping List */
.ndp-shopping-category {
    margin-bottom: 20px;
}

.ndp-shopping-category-header {
    background: var(--ndp-primary);
    color: #fff;
    padding: 10px 15px;
    border-radius: var(--ndp-radius) var(--ndp-radius) 0 0;
    font-weight: 600;
}

.ndp-shopping-items {
    background: #fff;
    border: 1px solid var(--ndp-border);
    border-top: none;
    border-radius: 0 0 var(--ndp-radius) var(--ndp-radius);
}

.ndp-shopping-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

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

.ndp-shopping-item.checked {
    background: #f0f8f0;
}

.ndp-shopping-item.checked .ndp-shopping-item-name {
    text-decoration: line-through;
    color: var(--ndp-text-light);
}

.ndp-shopping-checkbox {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
}

.ndp-shopping-item-name {
    flex: 1;
}

.ndp-shopping-item-qty {
    color: var(--ndp-text-light);
    font-size: 13px;
}

/* Badges */
.ndp-badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.ndp-badge-card {
    background: #fff;
    border: 2px solid var(--ndp-border);
    border-radius: var(--ndp-radius);
    padding: 20px;
    text-align: center;
    transition: all 0.2s;
}

.ndp-badge-card.earned {
    border-color: var(--ndp-primary);
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.2);
}

.ndp-badge-card.locked {
    opacity: 0.5;
    filter: grayscale(1);
}

.ndp-badge-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.ndp-badge-name {
    font-weight: 600;
    color: var(--ndp-text);
    margin-bottom: 5px;
}

.ndp-badge-description {
    font-size: 12px;
    color: var(--ndp-text-light);
}

/* Gamification */
.ndp-gamification-bar {
    background: #fff;
    border: 1px solid var(--ndp-border);
    border-radius: var(--ndp-radius);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.ndp-level-badge {
    width: 50px;
    height: 50px;
    background: var(--ndp-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    font-weight: 700;
}

.ndp-xp-progress {
    flex: 1;
}

.ndp-streak {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 600;
    color: var(--ndp-warning);
}

/* Calculators */
.ndp-calculator {
    background: #fff;
    border: 1px solid var(--ndp-border);
    border-radius: var(--ndp-radius);
    padding: 25px;
    margin-bottom: 20px;
}

.ndp-calculator h3 {
    margin-top: 0;
    color: var(--ndp-primary);
}

.ndp-calculator-result {
    background: var(--ndp-bg);
    border-radius: var(--ndp-radius);
    padding: 20px;
    margin-top: 20px;
    text-align: center;
}

.ndp-calculator-result .value {
    font-size: 48px;
    font-weight: 700;
    color: var(--ndp-primary);
}

.ndp-calculator-result .label {
    font-size: 16px;
    color: var(--ndp-text-light);
}

.ndp-bmi-classification {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: 600;
    margin-top: 10px;
}

.ndp-bmi-classification.underweight { background: #3498db; color: #fff; }
.ndp-bmi-classification.normal { background: #27ae60; color: #fff; }
.ndp-bmi-classification.overweight { background: #f39c12; color: #fff; }
.ndp-bmi-classification.obese { background: #e74c3c; color: #fff; }

/* Notices */
.ndp-notice {
    padding: 15px 20px;
    border-radius: var(--ndp-radius);
    margin-bottom: 20px;
}

.ndp-notice-info {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    color: #1565c0;
}

.ndp-notice-warning {
    background: #fff3e0;
    border-left: 4px solid #ff9800;
    color: #e65100;
}

.ndp-notice-error {
    background: #ffebee;
    border-left: 4px solid #f44336;
    color: #c62828;
}

.ndp-notice-success {
    background: #e8f5e9;
    border-left: 4px solid #4caf50;
    color: #2e7d32;
}

/* Quiz */
.ndp-quiz-question {
    background: #fff;
    border: 1px solid var(--ndp-border);
    border-radius: var(--ndp-radius);
    padding: 20px;
    margin-bottom: 20px;
}

.ndp-quiz-question h4 {
    margin-top: 0;
}

.ndp-quiz-answers {
    list-style: none;
    padding: 0;
    margin: 15px 0 0 0;
}

.ndp-quiz-answer {
    padding: 12px 15px;
    border: 2px solid var(--ndp-border);
    border-radius: var(--ndp-radius);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.ndp-quiz-answer:hover {
    border-color: var(--ndp-primary);
}

.ndp-quiz-answer.selected {
    border-color: var(--ndp-primary);
    background: #e8f5e9;
}

.ndp-quiz-answer.correct {
    border-color: var(--ndp-success);
    background: #e8f5e9;
}

.ndp-quiz-answer.incorrect {
    border-color: var(--ndp-danger);
    background: #ffebee;
}

/* Challenges */
.ndp-challenge-card {
    background: #fff;
    border: 1px solid var(--ndp-border);
    border-radius: var(--ndp-radius);
    overflow: hidden;
    margin-bottom: 20px;
}

.ndp-challenge-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.ndp-challenge-content {
    padding: 15px;
}

.ndp-challenge-dates {
    font-size: 13px;
    color: var(--ndp-text-light);
    margin-bottom: 10px;
}

.ndp-challenge-target {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: var(--ndp-primary);
}

.ndp-challenge-reward {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #fff3e0;
    color: var(--ndp-warning);
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 13px;
    margin-top: 10px;
}

/* Messages */
.ndp-messages-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    min-height: 500px;
}

.ndp-conversations-list {
    background: #fff;
    border: 1px solid var(--ndp-border);
    border-radius: var(--ndp-radius);
    overflow: hidden;
}

.ndp-conversation-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.ndp-conversation-item:hover,
.ndp-conversation-item.active {
    background: var(--ndp-bg);
}

.ndp-conversation-item.unread {
    background: #e3f2fd;
}

.ndp-message-thread {
    background: #fff;
    border: 1px solid var(--ndp-border);
    border-radius: var(--ndp-radius);
    display: flex;
    flex-direction: column;
}

.ndp-message-list {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
}

.ndp-message {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: var(--ndp-radius);
    margin-bottom: 10px;
}

.ndp-message.sent {
    background: var(--ndp-primary);
    color: #fff;
    margin-left: auto;
}

.ndp-message.received {
    background: var(--ndp-bg);
}

.ndp-message-compose {
    padding: 15px;
    border-top: 1px solid var(--ndp-border);
    display: flex;
    gap: 10px;
}

.ndp-message-compose textarea {
    flex: 1;
    resize: none;
}

/* Loading */
.ndp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--ndp-text-light);
}

.ndp-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--ndp-border);
    border-top-color: var(--ndp-primary);
    border-radius: 50%;
    animation: ndp-spin 0.8s linear infinite;
    margin-right: 10px;
}

@keyframes ndp-spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .ndp-messages-container {
        grid-template-columns: 1fr;
    }
    
    .ndp-dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .ndp-gamification-bar {
        flex-wrap: wrap;
    }
}
