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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-x: hidden;
    position: relative;
    width: 100%;
    max-width: 100vw;
}

.container {
    background: var(--background-primary);
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    max-width: 800px;
    width: 100%;
    overflow: hidden;
    max-height: 90vh;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-inverse);
    padding: 40px 30px;
    text-align: center;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

main {
    padding: 40px 30px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.search-section {
    margin-bottom: 30px;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

#searchInput {
    flex: 1;
    padding: 15px 20px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    transition: border-color 0.3s;
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary-color);
}

#searchBtn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-inverse);
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

#searchBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

#searchBtn:active {
    transform: translateY(0);
}

.loader {
    display: none;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

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

.example-chips {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.chip {
    background: #f5f5f5;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s, color 0.3s;
}

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

.results-section {
    animation: fadeIn 0.5s ease-in;
}

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

.result-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    border: 1px solid #e0e0e0;
}

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

.result-header h2 {
    color: #333;
    font-size: 1.5rem;
    text-transform: capitalize;
}

.safety-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.safety-badge.safe {
    background: #d4edda;
    color: #155724;
}

.safety-badge.caution {
    background: #fff3cd;
    color: #856404;
}

.safety-badge.avoid {
    background: #f8d7da;
    color: #721c24;
}

.safety-badge.consult {
    background: #d1ecf1;
    color: #0c5460;
}

.result-content {
    color: #555;
    line-height: 1.8;
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

.result-content h3 {
    color: #333;
    margin-top: 15px;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.result-content ul {
    margin-left: 20px;
    margin-top: 10px;
}

.result-content li {
    margin-bottom: 8px;
}

.disclaimer {
    background: #fff3cd;
    padding: 15px;
    border-radius: 10px;
    color: #856404;
    font-size: 0.9rem;
    line-height: 1.6;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: fadeIn 0.3s ease-in;
}

.error-icon {
    font-size: 1.2rem;
}

/* Tab Navigation Styles */
.tab-navigation {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: var(--text-inverse);
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

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

.tab-btn.logout-btn {
    background: #ef4444;
    color: var(--text-inverse);
    margin-left: auto;
    border-color: #ef4444;
}

.tab-btn.logout-btn:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Profile Section Styles */
.profile-section {
    max-width: 700px;
    margin: 0 auto;
}

.profile-section h2 {
    color: #333;
    margin-bottom: 15px;
}

.profile-intro {
    color: #666;
    margin-bottom: 30px;
    line-height: 1.6;
}

.basic-info, .health-conditions, .theme-selection {
    margin-bottom: 30px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    color: #555;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group select {
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

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

.condition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.condition-toggle,
.radio-option {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.condition-toggle:hover,
.radio-option:hover {
    background: #e9ecef;
}

.condition-toggle input[type="checkbox"],
.radio-option input[type="radio"] {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.toggle-label,
.radio-label {
    color: #333;
    font-size: 0.95rem;
    cursor: pointer;
}

.trimester-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.save-profile-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-inverse);
    border: none;
    padding: 15px 40px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    display: block;
    margin: 30px auto;
}

.save-profile-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.profile-note {
    background: #e8f5e9;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
}

.profile-note p {
    color: #2e7d32;
    font-size: 0.9rem;
    line-height: 1.6;
}

.api-key-section {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--primary-color);
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: background 0.3s;
}

details summary:hover {
    background: #e8eaf6;
}

.api-key-content {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.api-key-content input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
}

.api-key-content input:focus {
    outline: none;
    border-color: var(--primary-color);
}

#saveApiKey {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

#saveApiKey:hover {
    background: #5a67d8;
}

.api-help {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #666;
}

.api-help a {
    color: var(--primary-color);
    text-decoration: none;
}

.api-help a:hover {
    text-decoration: underline;
}

footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    border-top: 1px solid #e0e0e0;
}

.risk-scale {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
}

.risk-scale h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1rem;
}

.risk-meter {
    position: relative;
    height: 40px;
    background: linear-gradient(to right, 
        #00ff00 0%, 
        #66ff00 20%, 
        #ffff00 40%, 
        #ffaa00 60%, 
        #ff6600 80%, 
        #ff0000 100%);
    border-radius: 20px;
    margin-bottom: 10px;
}

.risk-indicator {
    position: absolute;
    top: -5px;
    width: 50px;
    height: 50px;
    background: white;
    border: 3px solid #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: left 0.5s ease;
}

.risk-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #666;
    margin-top: 5px;
}

.safety-verdict {
    text-align: center;
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
    font-size: 1.3rem;
    font-weight: bold;
}

.safety-verdict.safe {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
}

.safety-verdict.unsafe {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
}

.safety-verdict.caution {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
}

/* Dual Safety Sections */
.dual-safety-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.safety-section {
    background: #f8f9ff;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    position: relative;
}

.safety-section .section-title {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 8px;
}

.safety-section .risk-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 15px;
    text-align: center;
}

