/* Memory Capsule Time Vault - Cosmic Glassmorphism Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, hsl(245, 40%, 15%) 0%, hsl(270, 50%, 20%) 50%, hsl(290, 40%, 25%) 100%);
    color: hsl(0, 0%, 98%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background */
.cosmic-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('src/assets/cosmic-background.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    z-index: -2;
}

.cosmic-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, 
        hsla(245, 15%, 8%, 0.8) 0%, 
        hsla(245, 15%, 8%, 0.6) 50%, 
        hsla(245, 15%, 8%, 0.8) 100%
    );
    z-index: -1;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.main-title {
    font-size: 3rem;
    font-weight: bold;
    background: linear-gradient(135deg, hsl(270, 70%, 60%) 0%, hsl(45, 90%, 70%) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.25rem;
    color: hsl(240, 10%, 65%);
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

/* Glass Morphism Components */
.glass-card {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid hsla(0, 0%, 100%, 0.2);
    border-radius: 1rem;
    background: hsla(245, 15%, 15%, 0.3);
    box-shadow: 0 8px 32px hsla(245, 50%, 10%, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    box-shadow: 0 12px 40px hsla(270, 70%, 30%, 0.3);
    transform: translateY(-2px);
}

.glass-button {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid hsla(0, 0%, 100%, 0.2);
    border-radius: 1rem;
    background: linear-gradient(145deg, hsla(0, 0%, 100%, 0.1) 0%, hsla(0, 0%, 100%, 0.05) 100%);
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    color: hsl(0, 0%, 98%);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    font-size: 1rem;
}

.glass-button:hover {
    background: linear-gradient(145deg, hsla(0, 0%, 100%, 0.15) 0%, hsla(0, 0%, 100%, 0.08) 100%);
    transform: translateY(-1px);
}

.create-btn {
    font-size: 1.125rem;
    padding: 1rem 2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.cosmic-glow {
    box-shadow: 0 0 50px hsla(270, 70%, 60%, 0.3);
}

/* Capsules Grid */
.main-content {
    margin-top: 2rem;
}

.capsules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    align-items: start; /* makes each card fit its own height */
}

.capsule-card {
    position: relative;
    overflow: hidden;
    padding: 1.5rem;
    height: auto; /* allow dynamic height */
    transition: all 0.3s ease; /* optional smooth expand */
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    padding: 3rem;
    text-align: center;
}

.empty-icon {
    font-size: 4rem;
    color: hsl(240, 10%, 65%);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: hsl(240, 10%, 65%);
    margin-bottom: 1.5rem;
}

.create-first-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Capsule Cards */
.capsule-card {
    position: relative;
    overflow: hidden;
    padding: 1.5rem;
}

.capsule-locked {
    background: linear-gradient(145deg, hsl(245, 30%, 18%) 0%, hsl(260, 40%, 12%) 100%);
}

.capsule-unlocked {
    background: hsla(245, 15%, 15%, 0.3);
    border-color: hsl(45, 90%, 70%);
    box-shadow: 0 0 30px hsla(45, 90%, 70%, 0.3);
}

.capsule-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    opacity: 0.3;
    border-radius: 0.75rem;
}

.capsule-background {
    opacity: 0;
    animation: fadeInBackground 1s ease forwards;
    background-size: cover;
    background-position: center;
    border-radius: 0.75rem; /* match card rounding */
}

@keyframes fadeInBackground {
    to {
        opacity: 1;
    }
}

.capsule-content {
    position: relative;
    z-index: 2;
}

.capsule-header {
    display: flex;
    justify-content: between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.capsule-title-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.capsule-title {
    font-size: 1.25rem;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.delete-btn {
    background: none;
    border: none;
    color: hsl(0, 84.2%, 60.2%);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: all 0.2s;
    font-size: 1rem;
}

.delete-btn:hover {
    background: hsla(0, 84.2%, 60.2%, 0.2);
}

/* Countdown */
.countdown-section {
    text-align: center;
    margin-top: 1rem;
}

.countdown-label {
    font-size: 0.875rem;
    color: hsl(240, 10%, 65%);
    margin-bottom: 0.5rem;
}

.countdown-grid {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1); /* subtle background */
    border-radius: 1rem;
    backdrop-filter: none; /* removes blur */
    box-shadow: 0 0 10px rgba(255,255,255,0.3);
}

.countdown-item {
    text-align: center;
    color: #fff;
}

.countdown-digit {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffdd57; /* bright yellow */
    text-shadow: 0 0 5px rgba(255, 221, 87, 0.8);
}

.countdown-unit {
    font-size: 0.75rem;
    color: #8be9fd; /* bright cyan */
    text-shadow: 0 0 4px rgba(139, 233, 253, 0.7);
}

.countdown-date {
    font-size: 0.875rem;
    color: hsl(240, 10%, 65%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

/* Status Messages */
.status-message {
    text-align: center;
    margin-bottom: 1rem;
    font-weight: 600;
    color: hsl(45, 90%, 70%);
}

.pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite alternate;
}

/* Content */
.capsule-description {
    margin-bottom: 1rem;
}

.description-text {
    color: hsl(240, 10%, 65%);
    font-size: 0.875rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.full-content {
    padding: 1rem;
    border-radius: 0.75rem;
    background: hsla(245, 15%, 8%, 0.1);
    margin-bottom: 1rem;
}

.full-content .description-text {
    color: hsl(0, 0%, 98%);
    -webkit-line-clamp: unset;
    display: block;
}

.content-image {
    width: 100%;
    height: auto; /* let height adjust */
    max-height: 400px; /* optional limit */
    object-fit: contain; /* keep ratio without cropping */
    border-radius: 0.5rem;
    margin-top: 0.75rem;
    display: block;
}

.content-meta {
    font-size: 0.75rem;
    color: hsl(240, 10%, 65%);
    margin-top: 0.75rem;
}

.image-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: hsl(240, 10%, 65%);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Action Button */
.action-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: hsla(0, 0%, 0%, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    padding: 1rem;
}

.modal.open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-title-group h2 {
    font-size: 1.5rem;
    font-weight: bold;
}

.close-btn {
    background: none;
    border: none;
    color: hsl(240, 10%, 65%);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s;
    font-size: 1.25rem;
}

.close-btn:hover {
    color: hsl(0, 0%, 98%);
}

/* Form */
.create-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.form-input,
.form-textarea {
    backdrop-filter: blur(20px);
    border: 1px solid hsla(0, 0%, 100%, 0.2);
    border-radius: 0.5rem;
    background: hsla(245, 15%, 15%, 0.3);
    padding: 0.75rem;
    color: hsl(0, 0%, 98%);
    font-size: 1rem;
    transition: all 0.3s;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: hsl(270, 70%, 60%);
    box-shadow: 0 0 0 2px hsla(270, 70%, 60%, 0.2);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

.form-group small {
    font-size: 0.75rem;
    color: hsl(240, 10%, 65%);
}

.image-preview {
    border: 1px solid hsla(0, 0%, 100%, 0.2);
    border-radius: 0.5rem;
    padding: 0.75rem;
    background: hsla(245, 15%, 15%, 0.3);
}

.image-preview.hidden {
    display: none;
}

.image-preview p {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.image-preview img {
    width: 100%;
    height: 8rem;
    object-fit: cover;
    border-radius: 0.5rem;
}

.image-error {
    font-size: 0.75rem;
    color: hsl(0, 84.2%, 60.2%);
    margin-top: 0.25rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 1rem;
}

.cancel-btn,
.submit-btn {
    flex: 1;
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Toast */
.toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: hsla(245, 15%, 15%, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid hsla(0, 0%, 100%, 0.2);
    border-radius: 0.75rem;
    padding: 1rem;
    box-shadow: 0 8px 32px hsla(245, 50%, 10%, 0.4);
    transform: translateX(120%);
    transition: transform 0.3s ease-in-out;
    z-index: 1001;
    max-width: 400px;
}

.toast.show {
    transform: translateX(0);
}

.toast-content {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.toast-icon {
    font-size: 1.25rem;
    color: hsl(45, 90%, 70%);
}

.toast-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.toast-description {
    font-size: 0.875rem;
    color: hsl(240, 10%, 65%);
    line-height: 1.4;
}

/* Animations */
@keyframes floating {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.floating {
    animation: floating 3s ease-in-out infinite;
    color: hsl(45, 90%, 70%);
    font-size: 2.5rem;
}

@keyframes pulse-glow {
    from {
        box-shadow: 0 0 20px hsla(270, 70%, 60%, 0.5);
    }
    to {
        box-shadow: 0 0 40px hsla(270, 70%, 60%, 0.8);
    }
}

@keyframes unlock-animation {
    0% {
        transform: scale(1) rotateY(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.05) rotateY(90deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(1) rotateY(180deg);
        opacity: 1;
    }
}

.unlock-flip {
    animation: unlock-animation 1s ease-in-out;
    transform-style: preserve-3d;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .main-title {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .capsules-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }

    .countdown-digit {
        font-size: 1.5rem;
    }

    .form-actions {
        flex-direction: column;
    }

    .toast {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .header-content {
        flex-direction: column;
        gap: 0.5rem;
    }

    .main-title {
        font-size: 1.75rem;
        text-align: center;
    }

    .create-btn {
        font-size: 1rem;
        padding: 0.875rem 1.5rem;
    }
}

.hidden {
    display: none !important;
}

.celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.5s ease-out;
}

.celebration-message {
    font-size: 2rem;
    font-weight: bold;
    color: white;
    text-align: center;
    animation: rainbow 3s linear infinite;
}

.hidden {
    display: none;
}

@keyframes rainbow {
    0% { color: red; }
    16% { color: orange; }
    33% { color: yellow; }
    50% { color: green; }
    66% { color: blue; }
    83% { color: indigo; }
    100% { color: violet; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.background-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* keeps correct aspect ratio */
    z-index: -2; /* behind overlay and content */
    pointer-events: none; /* clicks pass through */
}

.cosmic-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4); /* dark overlay for readability */
    z-index: -1;
}

.site-footer {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    z-index: 10;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 10px;
    border-radius: 6px;
    backdrop-filter: blur(5px);
}

#confirmDeleteBtn {
    background: hsla(0, 84%, 60%, 0.15);
}
#confirmDeleteBtn:hover {
    background: hsla(0, 84%, 60%, 0.3);
}

.gallery-container {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    scroll-snap-type: x mandatory;
}

.gallery-container::-webkit-scrollbar {
    height: 6px;
}

.gallery-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

.gallery-image {
    flex: 0 0 auto;
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 0.5rem;
    scroll-snap-align: start;
    transition: transform 0.2s ease;
}

.gallery-image:hover {
    transform: scale(1.05);
}

#lightboxModal.modal {
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

#lightboxModal.open {
    display: flex;
}

#lightboxImage {
    opacity: 0;
    transition: opacity 0.3s ease;
}
#lightboxImage.fade-in {
    opacity: 1;
}

#lightboxImage:hover {
    transform: scale(1.02);
}

.toast-action {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    cursor: pointer;
}
