@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;600;700&family=Pacifico&display=swap');

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

body {
    font-family: 'Quicksand', sans-serif;
    background: linear-gradient(135deg, #fff0f5 0%, #ffe4ec 30%, #ffd1dc 60%, #ffb6c1 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

#app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
}

#thank-you-banner {
    background: linear-gradient(135deg, #ff69b4 0%, #ff1493 50%, #ff69b4 100%);
    padding: 12px 20px;
    border-radius: 16px;
    margin-bottom: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(255, 105, 180, 0.4);
    position: relative;
    overflow: hidden;
    transition: all 0.5s ease;
}

#thank-you-banner.banner-visible {
    opacity: 1;
    max-height: 60px;
}

#thank-you-banner.banner-hidden {
    opacity: 0;
    max-height: 0;
    padding: 0;
    margin: 0;
}

.banner-content {
    color: white;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sparkle {
    animation: sparkle 1.5s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

#banner-close {
    position: absolute;
    right: 15px;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: all 0.2s;
}

#banner-close:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

header {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #ffecd2 100%);
    padding: 20px;
    border-radius: 24px;
    text-align: center;
    margin-bottom: 15px;
    box-shadow: 0 6px 25px rgba(255, 154, 158, 0.35);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translate(-30%, -30%); }
    50% { transform: translate(30%, 30%); }
}

header h1 {
    font-family: 'Pacifico', cursive;
    font-size: 2rem;
    color: #5a3d5c;
    text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.5);
    position: relative;
    z-index: 1;
}

.header-emoji {
    display: inline-block;
    animation: bounce 2s ease infinite;
}

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

.header-subtitle {
    font-size: 0.9rem;
    color: #8b5a8b;
    margin-top: 5px;
    position: relative;
    z-index: 1;
}

.status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #5a3d5c;
    margin-top: 10px;
    position: relative;
    z-index: 1;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ccc;
}

.status-dot.loading {
    background: #ffa726;
    animation: pulse-dot 1s infinite;
}

.status-dot.ready {
    background: #4caf50;
    box-shadow: 0 0 10px #4caf50;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

#main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    position: relative;
}

#camera-container {
    position: relative;
    background: linear-gradient(135deg, #2d2d2d, #1a1a1a);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    aspect-ratio: 4/3;
    max-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid rgba(255, 182, 193, 0.5);
}

#video {
    display: none;
}

#canvas {
    max-width: 100%;
    max-height: 100%;
    transform: scaleX(-1);
    border-radius: 20px;
}

#frame-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    border-radius: 20px;
}

.frame-polaroid {
    border: 15px solid white;
    border-bottom-width: 50px;
    box-shadow: inset 0 0 0 2px rgba(0,0,0,0.1);
}

.frame-rainbow {
    border: 10px solid transparent;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(90deg, red, orange, yellow, green, blue, indigo, violet) border-box;
}

.frame-hearts {
    box-shadow: inset 0 0 0 20px rgba(255, 105, 180, 0.4);
    animation: heart-pulse 2s ease-in-out infinite;
}

@keyframes heart-pulse {
    0%, 100% { box-shadow: inset 0 0 0 20px rgba(255, 105, 180, 0.4); }
    50% { box-shadow: inset 0 0 0 25px rgba(255, 105, 180, 0.5); }
}

.frame-withlove {
    box-shadow: inset 0 0 0 15px rgba(255, 240, 245, 0.8);
}

.frame-stars {
    box-shadow: inset 0 0 0 15px rgba(255, 215, 0, 0.5);
}

.frame-floral {
    box-shadow: inset 0 0 0 15px rgba(255, 182, 193, 0.6);
}

.frame-holiday {
    box-shadow: inset 0 0 0 15px rgba(34, 139, 34, 0.5);
}

.frame-birthday {
    box-shadow: inset 0 0 0 15px rgba(255, 20, 147, 0.4);
}

#props-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.placed-prop {
    position: absolute;
    cursor: grab;
    pointer-events: auto;
    transition: transform 0.2s ease;
    user-select: none;
    filter: drop-shadow(3px 3px 6px rgba(0, 0, 0, 0.4));
    z-index: 10;
}

.placed-prop:hover {
    transform: translate(-50%, -50%) scale(1.15) rotate(5deg);
}

.photo-counter {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #ff69b4;
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
}

#countdown-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 140px;
    color: white;
    text-shadow: 4px 4px 12px rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 100;
}

