/* Base Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: #fff;
    color: #333;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: 4rem;
}

/* Form Styles */
#itineraryForm {
    margin: 40px 0;
}

.input-sentence {
    font-size: 1.8rem;
    line-height: 2.5;
    color: #333;
    margin: 0;
    font-weight: 500;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.input-sentence input[type="text"] {
    font-size: inherit;
    font-family: inherit;
    font-weight: inherit;
    border: none;
    border-bottom: 2px solid #ddd;
    background: transparent;
    width: 160px;
    padding: 4px 8px;
    outline: none;
    transition: all 0.2s ease;
}

.input-sentence input[type="text"]:focus {
    border-bottom-color: #2196F3;
}

/* Edit mode form styling */
.edit-mode-banner + .input-sentence input[type="text"] {
    border-bottom-color: #FF9800;
    background-color: rgba(255, 152, 0, 0.05);
}

.edit-mode-banner + .input-sentence select {
    border-bottom-color: #FF9800;
    background-color: rgba(255, 152, 0, 0.05);
}

.input-sentence select {
    font-size: inherit;
    font-family: inherit;
    font-weight: inherit;
    border: none;
    border-bottom: 2px solid #ddd;
    background: transparent;
    padding: 4px 24px 4px 8px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0 center;
    background-size: 1em;
    min-width: 120px;
}

.input-sentence select:focus {
    border-bottom-color: #2196F3;
}

/* Button Styles */
#submitButton {
    background-color: #2196F3;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 1.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin-left: 15px;
}

#submitButton:hover {
    background-color: #1976D2;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#submitButton:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Update button styling for edit mode */
.edit-mode-banner ~ .input-sentence #submitButton {
    background-color: #FF9800;
}

.edit-mode-banner ~ .input-sentence #submitButton:hover {
    background-color: #F57C00;
}

/* Result Styles */
.result-container {
    margin-top: 2rem;
}

.day-container {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

.day-container:last-child {
    border-bottom: none;
}

.day-container h2 {
    margin: 0 0 1rem 0;
    color: #1976D2;
    font-size: 1.4em;
    font-weight: 600;
}

/* Minimal styles for shared view markdown */
.markdown-view {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    line-height: 1.6;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.markdown-view strong {
    font-weight: 600;
}

.markdown-view p {
    margin: 0.5em 0;
}

.markdown-view h1,
.markdown-view h2,
.markdown-view h3 {
    margin: 1em 0 0.5em;
}

.refine-instructions {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 8px;
    background-color: #f0f7ff;
    border-radius: 8px;
    color: #1976D2;
    font-weight: 500;
    border: 1px dashed #2196F3;
}

.selectable-item {
    padding: 0.75rem;
    margin: 0;
    background-color: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.selectable-item:hover {
    background-color: #f0f0f0;
    border-left-color: #2196F3;
}

.selectable-item .forbidden-emoji {
    opacity: 0;
    transition: opacity 0.2s ease;
}

.selectable-item.strikethrough {
    opacity: 0.7;
}

.selectable-item.strikethrough .content {
    text-decoration: line-through;
}

.selectable-item.strikethrough .forbidden-emoji {
    opacity: 1;
}

.selectable-item .content strong {
    color: #1976D2;
    font-weight: 600;
}

/* Day Section Styles */
.day-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.day-section h2 {
    color: #1976D2;
    margin-bottom: 1.5rem;
    font-size: 1.4em;
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5rem;
}

.activities {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.activity-item {
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #2196F3;
    transition: all 0.2s ease;
}

.activity-item:hover {
    background-color: #f0f0f0;
    transform: translateX(5px);
}

.activity-item strong {
    color: #1976D2;
    font-weight: 600;
}

/* Stats Banner */
.stats-banner {
    /* Remove fixed positioning */
    position: relative;
    margin-top: 3rem;
    padding: 1rem 0;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: center;
    gap: 2rem;
    font-size: 0.9rem;
    text-align: center;
}

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

.stat-number {
    font-weight: 600;
    color: #1976D2;
    font-size: 1.1em;
}

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

.events-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #FF9F1C;
}

.events-section h3 {
    color: #FF9F1C;
    margin-bottom: 1rem;
}

.events-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.events-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid #eee;
}

.events-list li:last-child {
    border-bottom: none;
}

/* Share URL and Keep Button Styles */
.share-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    margin: 1rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

@media (min-width: 768px) {
    .share-container {
        flex-direction: row;
        align-items: center;
    }
}

.share-container input {
    padding: 0.75rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    width: 100%;
}

.share-container input:hover {
    background: #f8f8f8;
    border-color: #2196F3;
}

.keep-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.2s ease;
    white-space: nowrap;
    width: 100%;
}

@media (min-width: 768px) {
    .keep-button {
        width: auto;
    }
}

.keep-button:hover {
    background: #1976D2;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.keep-button.kept {
    background: #43A047;
}

.keep-button .keep-icon {
    font-size: 1.1em;
}

/* Selection Actions */
#selection-actions, .selection-actions {
    margin: 1rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

#top-selection-actions {
    margin-bottom: 1.5rem;
}

