/* --- Global Reset & Typography --- */
:root {
    --color-primary: #007bff; /* Modern Blue */
    --color-secondary: #6c757d; /* Gray */
    --color-background: #121212; /* Deep Dark Background */
    --color-surface: #1e1e1e; /* Card/Surface Background */
    --color-text-light: #e0e0e0;
    --color-text-muted: #a0a0a0;
    --color-success: #28a745;
    --color-warning: #ffc107;
    --color-error: #dc3545;
    
    --font-main: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--color-background);
    color: var(--color-text-light);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* --- Header & Navigation --- */
.header {
    background-color: var(--color-surface);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: -0.5px;
}

.nav-link {
    color: var(--color-text-muted);
    text-decoration: none;
    margin-left: 1.2rem;
    padding: 0.5rem 0;
    font-weight: 500;
    transition: color 0.3s ease, border-bottom 0.3s ease;
    border-bottom: 2px solid transparent;
}

.nav-link:hover {
    color: var(--color-text-light);
}

.nav-link.active {
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-primary);
}

.admin-link {
    color: var(--color-warning);
}

.admin-link:hover {
    color: #ffdd57;
}

/* --- Main Content & Cards --- */
.main-content {
    padding-top: 2rem;
    padding-bottom: 3rem;
    flex-grow: 1;
}

.card {
    background-color: var(--color-surface);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid #2a2a2a;
}

.section-title {
    font-size: 1.5rem;
    color: var(--color-primary);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid rgba(0, 123, 255, 0.2);
    padding-bottom: 0.5rem;
}

/* --- Buttons & Inputs --- */
input[type="text"], input[type="tel"], input[type="number"], input[type="url"], textarea, select {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.8rem;
    border-radius: 6px;
    border: 1px solid #333;
    background-color: #252525;
    color: var(--color-text-light);
    font-size: 1rem;
    transition: border-color 0.3s;
}

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

.cta-button {
    display: block;
    width: 100%;
    padding: 0.8rem 1.5rem;
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    margin-top: 1rem;
}

.cta-button:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

/* --- Dashboard Specific Styles --- */
.daily-checkin h3, .health-summary h3 {
    color: var(--color-text-light);
    margin-bottom: 1rem;
}

.mood-selector {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.mood-btn {
    flex: 1;
    padding: 0.75rem 0.5rem;
    border: 1px solid var(--color-secondary);
    background-color: #2a2a2a;
    color: var(--color-text-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.mood-btn:hover, .mood-btn.selected {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.summary-item {
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.bg-blue-light { background-color: rgba(0, 123, 255, 0.15); }
.bg-green-light { background-color: rgba(40, 167, 69, 0.15); }
.bg-yellow-light { background-color: rgba(255, 193, 11, 0.15); }

.stat {
    font-size: 1.8rem;
    font-weight: 700;
    margin-top: 0.2rem;
}

.message {
    margin-top: 1rem;
    padding: 0.5rem;
    border-radius: 4px;
    text-align: center;
    font-weight: 500;
}

/* --- Tips & Products --- */
.tip-card, .product-card {
    background-color: #252525;
    border-left: 4px solid var(--color-primary);
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    transition: box-shadow 0.3s ease;
}

.tip-card:hover, .product-card:hover {
    box-shadow: 0 0 15px rgba(0, 123, 255, 0.3);
}

.tip-source {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--color-secondary);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.product-card {
    text-align: center;
    border-left: none;
    border: 1px solid #2a2a2a;
    padding: 1.5rem;
}

.product-card img {
    width: 100%;
    max-height: 150px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 0.8rem;
}

.price {
    color: var(--color-success);
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0.3rem 0;
}

.buy-button {
    background-color: #34d399; /* Green for purchase */
    color: var(--color-background);
    font-weight: 600;
    padding: 0.6rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    margin-top: 0.8rem;
    transition: background-color 0.2s;
}

.buy-button:hover {
    background-color: #10b981;
}

/* --- Modal (Mpesa) --- */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; 
    background-color: rgba(0,0,0,0.8);
    padding-top: 60px;
}

.modal-content {
    background-color: var(--color-surface);
    margin: 5% auto;
    padding: 25px;
    border-radius: 10px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    position: relative;
}

.close-button {
    color: var(--color-text-light);
    float: right;
    font-size: 28px;
    font-weight: bold;
    transition: color 0.2s;
}

.close-button:hover, .close-button:focus {
    color: var(--color-primary);
    text-decoration: none;
    cursor: pointer;
}

.payment-button {
    background-color: #ff8c00; /* Orange/Mpesa color scheme */
}
.payment-button:hover {
    background-color: #e67e00;
}

/* --- Profile Styles --- */
.profile-details {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border: 1px dashed #333;
    border-radius: 8px;
}

.profile-details h3 {
    color: var(--color-text-light);
    margin-bottom: 0.8rem;
    font-size: 1.2rem;
}

.data-grid p {
    margin-bottom: 0.5rem;
}

.edit-button {
    background-color: var(--color-secondary);
}
.edit-button:hover {
    background-color: #5a6268;
}

.stat-value {
    color: var(--color-warning);
    font-weight: 600;
}

.chart-placeholder {
    background-color: #1e1e1e;
    padding: 1rem;
    border-radius: 6px;
    text-align: center;
}

/* --- Admin Styles --- */
.admin-section {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #333;
}

#userList {
    list-style: none;
    padding: 0;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px dashed #2a2a2a;
    transition: background-color 0.2s;
}

.user-item:hover {
    background-color: #252525;
}

.user-status {
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.user-status.active { background-color: rgba(40, 167, 69, 0.2); color: var(--color-success); }
.user-status.inactive { background-color: rgba(220, 53, 69, 0.2); color: var(--color-error); }

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 1rem 0;
    background-color: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 0.85rem;
    margin-top: auto;
    border-top: 1px solid #2a2a2a;
}

/* --- Animations & Responsiveness --- */

/* Fade In on Load */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in { 
    opacity: 0; 
    animation: fadeIn 0.6s ease-out forwards; 
}

.fade-in-delay { 
    opacity: 0; 
    animation: fadeIn 0.6s ease-out 0.2s forwards; 
}

/* Navigation responsiveness for smaller screens */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
    }
    .logo {
        margin-bottom: 0.5rem;
    }
    .nav-link {
        margin: 0 0.5rem;
        padding: 0.3rem 0;
    }
    nav {
        display: flex;
        justify-content: center;
        width: 100%;
        flex-wrap: wrap;
    }
    .mood-selector {
        flex-wrap: wrap;
    }
    .mood-btn {
        flex-basis: calc(50% - 0.25rem);
    }
}

/* Mobile View Adjustments */
@media (max-width: 576px) {
    .container {
        width: 95%;
    }
    .nav-link {
        font-size: 0.9rem;
        margin: 0 0.3rem;
    }
    .mood-btn {
        font-size: 0.8rem;
        padding: 0.6rem 0.3rem;
    }
    .summary-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
    .stat {
        font-size: 1.5rem;
    }
}

/* Karbon Sites Branding */

  #karbon-promo-banner {
      position: fixed;
      bottom: 10px;
      right: 10px;
      background-color: rgba(0, 0, 0, 0.8);
      color: white;
      padding: 8px 16px;
      border-radius: 8px;
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
      font-size: 14px;
      z-index: 10000;
      display: flex;
      align-items: center;
      gap: 10px;
      text-decoration: none;
      box-shadow: 0 4px 6px rgba(0,0,0,0.1);
      transition: transform 0.2s ease-in-out;
  }
  #karbon-promo-banner:hover {
      transform: scale(1.05);
  }