#countdown-display.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    animation: countdown-pulse 0.5s ease-in-out;
}

@keyframes countdown-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.3); }
}

#controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 28px;
    box-shadow: 0 6px 30px rgba(255, 105, 180, 0.15);
    backdrop-filter: blur(10px);
}

#timer-options {
    display: flex;
    gap: 10px;
}

.timer-btn {
    padding: 12px 22px;
    border: none;
    border-radius: 22px;
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
    color: #666;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Quicksand', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
}

.timer-btn.active {
    background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 154, 158, 0.4);
}

.timer-btn:hover:not(.active) {
    transform: scale(1.05);
    background: linear-gradient(135deg, #ffe4ec, #ffd1dc);
}

#capture-btn {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 5px solid white;
    background: linear-gradient(135deg, #ff69b4 0%, #ff1493 100%);
    cursor: pointer;
    font-size: 36px;
    box-shadow: 0 8px 30px rgba(255, 105, 180, 0.5);
    transition: all 0.3s ease;
    animation: capture-glow 2s infinite;
    position: relative;
    overflow: hidden;
}

#capture-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    animation: none;
}

@keyframes capture-glow {
    0%, 100% { box-shadow: 0 8px 30px rgba(255, 105, 180, 0.5); }
    50% { box-shadow: 0 8px 45px rgba(255, 105, 180, 0.8); }
}

#capture-btn:hover:not(:disabled) {
    transform: scale(1.1);
}

#capture-btn:active:not(:disabled) {
    transform: scale(0.95);
}

#capture-btn.capturing .heart-burst {
    animation: heart-burst 0.3s ease;
}

@keyframes heart-burst {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(2); opacity: 0.5; }
    100% { transform: scale(3); opacity: 0; }
}

#control-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

#control-buttons button {
    width: 55px;
    height: 55px;
    border-radius: 18px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 26px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

#control-buttons button:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

#control-buttons button.pet-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

#control-buttons button.pet-btn.active {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    animation: wiggle 0.5s ease;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-5deg); }
    75% { transform: rotate(5deg); }
}

.side-panel {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 24px;
    padding: 20px;
    box-shadow: 0 6px 30px rgba(255, 105, 180, 0.15);
}

.side-panel h3 {
    margin-bottom: 15px;
    color: #5a3d5c;
    text-align: center;
    font-family: 'Pacifico', cursive;
    font-size: 1.3rem;
}

.side-panel h4 {
    margin: 15px 0 10px;
    color: #8b5a8b;
    font-size: 0.95rem;
}

.hint-text {
    font-size: 12px;
    color: #999;
    text-align: center;
    margin-top: 12px;
}

.hidden {
    display: none !important;
}

#props-grid, #frames-grid, #filters-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.props-grid-small {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.pet-props-section {
    border-top: 2px dashed #ffd1dc;
    padding-top: 10px;
    margin-top: 10px;
}

.prop-item {
    font-size: 32px;
    text-align: center;
    padding: 12px;
    background: linear-gradient(135deg, #fff0f5, #ffe4ec);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.prop-item:hover {
    background: linear-gradient(135deg, #ffd1dc, #ffb6c1);
    transform: scale(1.15) rotate(5deg);
}

.frame-item, .filter-item {
    padding: 14px 10px;
    text-align: center;
    background: linear-gradient(135deg, #f8f8f8, #f0f0f0);
    border-radius: 14px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.25s ease;
}

.frame-item.active, .filter-item.active {
    background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 154, 158, 0.4);
}

.frame-item.featured, .filter-item.featured {
    border: 2px solid #ff69b4;
}

.frame-item:hover, .filter-item:hover {
    transform: scale(1.05);
}

.action-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Quicksand', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
    color: #666;
}

.action-btn.success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.action-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.action-btn.danger {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    color: white;
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

#gallery-panel {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 24px;
    padding: 20px;
}

#gallery-panel h3 {
    margin-bottom: 15px;
    color: #5a3d5c;
    text-align: center;
    font-family: 'Pacifico', cursive;
}

#gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.gallery-item {
    position: relative;
    aspect-ratio: 4/3;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(0,0,0,0.15);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.delete-photo, .favorite-photo {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 14px;
    opacity: 0;
    transition: all 0.3s ease;
}

.delete-photo {
    top: 5px;
    right: 5px;
    background: rgba(255, 255, 255, 0.95);
}