.pregnancy-section {
    border-left: 4px solid var(--primary-color);
}

.breastfeeding-section {
    border-left: 4px solid #48bb78;
}

/* Mobile responsive for dual sections */
@media (max-width: 768px) {
    .dual-safety-sections {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .safety-section {
        padding: 15px;
    }
    
    .safety-section .section-title {
        font-size: 1.1rem;
    }
}

.follow-up-section {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7ff 0%, #f0f2ff 100%);
    border-radius: 12px;
    border: 1px solid #e0e4ff;
}

.follow-up-section h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
}

.follow-up-input-container {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.follow-up-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e0e4ff;
    border-radius: 10px;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 50px;
    font-family: inherit;
    transition: border-color 0.3s ease;
    background: white;
}

.follow-up-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(103, 58, 183, 0.1);
}

.follow-up-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.follow-up-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(103, 58, 183, 0.3);
}

.follow-up-btn:active {
    transform: translateY(0);
}

.follow-up-conversation {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e4ff;
}

.follow-up-qa {
    margin-bottom: 20px;
    animation: fadeInUp 0.4s ease;
}

.follow-up-question {
    background: #fff;
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    font-weight: 500;
    color: #555;
    border-left: 3px solid var(--primary-color);
}

.follow-up-answer {
    background: #f8f9ff;
    padding: 15px;
    border-radius: 10px;
    line-height: 1.6;
    color: #333;
}

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

/* Mobile responsiveness for follow-up section */
@media (max-width: 768px) {
    .follow-up-section {
        padding: 15px;
    }
    
    .follow-up-input-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .follow-up-btn {
        width: 100%;
        justify-content: center;
    }
    
    .follow-up-input {
        width: 100%;
    }
}

.history-section {
    margin-top: 30px;
    padding: 20px;
    background: #f0f2f5;
    border-radius: 10px;
}

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

.history-header h3 {
    color: #333;
    font-size: 1.1rem;
}

.clear-history {
    background: #dc3545;
    color: white;
    border: none;
    padding: 5px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
}

.clear-history:hover {
    background: #c82333;
}

.history-items {
    max-height: 200px;
    overflow-y: auto;
}

.history-item {
    background: white;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item:hover {
    background: #e8eaf6;
}

.history-item-name {
    font-weight: 500;
    color: #333;
}

.history-item-risk {
    font-size: 0.85rem;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.camera-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-inverse);
    border: none;
    padding: 15px 20px;
    border-radius: 10px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.camera-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.camera-btn:active {
    transform: translateY(0);
}

.image-preview {
    position: relative;
    margin: 15px 0;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #e0e0e0;
}

.image-preview img {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    display: block;
}

.remove-image {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 0, 0, 0.8);
    color: var(--text-inverse);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.3s;
}

.remove-image:hover {
    background: rgba(255, 0, 0, 1);
}

/* Premium User Interface Styles */
.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-top: 20px;
}

.user-details {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid white;
}

.user-name {
    font-weight: 600;
}

.premium-badge {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
}

.free-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.85rem;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

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

/* Auth Modal Styles */
.auth-modal, .upgrade-modal, .payment-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.auth-modal-content, .upgrade-modal-content, .payment-modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 450px;
    width: 90%;
    text-align: center;
}

.auth-buttons {
    margin: 30px 0;
}

.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 10px;
    text-decoration: none;
    color: white;
    font-weight: 600;
    transition: transform 0.2s;
}

.facebook-btn {
    background: #1877f2;
}

.instagram-btn {
    background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045);
}

.auth-btn:hover {
    transform: translateY(-2px);
}

.skip-auth, .close-modal {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    text-decoration: underline;
    padding: 10px;
}

/* Upgrade Modal Styles */
.upgrade-benefits {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    text-align: left;
}

.upgrade-benefits h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    text-align: center;
}

.upgrade-benefits ul {
    list-style: none;
}

.upgrade-benefits li {
    margin-bottom: 10px;
    padding-left: 25px;
    position: relative;
}

.upgrade-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.upgrade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

/* Payment Form Styles */
#card-element {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
}

