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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

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

/* Navbar */
.navbar {
    background-color: #39683c;
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-links a {
    color: white;
    text-decoration: none;
    transition: opacity 0.2s;
}

.nav-links a:hover {
    opacity: 0.8;
}

.nav-user {
    color: #bdc3c7;
}

.logout-form {
    display: inline;
}

.btn-logout {
    background: none;
    border: 1px solid #fff;
    color: white;
    padding: 5px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-logout:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Login Page */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #2d5230 0%, #39683c 100%);
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-container h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #39683c;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.login-form input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.login-form input:focus {
    outline: none;
    border-color: #39683c;
}

.login-form .btn {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: #39683c;
    color: white;
}

.btn-primary:hover {
    background-color: #2d5230;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.875rem;
}

/* Error Message */
.error-message {
    background-color: #fee;
    border: 1px solid #e74c3c;
    color: #c0392b;
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* Dashboard */
.dashboard {
    padding: 20px 0;
}

.dashboard h1 {
    margin-bottom: 20px;
}

.dashboard-info {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.dashboard-info p {
    margin-bottom: 10px;
}

.admin-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
}

.admin-section h2 {
    margin-bottom: 15px;
}

/* Admin Users */
.admin-users {
    padding: 20px 0;
}

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

.users-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.users-table th,
.users-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.users-table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.users-table tr:hover {
    background-color: #f8f9fa;
}

.actions {
    display: flex;
    gap: 5px;
}

.inline-form {
    display: inline;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge.admin {
    background-color: #9b59b6;
    color: white;
}

.badge.user {
    background-color: #39683c;
    color: white;
}

.badge.active {
    background-color: #27ae60;
    color: white;
}

.badge.inactive {
    background-color: #95a5a6;
    color: white;
}

.badge.referral-count {
    background-color: #39683c;
    color: white;
    font-size: 0.875rem;
    padding: 4px 10px;
}

/* User Form */
.user-form-page {
    padding: 20px 0;
    max-width: 600px;
}

.user-form-page h1 {
    margin-bottom: 20px;
}

.user-form {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: #39683c;
}

.checkboxes {
    margin-bottom: 30px;
}

.checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Referrals Section (Dashboard) */
.referrals-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.referrals-section h2 {
    margin-bottom: 15px;
}

.stats-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #39683c 0%, #2d5230 100%);
    border-radius: 8px;
    color: white;
    margin-bottom: 15px;
}

.stats-number {
    font-size: 3rem;
    font-weight: bold;
}

.stats-label {
    font-size: 1rem;
    opacity: 0.9;
}

/* Progress Bar */
.progress-bar-container {
    width: 100%;
    max-width: 300px;
    height: 12px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    margin-top: 15px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: #fff;
    border-radius: 6px;
    transition: width 0.3s ease;
}

.goal-badge {
    display: inline-block;
    margin-top: 10px;
    padding: 5px 15px;
    background-color: #27ae60;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.goal-remaining {
    display: block;
    margin-top: 10px;
    font-size: 0.875rem;
    opacity: 0.9;
}

.stats-card.goal-reached {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
}

/* Progress inline (for referrals list) */
.goal-progress-inline {
    margin-top: 8px;
}

.progress-text {
    color: #666;
    font-size: 0.95rem;
}

.goal-badge-small {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 10px;
    background-color: #27ae60;
    color: white;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.goal-remaining-small {
    color: #999;
    font-size: 0.875rem;
}

.progress-bar-container-small {
    width: 200px;
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    margin-top: 8px;
    overflow: hidden;
}

.progress-bar-container-small .progress-bar {
    background-color: #39683c;
}

.goal-progress-inline.goal-reached .progress-bar-container-small .progress-bar {
    background-color: #27ae60;
}

/* Admin goal indicators */
.badge.referral-count.goal-reached {
    background-color: #27ae60;
}

.badge.goal-check {
    background-color: #27ae60;
    color: white;
    margin-left: 5px;
}

.admin-buttons {
    display: flex;
    gap: 10px;
}

/* Referrals Page */
.referrals-page,
.admin-referrals {
    padding: 20px 0;
}

.referral-count {
    color: #666;
    margin-top: 5px;
}

.referrals-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.referrals-table th,
.referrals-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.referrals-table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.referrals-table tr:hover {
    background-color: #f8f9fa;
}

.owner-info {
    display: flex;
    flex-direction: column;
}

.owner-info small {
    color: #666;
    font-size: 0.85rem;
}

/* Referral Form */
.referral-form-page {
    padding: 20px 0;
    max-width: 600px;
}

.referral-form-page h1 {
    margin-bottom: 20px;
}

.referral-form {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.empty-state p {
    margin-bottom: 20px;
    color: #666;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .navbar {
        flex-direction: column;
        gap: 15px;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .admin-buttons {
        flex-direction: column;
    }

    .referrals-table {
        font-size: 0.875rem;
    }

    .referrals-table th,
    .referrals-table td {
        padding: 10px;
    }
}