#skipSelectedButton, .selection-actions button {
    background-color: #1976D2;
    color: white;
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
}

#skipSelectedButton:hover, .selection-actions button:hover {
    background-color: #1565C0;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#selected-count, .selection-actions span {
    color: #1976D2;
    font-weight: 600;
}

/* Loading Styles */
.loading {
    text-align: center;
    padding: 2rem;
}

.emoji-loader {
    font-size: 2.5em;
    margin: 1rem 0;
}

.trip-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    color: #666;
    flex-wrap: wrap;
}

.new-plan-button {
    display: inline-block;
    margin-top: 2rem;
    padding: 1rem 2rem;
    background-color: #2196F3;
    color: white;
    text-decoration: none;
    border-radius: 25px;
    transition: all 0.2s ease;
}

.new-plan-button:hover {
    background-color: #1976D2;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.error-message {
    text-align: center;
    padding: 2rem;
    margin: 2rem auto;
    max-width: 600px;
    background-color: #fff3f3;
    border-radius: 8px;
    color: #d32f2f;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.error-message .new-plan-button {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.75rem 1.5rem;
    background-color: #2196F3;
    color: white;
    text-decoration: none;
    border-radius: 25px;
    transition: all 0.2s ease;
}

.error-message .new-plan-button:hover {
    background-color: #1976D2;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Stats Page Styles */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.stat-card {
    background: #ffffff;
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #2c3e50;
    margin: 1rem 0;
}

.stat-number.large {
    font-size: 3.5rem;
    color: #3498db;
}

.stats-details {
    margin-top: 3rem;
}

.latest-plans {
    margin-bottom: 3rem;
}