#card-errors {
    color: #dc3545;
    margin: 10px 0;
    font-size: 0.9rem;
}

#submit-payment {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 15px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

#submit-payment:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.hidden {
    display: none !important;
}

/* Log Tab Styles */
.log-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.log-input-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.log-subtitle {
    color: #666;
    margin-bottom: 20px;
}

.log-input-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.log-text-input {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s;
}

.log-text-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.voice-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.voice-record-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
}

.voice-record-btn:active {
    transform: scale(0.95);
    background: linear-gradient(135deg, #5a67d8, #6b4299);
}

.recording-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ff4444;
    font-weight: 600;
}

.recording-dot {
    width: 10px;
    height: 10px;
    background: #ff4444;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

.save-log-btn {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.save-log-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}

/* Calendar Styles */
.calendar-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    overflow-x: hidden;
}

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

.calendar-nav {
    background: #f0f0f0;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

.calendar-nav:hover {
    background: #e0e0e0;
}

#currentMonth {
    font-size: 1.5rem;
    color: #333;
}

.calendar-grid {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    width: 100%;
    overflow-x: auto;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8f9fa;
    font-weight: 600;
    color: #666;
    width: 100%;
    min-width: 0;
}

.calendar-weekdays div {
    padding: 15px 5px;
    text-align: center;
    border-right: 1px solid #e0e0e0;
    min-width: 0;
    overflow: hidden;
}

.calendar-weekdays div:last-child {
    border-right: none;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    width: 100%;
    min-width: 0;
}

.calendar-day {
    aspect-ratio: 1;
    padding: 10px 5px;
    border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: background 0.3s;
    position: relative;
    min-height: 60px;
    min-width: 0;
    overflow: hidden;
}

.calendar-day:hover {
    background: #f8f9fa;
}

.calendar-day.has-entry {
    background: #e8f5e9;
}

.calendar-day.has-entry::after {
    content: '•';
    position: absolute;
    bottom: 5px;
    right: 5px;
    color: var(--success-color);
    font-size: 20px;
}

.calendar-day.today {
    background: #fff3e0;
    font-weight: bold;
}

.calendar-day.other-month {
    color: #ccc;
    background: #fafafa;
}

.calendar-day-number {
    font-size: 14px;
    margin-bottom: 5px;
}

