/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    overflow: hidden;
    height: 100vh;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 50%, #a5d6a7 100%);
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(135deg, #66bb6a 0%, #4caf50 50%, #388e3c 100%);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    align-items: center;
}

.header-content {
    width: 100%;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.logo i {
    font-size: 24px;
}

.logo h1 {
    font-family: 'Emilys Candy', cursive;
    font-size: 24px;
    font-weight: normal;
    letter-spacing: 1px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    color: white;
    font-size: 14px;
}

.header-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

/* Main Content */
.main-content {
    flex: 1;
    margin-top: 60px;
    margin-bottom: 65px;
    position: relative;
    overflow: hidden;
}

/* Tab Content */
.tab-content {
    display: none;
    height: 100%;
    overflow-y: auto;
}

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

/* Map Container */
#map {
    width: 100%;
    height: 100%;
}

/* Haiku Here Popup */
.haiku-here-popup {
    position: absolute;
    z-index: 999;
    transform: translate(-50%, -100%);
    margin-top: -10px;
}

.haiku-here-btn {
    background: linear-gradient(135deg, #81c784 0%, #66bb6a 50%, #4caf50 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(76, 175, 80, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    animation: bounceIn 0.5s ease;
}

.haiku-here-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 30px rgba(76, 175, 80, 0.5);
    background: linear-gradient(135deg, #66bb6a 0%, #4caf50 50%, #388e3c 100%);
}

.haiku-here-btn:active {
    transform: scale(0.98);
}

.haiku-here-btn i {
    font-size: 16px;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Adjust Leaflet control position */
.leaflet-top.leaflet-left {
    top: 80px !important;
}

/* Location Button */
.location-btn {
    position: absolute;
    bottom: 30px;
    right: 50px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff 0%, #f1f8e9 100%);
    border: 2px solid #66bb6a;
    color: #4caf50;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 3px 20px rgba(76, 175, 80, 0.3);
    transition: all 0.3s ease;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.location-btn:hover {
    background: linear-gradient(135deg, #66bb6a 0%, #4caf50 100%);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 25px rgba(76, 175, 80, 0.4);
}

/* Footer Navigation */
.tab-navigation {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65px;
    background: linear-gradient(180deg, #ffffff 0%, #f1f8e9 100%);
    border-top: 1px solid #c8e6c9;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.tab-nav-btn {
    flex: 1;
    height: 100%;
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    color: #999;
    transition: all 0.3s ease;
    position: relative;
}

.tab-nav-btn i {
    font-size: 20px;
}

.tab-nav-btn span {
    font-size: 11px;
}

.tab-nav-btn.active {
    color: #4caf50;
    font-weight: 500;
}

.tab-nav-btn:hover {
    color: #66bb6a;
}

.notification-badge {
    position: absolute;
    top: 10px;
    right: calc(50% - 15px);
    background: #ff4444;
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Timeline Styles */
.timeline-container,
.search-container,
.notifications-container,
.profile-container {
    height: 100%;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(180deg, #f1f8e9 0%, #e8f5e9 50%, #dcedc8 100%);
    position: relative;
}

/* Pull to Refresh */
.pull-to-refresh {
    position: absolute;
    top: -60px;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.ptr-content {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #66bb6a;
}

.ptr-icon {
    font-size: 20px;
    transition: transform 0.3s ease;
}

.ptr-icon.rotate {
    transform: rotate(180deg);
}

.ptr-text {
    font-size: 14px;
    font-weight: 500;
}

.timeline-container.refreshing .pull-to-refresh {
    top: 0;
}

.timeline-container.refreshing .ptr-icon {
    animation: spin 1s linear infinite;
}

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

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

.timeline-header h2,
.notifications-header h2 {
    color: #2c5f3f;
    font-size: 24px;
}

.refresh-btn,
.mark-read-btn {
    background: linear-gradient(135deg, #66bb6a 0%, #4caf50 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.3);
}

.refresh-btn:hover,
.mark-read-btn:hover {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    box-shadow: 0 3px 15px rgba(76, 175, 80, 0.4);
}

.timeline-list,
.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.timeline-item {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border: 1px solid #e8f5ed;
}

.timeline-item:hover {
    box-shadow: 0 4px 20px rgba(111, 181, 132, 0.2);
    transform: translateY(-2px);
}

.timeline-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.timeline-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.timeline-user-info {
    flex: 1;
}

.timeline-display-name {
    font-weight: 500;
    color: #333;
    font-size: 15px;
}

.timeline-username {
    color: #999;
    font-size: 13px;
}

.timeline-haiku {
    font-family: 'Noto Serif JP', serif;
    font-size: 16px;
    line-height: 1.6;
    color: #2c5f3f;
    margin-bottom: 15px;
    padding: 15px;
    background: #f8fdfb;
    border-radius: 10px;
    border-left: 3px solid #7ed493;
}

.haiku-line {
    display: block;
    margin: 5px 0;
}

.timeline-photo {
    width: 100%;
    max-height: 250px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 15px;
}

.timeline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 15px 0;
    font-size: 13px;
    color: #666;
}

.timeline-location {
    color: #6fb584;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.timeline-location:hover {
    text-decoration: underline;
}

.timeline-date {
    color: #999;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.timeline-engagement {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.engagement-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    padding: 5px 10px;
    border-radius: 20px;
}

.engagement-btn:hover {
    background: #f0f0f0;
}

.engagement-btn.liked {
    color: #ff4444;
}

.engagement-btn.reposted {
    color: #00ba7c;
}

.engagement-btn i {
    font-size: 16px;
}

.engagement-count {
    font-weight: 500;
}

/* Search Styles */
.search-header {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #d4e8db;
    border-radius: 25px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #7ed493;
}

.search-btn {
    background: #6fb584;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-btn:hover {
    background: #5ea271;
}

.search-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.filter-btn {
    background: white;
    border: 1px solid #d4e8db;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.filter-btn.active {
    background: #6fb584;
    color: white;
    border-color: #6fb584;
}

.trending-section {
    margin-top: 30px;
}

.trending-section h3 {
    color: #2c5f3f;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.trending-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag-chip {
    background: #e8f5ed;
    color: #4a7c59;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tag-chip:hover {
    background: #7ed493;
    color: white;
}

/* Profile Styles */
.profile-header {
    margin: -20px -20px 20px -20px;
}

.profile-cover {
    height: 120px;
    background: linear-gradient(135deg, #6fb584 0%, #5ea271 100%);
}

.profile-info {
    padding: 0 20px;
    text-align: center;
    margin-top: -50px;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid white;
    margin-bottom: 10px;
}

.profile-name {
    color: #2c5f3f;
    font-size: 22px;
    margin-bottom: 5px;
}

.profile-username {
    color: #999;
    font-size: 14px;
    margin-bottom: 10px;
}

.profile-bio {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 20px;
}

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

.stat-value {
    font-size: 20px;
    font-weight: bold;
    color: #2c5f3f;
}

.stat-label {
    font-size: 12px;
    color: #999;
}

.edit-profile-btn {
    background: #6fb584;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    margin-bottom: 20px;
}

.edit-profile-btn:hover {
    background: #5ea271;
}

.profile-tabs {
    display: flex;
    border-bottom: 1px solid #e0e0e0;
    margin: 0 -20px;
}

.profile-tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 12px;
    cursor: pointer;
    color: #999;
    transition: all 0.3s ease;
    position: relative;
}

.profile-tab-btn.active {
    color: #6fb584;
}

.profile-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #6fb584;
}

.profile-content {
    padding-top: 20px;
}

/* Notification Styles */
.notification-item {
    background: white;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.notification-item:hover {
    background: #f8fdfb;
}

.notification-item.unread {
    background: #e8f5ed;
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.notification-icon.like {
    background: #ffe8e8;
    color: #ff4444;
}

.notification-icon.reply {
    background: #e8f0ff;
    color: #4a90e2;
}

.notification-icon.follow {
    background: #f0e8ff;
    color: #8b72ee;
}

.notification-icon.repost {
    background: #e8fff0;
    color: #00ba7c;
}

.notification-content {
    flex: 1;
}

.notification-text {
    color: #333;
    font-size: 14px;
    margin-bottom: 5px;
}

.notification-time {
    color: #999;
    font-size: 12px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #f8fdfb;
    border-radius: 20px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #666;
}

.modal-title {
    font-family: 'Noto Serif JP', serif;
    font-size: 24px;
    margin-bottom: 25px;
    color: #2c5f3f;
    text-align: center;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #4a7c59;
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #d4e8db;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
    font-family: 'Noto Serif JP', serif;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #7ed493;
    background: #fafffe;
    box-shadow: 0 0 0 3px rgba(126, 212, 147, 0.1);
}

.char-count {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(10%);
    font-size: 12px;
    color: #999;
}

.location-info {
    background: #e8f5ed;
    padding: 12px 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0 10px 0;
    border: 1px solid #c8e0d1;
    position: relative;
}

.location-remove-btn {
    margin-left: auto;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid #ff6b6b;
    color: #ff6b6b;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.location-remove-btn:hover {
    background: #ff6b6b;
    color: white;
}

.location-notice {
    background: #fff3cd;
    padding: 10px 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    border: 1px solid #ffc107;
    color: #856404;
    font-size: 14px;
}

.location-notice i {
    color: #ffc107;
}

.location-info i {
    color: #6fb584;
    font-size: 18px;
}

.location-info span {
    color: #4a7c59;
    font-size: 14px;
}

.submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #7ed493 0%, #6fb584 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(111, 181, 132, 0.3);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(111, 181, 132, 0.4);
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Reply Modal */
.reply-to-haiku {
    background: #f0f8f4;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-family: 'Noto Serif JP', serif;
    color: #2c5f3f;
    font-size: 14px;
}

/* Haiku Card in Popup */
.haiku-popup {
    padding: 0;
}

.haiku-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    min-width: 280px;
}

.haiku-text {
    font-family: 'Noto Serif JP', serif;
    font-size: 18px;
    line-height: 1.8;
    color: #2c5f3f;
    text-align: center;
    margin-bottom: 15px;
    padding: 15px;
    background: #f8fdfb;
    border-radius: 10px;
    border-left: 3px solid #7ed493;
}

.haiku-photo {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 15px;
}

.haiku-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.haiku-author {
    color: #666;
    font-size: 14px;
    font-style: italic;
}

.haiku-date {
    color: #999;
    font-size: 12px;
    margin: 10px 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.haiku-actions {
    display: flex;
    gap: 10px;
}

.haiku-btn {
    background: transparent;
    border: 1px solid #ddd;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    color: #666;
    font-size: 12px;
    transition: all 0.3s ease;
}

.haiku-btn:hover {
    background: #f5f5f5;
    border-color: #7ed493;
    color: #6fb584;
}

.haiku-btn.liked {
    background: #ffe8e8;
    border-color: #ff6b6b;
    color: #ff6b6b;
}

/* Custom Marker Icon */
.custom-marker {
    background: linear-gradient(135deg, #7ed493 0%, #6fb584 100%);
    border: 3px solid white;
    border-radius: 50%;
    width: 12px;
    height: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.selected-marker {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff4444 100%);
    border: 3px solid white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    box-shadow: 0 3px 10px rgba(255, 68, 68, 0.4);
    animation: bounce 0.5s ease;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Auth Modal Styles */
.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid #e0e0e0;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    color: #999;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.auth-tab.active {
    color: #4caf50;
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #66bb6a 0%, #4caf50 100%);
}

.auth-tab:hover {
    color: #66bb6a;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #6fb584 0%, #5ea271 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 3000;
    animation: toastIn 0.3s ease;
    font-size: 14px;
}

.toast.error {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
}

@keyframes toastIn {
    from {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 640px) {
    .header-content {
        padding: 0 15px;
    }
    
    .logo h1 {
        font-size: 20px;
    }
    
    .modal-content {
        width: 95%;
        padding: 20px;
    }
    
    .tab-nav-btn span {
        font-size: 10px;
    }
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #7ed493;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6fb584;
}