.plans-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.plan-item {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.plan-date {
    color: #666;
    font-size: 0.9rem;
}

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

.popular-section ul {
    list-style: none;
    padding: 0;
}

.popular-section li {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.popular-section li:last-child {
    border-bottom: none;
}

.back-link {
    margin-top: 3rem;
    text-align: center;
}

.stats-link {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #2196F3;
    color: white;
    border-radius: 25px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.stats-link:hover {
    background: #1976D2;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Add this to your existing CSS file */

.rate-limit-message {
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    padding: 15px;
    margin: 20px 0;
    border-radius: 5px;
    text-align: center;
}

.rate-limit-message strong {
    font-weight: bold;
}

.retry-button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    margin-top: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.retry-button:hover {
    background-color: #0069d9;
}

.language-tag {
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 0.8em;
    color: #555;
}

/* Action Buttons */
.action-buttons {
    margin-top: 2rem;
    text-align: left;
    font-size: 1.1rem;
    color: #757575;
    padding-left: 1rem;
}

.text-link {
    color: #2196F3;
    text-decoration: none;
    padding: 0 0.5rem;
    position: relative;
    transition: color 0.2s ease;
}

.text-link:hover {
    color: #1976D2;
    text-decoration: underline;
}

#editButton {
    color: #FF9800;
}

#editButton:hover {
    color: #F57C00;
}

/* Edit mode banner */
.edit-mode-banner {
    background-color: #FFF3E0;
    color: #E65100;
    padding: 0.75rem;
    text-align: center;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    font-weight: 500;
    border-left: 4px solid #FF9800;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-size: 1.1rem;
}

/* Credits styles */
.bottom-banners {
    display: flex;
    flex-direction: column;
    margin-top: 1rem;
}

.credits-banner {
    padding: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    margin-top: 10px;
}

/* New purchase options container */
.purchase-options {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

/* New unlimited message styling */
.unlimited-message {
    color: #4CAF50;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    margin-left: auto;
}

.unlimited-message:before {
    content: '✨';
    font-size: 1rem;
    margin-right: 4px;
}

/* Stack credits elements on mobile */
@media (max-width: 600px) {
    .credits-banner {
        flex-direction: column;
        gap: 10px;
        padding: 15px 0;
    }
    
    .purchase-options {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 8px;
        margin-left: 0;
    }
    
    .unlimited-message {
        margin: 10px 0;
        margin-left: 0;
        justify-content: center;
    }
    
    .buy-credits-button, .promo-button {
        width: 100%;
        padding: 10px;
    }
}

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

.credits-count {
    font-size: 0.9rem;
}

.credits-time {
    font-size: 0.8rem;
    color: #666;
}

.buy-credits-button {
    background-color: transparent;
    color: #4CAF50;
    border: 1px solid #4CAF50;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.buy-credits-button:hover {
    background-color: #4CAF50;
    color: white;
}

.buy-credits-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.unlimited-status {
    color: #4CAF50;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.unlimited-status:before {
    content: '✨';
    font-size: 1rem;
}

/* Make the emoji more visible */
.unlimited-status .emoji {
    margin-left: 4px;
}

.access-options {
    display: flex;
    gap: 8px;
}

/* Ensure unlimited message is visible */
.unlimited-message {
    display: block;
}

.promo-button {
    background-color: transparent;
    color: #666;
    border: 1px solid #ddd;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
}

.promo-button:hover {
    background-color: #f5f5f5;
}

/* Modal styles */
.modal {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    position: relative;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 20px;
    cursor: pointer;
}

.promo-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 15px 0;
}

.promo-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.promo-form button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 5px;
}

.promo-divider {
    text-align: center;
    margin: 10px 0;
    color: #666;
    font-size: 14px;
    position: relative;
}

.promo-divider:before,
.promo-divider:after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background-color: #ddd;
}

.promo-divider:before {
    left: 0;
}

.promo-divider:after {
    right: 0;
}

.promo-message {
    margin-top: 10px;
    padding: 8px 0;
    font-size: 0.9rem;
}

.promo-message.success {
    color: #4CAF50;
}

.promo-message.error {
    color: #f44336;
}

.checkout-message {
    margin: 15px 0;
    padding: 10px;
    max-width: 100%;
    text-align: center;
    font-size: 0.9rem;
}

.verification-code {
    margin: 10px 0 5px 0;
    font-size: 0.9rem;
}

.verification-code strong {
    font-family: monospace;
    background-color: #e7f7e7;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 1rem;
}

.code-instruction {
    font-size: 0.8rem;
    margin: 5px 0;
    color: #666;
}

.checkout-message.success {
    color: #2e7d32;
}

.checkout-message.error {
    background-color: #fef0f0;
    border: 1px solid #f44336;
    color: #d32f2f;
}

/* Refine instructions styling */
.refine-instructions {
    margin: 1.5rem 0;
    padding: 10px 15px;
    background-color: #f5f8ff;
    border-radius: 8px;
    border-left: 4px solid #2196F3;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.95rem;
}

.refine-instructions.top-instructions {
    margin-bottom: 2rem;
    border-bottom: 1px solid #e0e8ff;
    padding-bottom: 15px;
}

.refine-instructions.bottom-instructions {
    margin-top: 2.5rem;
    border-top: 1px solid #e0e8ff;
    padding-top: 15px;
}

.refine-instructions button {
    background-color: #2196F3;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.refine-instructions button:hover {
    background-color: #1976D2;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.refine-instructions span {
    font-weight: 500;
}