.calendar-day-entries {
    font-size: 11px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Recent Entries */
.recent-entries {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.log-entries-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.log-entry-item {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    border-left: 4px solid var(--primary-color);
}

.log-entry-item:hover {
    background: #e8f5e9;
    transform: translateX(5px);
}

.log-entry-date {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
    font-weight: 600;
}

.log-entry-preview {
    color: #333;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.log-entry-type {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 0.8rem;
    margin-top: 10px;
    background: #e0e0e0;
    color: #666;
}

.log-entry-type.voice {
    background: #e8eaf6;
    color: #5e35b1;
}

.log-entry-type.text {
    background: #e3f2fd;
    color: #1976d2;
}

/* Log Entry Modal */
.log-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.log-modal-content {
    position: relative;
    background: white;
    margin: 5% auto;
    padding: 0;
    width: 90%;
    max-width: 700px;
    border-radius: 20px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.log-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 2px solid #f0f0f0;
    flex-shrink: 0;
}

.log-modal-close {
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.3s;
}

.log-modal-close:hover {
    color: #333;
}

.log-modal-body {
    padding: 20px 30px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.original-entry {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 25px;
}

.original-entry h4 {
    color: #666;
    margin-bottom: 10px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.original-entry-text {
    color: #333;
    line-height: 1.6;
    font-size: 1rem;
}

.ai-analysis {
    background: linear-gradient(135deg, #e8f5e9 0%, #f3e5f5 100%);
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

/* Calendar Sync Styles */
.calendar-sync-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
}

.calendar-sync-section h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.calendar-sync-options {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.calendar-sync-btn {
    display: flex;
    align-items: center;
    background: white;
    color: #333;
    border: 2px solid #e0e0e0;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.calendar-sync-btn:hover {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.calendar-sync-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #e8f5e9;
    border-radius: 8px;
    flex-grow: 1;
}

.sync-indicator {
    font-size: 1.2rem;
}

#syncStatusText {
    flex-grow: 1;
    color: #2e7d32;
    font-weight: 500;
}

.disconnect-btn {
    background: #ff5252;
    color: white;
    border: none;
    padding: 5px 15px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.3s;
}

.disconnect-btn:hover {
    background: #ff1744;
}

.ai-analysis h4 {
    color: var(--success-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-analysis-content {
    color: #333;
    line-height: 1.8;
}

.ai-analysis-content h5 {
    color: var(--primary-color);
    margin: 15px 0 10px;
    font-size: 1.1rem;
}

.ai-analysis-content ul {
    margin-left: 20px;
    margin-top: 10px;
}

.ai-analysis-content li {
    margin-bottom: 8px;
}

.loading-analysis {
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

.loading-spinner-small {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s linear infinite;
}

/* Success Message */
.success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success-color);
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
    z-index: 2000;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Fix for mobile scrolling when image preview is shown */
.image-preview {
    position: relative;
    z-index: 1;
}

/* When results are shown on mobile, ensure scrollability */
@media (max-width: 768px) {
    body.results-shown {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .container {
        max-height: none;
        height: auto;
        min-height: 100vh;
        overflow: visible; /* allow full page scroll on mobile */
    }
}

/* Responsive pricing cards for mobile */
@media (max-width: 768px) {
    .upgrade-pricing {
        flex-direction: column;
        align-items: center;
    }
    
    .price-card {
        width: 100%;
        max-width: 350px;
        margin-bottom: 20px;
    }
    
    .price-card.featured {
        transform: scale(1);
    }
}

@media (max-width: 600px) {
    h1 {
        font-size: 1.8rem;
        margin-bottom: 5px;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    #searchBtn {
        width: 100%;
        justify-content: center;
    }
    
    .container {
        border-radius: 0;
        /* use natural height so content can extend and page can scroll */
        height: auto;
        max-height: none;
        max-width: 100%;
        width: 100%;
        display: flex;
        flex-direction: column;
        overflow: visible;
        overflow-x: hidden;
    }
    
    body {
        padding: 0;
        height: 100vh;
        height: -webkit-fill-available;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        display: block; /* avoid flex centering limiting scroll */
        width: 100%;
        max-width: 100vw;
    }
    
    .container {
        border-radius: 0;
        max-height: none;
        height: auto; /* override earlier height if any */
        min-height: 100vh;
        min-height: -webkit-fill-available;
        overflow: visible;
    }
    
    main {
        padding: 15px 12px;
        overflow-y: visible;
        overflow-x: hidden;
        flex: 1;
        -webkit-overflow-scrolling: touch;
        min-height: auto;
        width: 100%;
        max-width: 100%;
    }
    
    header {
        padding: 20px 15px 15px 15px;
        flex-shrink: 0;
    }
    
    /* Tab Navigation Mobile Optimization */
    .tab-navigation {
        gap: 6px;
        margin-top: 15px;
        flex-wrap: wrap;
    }
    
    .tab-btn {
        padding: 8px 12px;
        font-size: 0.85rem;
        border-radius: 20px;
        flex: 1;
        min-width: auto;
        text-align: center;
    }
    
    .tab-btn.logout-btn {
        margin-left: 0;
        flex: 0 0 auto;
        padding: 8px 16px;
    }
    
    footer {
        flex-shrink: 0;
        padding: 10px 15px;
        font-size: 0.85rem;
    }
    
    .result-content {
        max-height: none;
    }
    
    /* Calendar mobile adjustments */
    .calendar-weekdays div {
        padding: 10px 2px;
        font-size: 0.7rem;
    }
    
    .calendar-day {
        padding: 5px 2px;
        min-height: 50px;
    }
    
    .calendar-day-number {
        font-size: 12px;
    }
    
    .calendar-section {
        padding: 15px 10px;
    }
    
    .calendar-grid {
        overflow-x: visible;
        width: 100%;
    }
    
    /* Mobile-specific upgrade tab adjustments */
    .upgrade-section {
        padding: 15px;
        width: 100%;
        overflow-x: hidden;
    }
    
    .upgrade-header h2 {
        font-size: 1.6rem;
    }
    
    .upgrade-benefits {
        padding: 20px;
        margin-bottom: 25px;
    }
    
    .price-card {
        padding: 25px;
    }
    
    .price {
        font-size: 2.5rem;
    }
}

/* Extra small mobile screens */
@media (max-width: 400px) {
    h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    header {
        padding: 15px 10px 12px 10px;
    }
    
    main {
        padding: 12px 8px;
        width: 100%;
        overflow-x: hidden;
    }
    
    .calendar-weekdays div {
        padding: 8px 1px;
        font-size: 0.6rem;
    }
    
    .calendar-day {
        padding: 3px 1px;
        min-height: 40px;
    }
    
    .calendar-day-number {
        font-size: 10px;
    }
    
    .tab-btn {
        padding: 6px 8px;
        font-size: 0.75rem;
    }
    
    .tab-btn.logout-btn {
        padding: 6px 12px;
    }
    
    .upgrade-header h2 {
        font-size: 1.4rem;
    }
    
    .price {
        font-size: 2rem;
    }
}

/* Upgrade Tab Styles */
.upgrade-section {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
}

.upgrade-header {
    text-align: center;
    margin-bottom: 30px;
}

.upgrade-header h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 2rem;
}

.upgrade-header p {
    color: #666;
    font-size: 1.1rem;
}

.upgrade-benefits {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
}

.upgrade-benefits h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.3rem;
}

.benefit-item {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    color: #555;
    font-size: 1rem;
}

.benefit-item span {
    margin-right: 12px;
    color: var(--success-color);
    font-weight: bold;
    font-size: 1.1rem;
}

.upgrade-pricing {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.price-card {
    background: white;
    color: #333;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    padding: 30px 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    flex: 1;
    min-width: 200px;
    max-width: 280px;
    position: relative;
    transition: transform 0.3s, box-shadow 0.3s;
}

.price-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.price-card.featured {
    border-color: var(--primary-color);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    transform: scale(1.05);
}

.price-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: bold;
}

.price-card .upgrade-pay-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.price-card.featured .upgrade-pay-btn {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
}

.price-card .upgrade-pay-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.price-label {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 10px;
}

.price {
    font-size: 3rem;
    font-weight: bold;
    margin: 15px 0;
}

.price-subtitle {
    font-size: 1.2rem;
    margin-bottom: 15px;
}

.price-features {
    font-size: 0.9rem;
    opacity: 0.9;
    line-height: 1.6;
}

.upgrade-actions {
    text-align: center;
}

.upgrade-pay-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    width: 100%;
    max-width: 300px;
}

.upgrade-pay-btn:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.upgrade-pay-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.upgrade-loading {
    color: var(--primary-color);
    font-size: 1rem;
    margin: 15px 0;
    font-weight: 500;
}

.security-note {
    color: #666;
    font-size: 0.9rem;
    margin: 20px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.upgrade-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    border: 1px solid #f5c6cb;
    text-align: center;
}

.upgrade-success {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    border: 1px solid #c3e6cb;
    text-align: center;
}

/* Preferences Section Styles */
.preferences-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    border: 1px solid #e9ecef;
}

.preferences-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.4rem;
    text-align: center;
}

.preferences-intro {
    color: #666;
    text-align: center;
    margin-bottom: 25px;
    font-style: italic;
}

.preference-group {
    margin-bottom: 25px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

.preference-group:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.1);
}

.preference-group h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preference-group .radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.preference-group .radio-option {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.preference-group .radio-option:hover {
    background: #e3f2fd;
    border-color: var(--primary-color);
}

.preference-group .radio-option input[type="radio"] {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.preference-group .radio-option input[type="radio"]:checked + .radio-label {
    color: var(--primary-color);
    font-weight: 600;
}

.preference-group .radio-option:has(input[type="radio"]:checked) {
    background: linear-gradient(135deg, #f0f4ff, #e8f0ff);
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.preference-group .radio-label {
    color: #555;
    font-size: 0.95rem;
    line-height: 1.4;
    flex: 1;
    cursor: pointer;
}

/* Responsive adjustments for preferences */
@media (max-width: 768px) {
    .preferences-section {
        padding: 20px 15px;
        margin-bottom: 25px;
    }
    
    .preference-group {
        padding: 15px;
    }
    
    .preference-group h4 {
        font-size: 1rem;
    }
    
    .preference-group .radio-option {
        padding: 10px 12px;
    }
    
    .preference-group .radio-label {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .preferences-section {
        padding: 15px 10px;
    }
    
    .preferences-section h3 {
        font-size: 1.2rem;
    }
    
    .preference-group {
        padding: 12px;
    }
    
    .preference-group .radio-option {
        padding: 8px 10px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .preference-group .radio-option input[type="radio"] {
        margin-right: 0;
        margin-bottom: 5px;
    }
}

/* Detailed Answer Functionality */
.details-section {
    margin: 25px 0;
}

.get-details-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-inverse);
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.get-details-btn:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.get-details-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.details-loader {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.detailed-content {
    background: #f8f9fc;
    border-radius: 12px;
    padding: 20px;
    margin-top: 15px;
    border-left: 4px solid var(--primary-color);
    animation: slideDown 0.3s ease-out;
}

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

.detailed-content h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

#detailedAnswer {
    color: #555;
    line-height: 1.8;
    max-height: 500px;
    overflow-y: auto;
}

#detailedAnswer h4 {
    color: #333;
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

#detailedAnswer ul {
    margin-left: 20px;
    margin-top: 10px;
}

#detailedAnswer li {
    margin-bottom: 8px;
}

#detailedAnswer p {
    margin-bottom: 12px;
}

/* Mobile responsiveness for detailed answers */
@media (max-width: 768px) {
    .detailed-content {
        padding: 15px;
    }
    
    .get-details-btn {
        padding: 10px 20px;
        font-size: 0.95rem;
    }
    
    #detailedAnswer {
        max-height: 400px;
    }
}

/* Affiliate Section */
.affiliate-section {
    background: linear-gradient(135deg, var(--primary-color)22 0%, var(--secondary-color)44 100%);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    border: 2px solid var(--primary-color)33;
}

.affiliate-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.4rem;
    text-align: center;
}

.affiliate-intro {
    color: #666;
    text-align: center;
    margin-bottom: 25px;
}

.affiliate-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.stat-item {
    background: white;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
    border: 1px solid #e9ecef;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
}

.affiliate-link-container {
    margin-bottom: 25px;
}

.affiliate-link-container label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.link-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.link-input-group input {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--primary-color)33;
    border-radius: 8px;
    background: white;
    font-size: 0.9rem;
}

.copy-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.copy-btn:hover {
    background: #5a67d8;
    transform: translateY(-2px);
}

.affiliate-note {
    font-size: 0.9rem;
    color: #666;
    background: white;
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.referral-history h4 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.referrals-list {
    background: white;
    border-radius: 10px;
    padding: 15px;
    min-height: 100px;
    border: 1px solid #e9ecef;
}

.no-referrals {
    text-align: center;
    color: #666;
    font-style: italic;
    margin: 0;
}

.referral-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.referral-email {
    font-weight: 600;
    color: #333;
}

.referral-date {
    font-size: 0.8rem;
    color: #666;
}

.referral-points {
    background: var(--success-color);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Leaderboard Section */
.leaderboard-section {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
}

.leaderboard-section h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
    text-align: center;
    font-size: 1.8rem;
}

.leaderboard-intro {
    color: #666;
    text-align: center;
    margin-bottom: 25px;
}

.leaderboard-filters {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.filter-btn {
    background: white;
    border: 2px solid var(--primary-color)33;
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

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

.filter-btn:hover {
    background: var(--primary-color)22;
}

.refresh-btn {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.refresh-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
}

.leaderboard-table {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
}

.table-header {
    display: grid;
    grid-template-columns: 60px 1fr 100px 100px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 15px;
    font-weight: 600;
    font-size: 0.9rem;
}

.table-body {
    max-height: 400px;
    overflow-y: auto;
}

.leaderboard-row {
    display: grid;
    grid-template-columns: 60px 1fr 100px 100px;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
    transition: background-color 0.2s;
}

.leaderboard-row:hover {
    background: #f8f9fa;
}

.leaderboard-row:last-child {
    border-bottom: none;
}

.rank-col {
    font-weight: bold;
    color: var(--primary-color);
    text-align: center;
}

.name-col {
    color: #333;
}

.points-col {
    text-align: center;
    font-weight: 600;
    color: var(--success-color);
}

.referrals-col {
    text-align: center;
    color: #666;
}

.rank-medal {
    font-size: 1.2rem;
}

.loading-message {
    text-align: center;
    color: #666;
    padding: 30px;
    font-style: italic;
}

.leaderboard-note {
    background: linear-gradient(135deg, var(--primary-color)11, var(--secondary-color)22);
    border-radius: 10px;
    padding: 20px;
    border-left: 4px solid var(--primary-color);
}

.leaderboard-note p {
    margin: 0 0 10px;
    color: #666;
    font-size: 0.9rem;
}

.leaderboard-note p:last-child {
    margin-bottom: 0;
}

/* Mobile responsiveness for affiliate and leaderboard */
@media (max-width: 768px) {
    .affiliate-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .link-input-group {
        flex-direction: column;
    }
    
    .table-header,
    .leaderboard-row {
        grid-template-columns: 40px 1fr 70px 70px;
        padding: 10px;
        font-size: 0.85rem;
    }
    
    .leaderboard-filters {
        flex-direction: column;
        gap: 8px;
    }
}
