/* Base Styling */
:root {
    --bg-color: #faf7f5;
    --text-color: #2c2825;
    --primary-color: #dcb6a8;
    --primary-dark: #b89184;
    --card-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    background-image: 
        radial-gradient(at 0% 0%, rgba(220, 182, 168, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(200, 210, 225, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
}

h1, h2, h3 {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
}

/* Glassmorphism Utilities */
.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}

/* --- Login Page --- */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    padding: 3rem 4rem;
    border-radius: 24px;
    text-align: center;
    max-width: 450px;
    width: 100%;
    animation: fadeIn 0.8s ease-out;
}

.login-card h1 {
    font-size: 2.5rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.login-card .subtitle {
    font-size: 1rem;
    color: #666;
    margin-bottom: 2rem;
}

.error-message {
    color: #c95c5c;
    background: rgba(201, 92, 92, 0.1);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.input-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #555;
}

.input-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.8);
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(220, 182, 168, 0.2);
}

.btn {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 182, 168, 0.4);
}

/* --- Gallery Page --- */
.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 5%;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-content h1 {
    font-size: 2rem;
    margin-bottom: 0.2rem;
}

.header-content p {
    font-size: 0.95rem;
    color: #666;
}

.logout-btn {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    padding: 8px 16px;
    border: 1px solid #ccc;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: #fff;
    border-color: var(--text-color);
}

.gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 5%;
}

.folder-section {
    margin-bottom: 4rem;
    animation: fadeIn 0.8s ease-out;
}

.folder-title {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
    display: inline-block;
    color: var(--text-color);
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.photo-card {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1 / 1;
    background: #eee;
    box-shadow: var(--shadow);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.4s ease;
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.photo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.photo-overlay span {
    color: white;
    font-weight: 600;
    font-size: 1.2rem;
    padding: 10px 20px;
    border: 2px solid white;
    border-radius: 30px;
    transform: translateY(20px);
    transition: transform 0.4s ease;
}

.photo-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.photo-card:hover img {
    transform: scale(1.05);
}

.photo-card:hover .photo-overlay {
    opacity: 1;
}

.photo-card:hover .photo-overlay span {
    transform: translateY(0);
}

.empty-state {
    text-align: center;
    padding: 5rem 0;
    color: #666;
    font-size: 1.2rem;
}

/* --- Lightbox --- */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    display: flex;
    opacity: 1;
}

.lightbox-content-wrapper {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-content {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.close-lightbox {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: 300;
    cursor: pointer;
    transition: color 0.3s ease;
    z-index: 1001;
}

.close-lightbox:hover {
    color: var(--primary-color);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Album List View --- */
.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
    animation: fadeIn 0.8s ease-out;
}

.album-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.4s ease;
    position: relative;
    z-index: 1;
}

.album-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

.album-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    padding: 8px 8px 0 8px;
    background: #fff;
    border-radius: 12px 12px 0 0;
}

.album-cover::before,
.album-cover::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 0;
    background: #fff;
    border: 1px solid #eee;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    z-index: -1;
    transition: transform 0.4s ease;
}

.album-cover::before {
    transform: rotate(-3deg);
}

.album-cover::after {
    transform: rotate(3deg);
}

.album-card:hover .album-cover::before {
    transform: rotate(-5deg) translate(-2px, 2px);
}

.album-card:hover .album-cover::after {
    transform: rotate(5deg) translate(2px, 2px);
}

.album-cover-img-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    border-radius: 4px 4px 0 0;
}

.album-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s ease;
}

.album-card:hover .album-cover img {
    transform: scale(1.08);
}

.album-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 16px 12px;
    text-align: center;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 0 0 12px 12px;
    position: relative;
}

.album-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    opacity: 0.5;
}

.album-info h3 {
    font-size: 1.2rem;
    color: var(--text-color);
    margin-bottom: 4px;
    font-family: 'Playfair Display', serif;
}

.album-info p {
    font-size: 0.85rem;
    color: #888;
}

.back-btn {
    display: inline-block;
    padding: 8px 16px;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    border: 1px solid var(--primary-color);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: var(--primary-color);
    color: #fff;
}

/* --- Chat Styling --- */
.chat-wrapper {
    max-width: 800px;
    margin: 0 auto;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 600px; /* fixed height for scrollable chat */
    animation: fadeIn 0.8s ease-out;
}

.chat-header {
    background: var(--primary-color);
    color: #fff;
    padding: 15px 20px;
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-message {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    align-self: flex-start;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.chat-message.self {
    align-self: flex-end;
    background: rgba(220, 182, 168, 0.4);
    border-bottom-right-radius: 4px;
}

.chat-message:not(.self) {
    border-bottom-left-radius: 4px;
}

.chat-meta {
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.chat-author {
    font-weight: 600;
    color: var(--text-color);
}

.chat-text {
    font-size: 0.95rem;
    line-height: 1.4;
    word-break: break-word;
}

.chat-input-area {
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.8);
    border-top: 1px solid var(--glass-border);
}

.chat-form {
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.chat-input:focus {
    border-color: var(--primary-color);
}

.chat-submit {
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 0 20px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.chat-submit:hover {
    background: var(--primary-dark);
}

/* Responsive */
@media (max-width: 768px) {
    .login-card {
        padding: 2rem;
    }
    .gallery-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    .folder-title {
        font-size: 1.5rem;
    }
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    .album-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    .album-info {
        padding: 10px 8px;
    }
    .album-info h3 {
        font-size: 1rem;
    }
    .album-info p {
        font-size: 0.75rem;
    }
    .chat-wrapper {
        height: 500px;
    }
    .chat-message {
        max-width: 90%;
    }
}
