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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #ffeef8 0%, #f0f8ff 100%);
    min-height: 100vh;
    color: #333;
}

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

/* Header Styles */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    margin-bottom: 20px;
}

.app-title {
    font-size: 2rem;
    font-weight: 600;
    color: #ff6b9d;
    text-shadow: 0 2px 4px rgba(255, 107, 157, 0.2);
}

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

.search-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.search-toggle:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.add-moment-btn {
    background: linear-gradient(135deg, #ff6b9d, #ff8fab);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 107, 157, 0.3);
    transition: all 0.3s ease;
}

.add-moment-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.4);
}

.random-btn {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
    transition: all 0.3s ease;
}

.random-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
}

.filter-toggle {
    background: linear-gradient(135deg, #00b894, #00cec9);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.3);
    transition: all 0.3s ease;
}

.filter-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 184, 148, 0.4);
}

/* Search Container */
.search-container {
    display: none;
    position: relative;
    margin-bottom: 20px;
    animation: slideDown 0.3s ease;
}

.search-container.active {
    display: block;
}

/* Filter Container */
.filter-container {
    display: none;
    margin-bottom: 20px;
    animation: slideDown 0.3s ease;
}

.filter-container.active {
    display: block;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.filter-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.filter-btn:hover {
    background: rgba(255, 107, 157, 0.1);
    border-color: #ff6b9d;
}

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

.search-input {
    width: 100%;
    padding: 15px 50px 15px 20px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: #ff6b9d;
    box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.1);
}

.search-clear {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #999;
}

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

.modal-overlay.active {
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

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

.modal-header h2 {
    color: #ff6b9d;
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    padding: 5px;
}

/* Upload Area */
.upload-options {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.upload-btn {
    flex: 1;
    padding: 15px;
    border: 2px dashed #ddd;
    border-radius: 15px;
    background: #f9f9f9;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.upload-btn:hover {
    border-color: #ff6b9d;
    background: rgba(255, 107, 157, 0.05);
}

/* Preview Area */
.preview-area {
    text-align: center;
}

#previewImage {
    max-width: 100%;
    max-height: 300px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.caption-input-container {
    position: relative;
    margin-bottom: 20px;
}

#captionInput {
    width: 100%;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-family: 'Caveat', cursive;
    font-size: 1.1rem;
    font-weight: 500;
    resize: vertical;
    min-height: 80px;
    outline: none;
    transition: border-color 0.3s ease;
}

#captionInput:focus {
    border-color: #ff6b9d;
}

.caption-counter {
    position: absolute;
    bottom: -25px;
    right: 0;
    font-size: 0.8rem;
    color: #999;
}

/* Category Selection */
.category-selection {
    margin-bottom: 20px;
}

.category-label {
    display: block;
    font-weight: 500;
    margin-bottom: 10px;
    color: #333;
}

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

.category-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(0, 0, 0, 0.1);
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.category-btn:hover {
    background: rgba(255, 107, 157, 0.1);
    border-color: #ff6b9d;
}

.category-btn.selected {
    background: #ff6b9d;
    color: white;
    border-color: #ff6b9d;
}