.favorite-photo {
    top: 5px;
    left: 5px;
    background: rgba(255, 255, 255, 0.95);
}

.favorite-photo.active {
    opacity: 1;
    background: #ff69b4;
}

.gallery-item:hover .delete-photo,
.gallery-item:hover .favorite-photo {
    opacity: 1;
}

.empty-gallery {
    text-align: center;
    color: #999;
    padding: 30px;
    font-style: italic;
}

#pose-suggestion {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.98);
    padding: 25px 45px;
    border-radius: 30px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ff69b4;
    box-shadow: 0 15px 50px rgba(255, 105, 180, 0.35);
    z-index: 1000;
    animation: bounce-in 0.5s ease;
}

#celebration {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #ff69b4 0%, #ff1493 100%);
    padding: 30px 50px;
    border-radius: 30px;
    z-index: 1000;
    animation: celebration-pop 0.6s ease;
}

.celebration-text {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

@keyframes celebration-pop {
    0% { transform: translate(-50%, -50%) scale(0); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

@keyframes bounce-in {
    0% { transform: translate(-50%, -50%) scale(0); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 28px;
    padding: 25px;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.error-content {
    text-align: center;
    padding: 35px;
}

.error-content h2 {
    margin-bottom: 18px;
    color: #5a3d5c;
    font-family: 'Pacifico', cursive;
}

.error-content p {
    margin-bottom: 22px;
    color: #666;
}

#modal-image {
    max-width: 100%;
    max-height: 55vh;
    border-radius: 18px;
    object-fit: contain;
    box-shadow: 0 6px 25px rgba(0,0,0,0.2);
}

.caption-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #ffd1dc;
    border-radius: 14px;
    font-size: 14px;
    font-family: 'Quicksand', sans-serif;
    outline: none;
    transition: border-color 0.3s;
}

.caption-input:focus {
    border-color: #ff69b4;
}

.modal-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.modal-actions button {
    flex: 1;
    min-width: 100px;
}

#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3000;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 12px;
    height: 12px;
    top: -20px;
    animation: confetti-fall linear forwards;
    border-radius: 2px;
}

.confetti-heart {
    position: absolute;
    top: -20px;
    font-size: 20px;
    animation: confetti-fall linear forwards;
}

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

footer {
    text-align: center;
    padding: 20px;
    color: #8b5a8b;
    font-size: 14px;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.footer-thanks {
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s;
}

footer:hover .footer-thanks {
    opacity: 1;
}

footer a {
    color: #ff69b4;
    text-decoration: none;
    font-weight: 600;
}

footer a:hover {
    text-decoration: underline;
}

.camera-error {
    color: white;
    text-align: center;
    padding: 50px;
}

.camera-error h2 {
    margin-bottom: 18px;
    font-family: 'Pacifico', cursive;
}

.camera-error .error-detail {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 12px;
}

.camera-error button {
    padding: 16px 35px;
    border: none;
    border-radius: 28px;
    background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
    color: white;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Quicksand', sans-serif;
    cursor: pointer;
    margin-top: 25px;
    transition: transform 0.3s;
}

.camera-error button:hover {
    transform: scale(1.05);
}

@media (max-width: 600px) {
    header h1 {
        font-size: 1.5rem;
    }
    
    .header-subtitle {
        font-size: 0.8rem;
    }
    
    #camera-container {
        aspect-ratio: 3/4;
        max-height: 55vh;
    }
    
    #capture-btn {
        width: 80px;
        height: 80px;
        font-size: 32px;
    }
    
    #control-buttons button {
        width: 50px;
        height: 50px;
        font-size: 22px;
    }
    
    .prop-item {
        font-size: 26px;
        padding: 10px;
    }
    
    #props-grid, #frames-grid, #filters-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
    
    .frame-item, .filter-item {
        font-size: 11px;
        padding: 12px 8px;
    }
    
    #pose-suggestion {
        font-size: 1.2rem;
        padding: 20px 30px;
    }
    
    .banner-content {
        font-size: 0.85rem;
    }
}

@media (min-width: 768px) {
    #app-container {
        padding: 20px;
    }
    
    #main-content {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    #camera-container {
        flex: 2;
        min-width: 60%;
        max-height: 70vh;
    }
    
    #controls {
        flex: 1;
        min-width: 220px;
        height: fit-content;
    }
    
    .side-panel {
        width: 100%;
    }
}