.preview-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Button Styles */
.btn-primary {
    background: linear-gradient(135deg, #ff6b9d, #ff8fab);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 157, 0.4);
}

.btn-secondary {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
    padding: 12px 25px;
    border-radius: 25px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #e9e9e9;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #333;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 30px;
    opacity: 0.8;
}

/* Section Headers */
.moments-section {
    display: block;
}

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

.section-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.view-options {
    display: flex;
    gap: 10px;
}

.view-all-btn, .back-btn, .view-btn {
    background: none;
    border: 1px solid #ff6b9d;
    color: #ff6b9d;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.view-all-btn:hover, .back-btn:hover, .view-btn:hover {
    background: #ff6b9d;
    color: white;
    transform: translateY(-1px);
}

/* Load More */
.load-more-container {
    text-align: center;
    margin-top: 30px;
    padding: 20px 0;
}

.load-more-btn {
    padding: 12px 30px;
    font-size: 1rem;
}

/* Statistics Section */
.stats-section {
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

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

.stat-card {
    background: white;
    padding: 15px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 600;
    color: #ff6b9d;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
}

.inspirational-quote {
    text-align: center;
    font-family: 'Caveat', cursive;
    font-size: 1.2rem;
    color: #666;
    font-style: italic;
    padding: 15px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 15px;
    border-left: 4px solid #ff6b9d;
}

/* Masonry Grid */
.masonry-grid {
    column-count: 2;
    column-gap: 15px;
    padding: 20px 0;
}

@media (min-width: 768px) {
    .masonry-grid {
        column-count: 3;
        column-gap: 20px;
    }
}

@media (min-width: 1024px) {
    .masonry-grid {
        column-count: 4;
    }
}

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

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

@keyframes polaroidAppear {
    from {
        opacity: 0;
        transform: translateY(20px) rotate(0deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotate(var(--rotation));
    }
}

/* Polaroid Card Styles */
.polaroid-card {
    background: #fefefe;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
    break-inside: avoid;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: polaroidAppear 0.6s ease;
    transform-origin: center center;
    position: relative;
    padding: 15px 15px 20px 15px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.polaroid-card:nth-child(odd) {
    --rotation: -2deg;
}

.polaroid-card:nth-child(even) {
    --rotation: 2deg;
}

.polaroid-card:nth-child(3n) {
    --rotation: -1deg;
}

.polaroid-card:hover {
    transform: translateY(-5px) rotate(0deg) scale(1.02);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2), 0 5px 15px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.polaroid-image {
    width: 100%;
    height: auto;
    border-radius: 10px;
    display: block;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.polaroid-caption {
    padding: 0;
    background: transparent;
    min-height: 60px;
}

.polaroid-text {
    font-family: 'Caveat', cursive;
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.3;
    color: #333;
    margin-bottom: 8px;
    word-wrap: break-word;
}

.polaroid-timestamp {
    font-size: 0.75rem;
    color: #999;
    font-family: 'Inter', sans-serif;
    font-weight: 300;
}

.polaroid-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.favorite-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    transition: transform 0.3s ease;
    padding: 5px;
    border-radius: 50%;
}

.favorite-btn:hover {
    transform: scale(1.2);
}

.favorite-btn.favorited .heart {
    color: #ff6b9d;
}

.polaroid-category {
    font-size: 0.7rem;
    color: #999;
    margin-bottom: 5px;
    opacity: 0.8;
}

/* Expanded Modal Styles */
.expanded-content {
    position: relative;
    max-width: 600px;
    width: 90%;
    background: transparent;
}

.expanded-polaroid {
    background: #fefefe;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    animation: expandIn 0.4s ease;
    padding: 25px 25px 30px 25px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

#expandedImage {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.expanded-caption {
    padding: 0;
    background: transparent;
}

#expandedCaptionText {
    font-family: 'Caveat', cursive;
    font-size: 1.3rem;
    font-weight: 500;
    line-height: 1.4;
    color: #333;
    margin-bottom: 15px;
}

.expanded-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#expandedTimestamp {
    font-size: 0.9rem;
    color: #999;
    font-family: 'Inter', sans-serif;
}

.expanded-favorite {
    font-size: 1.5rem;
}

/* Confetti Animation */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10000;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ff6b9d;
    animation: confetti-fall 3s linear forwards;
}

.confetti-piece:nth-child(odd) {
    background: #6c5ce7;
    border-radius: 50%;
}

.confetti-piece:nth-child(3n) {
    background: #00b894;
    transform: rotate(45deg);
}

.confetti-piece:nth-child(4n) {
    background: #fdcb6e;
    border-radius: 2px;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Photo Filters */
.filter-vintage {
    filter: sepia(0.3) contrast(1.2) brightness(1.1) saturate(0.8);
}

.filter-warm {
    filter: brightness(1.1) contrast(1.1) saturate(1.2) hue-rotate(10deg);
}

.filter-soft {
    filter: brightness(1.05) contrast(0.95) saturate(0.9) blur(0.5px);
}

.filter-none {
    filter: none;
}

/* Timeline View */
.timeline-container {
    position: relative;
    padding: 20px 0;
}

.timeline-date-group {
    margin-bottom: 40px;
}

.timeline-date-header {
    position: sticky;
    top: 80px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    border-radius: 25px;
    margin-bottom: 20px;
    font-weight: 600;
    color: #ff6b9d;
    text-align: center;
    box-shadow: 0 4px 15px rgba(255, 107, 157, 0.1);
    z-index: 5;
}

.timeline-moments {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    padding: 0 10px;
}

.timeline-moment {
    background: white;
    border-radius: 15px;
    padding: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.timeline-moment:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.timeline-moment-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 10px;
}

.timeline-moment-caption {
    font-family: 'Caveat', cursive;
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.timeline-moment-time {
    font-size: 0.7rem;
    color: #999;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timeline-moment-category {
    font-size: 0.8rem;
}

.timeline-moment-favorite {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

@keyframes expandIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-container {
        padding: 0 10px;
    }

    .app-header {
        padding: 15px 0;
    }

    .app-title {
        font-size: 1.5rem;
    }

    .header-actions {
        gap: 8px;
    }

    .add-moment-btn, .random-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .section-header {
        margin-bottom: 15px;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .view-all-btn, .back-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .upload-options {
        flex-direction: column;
    }

    .modal-content {
        padding: 20px;
        margin: 20px;
    }

    .masonry-grid {
        column-gap: 10px;
        padding: 15px 0;
    }

    .polaroid-card {
        margin-bottom: 12px;
        padding: 12px 12px 15px 12px;
    }

    .polaroid-image {
        margin-bottom: 10px;
        border-radius: 8px;
    }

    .polaroid-caption {
        min-height: 50px;
    }

    .polaroid-text {
        font-size: 0.85rem;
        line-height: 1.3;
    }

    .polaroid-timestamp {
        font-size: 0.7rem;
    }

    .expanded-polaroid {
        padding: 20px 20px 25px 20px;
    }

    #expandedImage {
        border-radius: 12px;
        margin-bottom: 15px;
    }

    #expandedCaptionText {
        font-size: 1rem;
    }
}
