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

:root {
    --primary: #8B4513;
    --primary-dark: #5D2E0C;
    --primary-light: #D4A574;
    --secondary: #F5E6D3;
    --accent: #E74C3C;
    --text: #333;
    --text-light: #666;
    --bg: #FBF8F5;
    --white: #fff;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
}

/* Navbar */
.navbar {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 935px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.logo-icon {
    font-size: 1.8rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-link {
    color: var(--text);
    font-weight: 500;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.nav-link:hover {
    background: var(--secondary);
    color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: var(--white);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--primary);
}

.btn-secondary:hover {
    background: var(--primary-light);
}

.btn-block {
    width: 100%;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px;
}

.container {
    max-width: 935px;
    margin: 0 auto;
}

/* Feed */
.feed-header {
    text-align: center;
    margin-bottom: 32px;
}

.feed-header h1 {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.feed-header p {
    color: var(--text-light);
}

.latte-feed {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 600px;
    margin: 0 auto;
}

/* Latte Card */
.latte-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.latte-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
}

.latte-author {
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: var(--white);
    font-weight: 600;
}

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

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

.latte-date {
    color: var(--text-light);
    font-size: 0.85rem;
}

.latte-image {
    width: 100%;
    display: block;
}

.progressive-image {
    transition: opacity 0.2s ease-out;
}

.latte-actions {
    display: flex;
    gap: 16px;
    padding: 12px 16px;
}

.upvote-btn, .comment-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.upvote-btn:hover:not(:disabled) {
    background: #fee;
}

.upvote-btn.upvoted {
    color: var(--accent);
}

.upvote-btn.upvoted .upvote-icon {
    animation: heartbeat 0.3s ease;
}

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

.upvote-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.latte-caption {
    padding: 0 16px 12px;
    font-size: 0.95rem;
}

.view-comments {
    display: block;
    padding: 0 16px 12px;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 200px);
}

.auth-card {
    background: var(--white);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 16px;
}

.auth-header h1 {
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-light);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-weight: 500;
    color: var(--text);
}

.form-group input,
.form-group textarea {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.field-errors .error {
    color: var(--accent);
    font-size: 0.85rem;
}

.help-text {
    color: var(--text-light);
    font-size: 0.8rem;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #eee;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.alert-error {
    background: #fee;
    color: var(--accent);
    border: 1px solid #fcc;
}

/* Profile */
.profile-header {
    display: flex;
    gap: 32px;
    align-items: center;
    padding: 32px 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 32px;
}

.profile-info h1 {
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.bio {
    color: var(--text-light);
    margin-bottom: 12px;
}

.profile-stats {
    margin-bottom: 16px;
    color: var(--text-light);
}

.latte-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.latte-grid-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: var(--radius-sm);
}

.latte-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.latte-grid-item:hover img {
    transform: scale(1.05);
}

.latte-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: white;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s;
}

.latte-grid-item:hover .latte-overlay {
    opacity: 1;
}

/* Form Container */
.form-container {
    max-width: 500px;
    margin: 0 auto;
    background: var(--white);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-container h1 {
    margin-bottom: 8px;
}

.form-subtitle {
    color: var(--text-light);
    margin-bottom: 24px;
}

.current-photo {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* Image Upload */
.image-upload {
    position: relative;
}

.image-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-preview {
    border: 2px dashed #ccc;
    border-radius: var(--radius-sm);
    padding: 40px;
    text-align: center;
    color: var(--text-light);
    transition: all 0.2s;
}

.upload-preview:hover {
    border-color: var(--primary);
    background: var(--secondary);
}

.upload-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 8px;
}

.upload-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-sm);
}

/* Comments */
.comments-section {
    margin-top: 24px;
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.comments-section h3 {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.comment-form {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.comment-form input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius-sm);
    font-size: 1rem;
}

.comment-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.comment:last-child {
    border-bottom: none;
}

.comment-author {
    color: var(--text);
    margin-right: 8px;
}

.comment-text {
    color: var(--text);
}

.comment-date {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 4px;
}

.login-prompt {
    padding: 16px;
    background: var(--secondary);
    border-radius: var(--radius-sm);
    text-align: center;
}

.no-comments {
    text-align: center;
    color: var(--text-light);
    padding: 20px;
}

/* Latte Detail */
.latte-detail {
    max-width: 600px;
    margin: 0 auto;
}

.latte-card.large .latte-image {
    max-height: 600px;
    object-fit: contain;
    background: #f0f0f0;
}

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

.empty-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.empty-state h2 {
    margin-bottom: 8px;
    color: var(--primary);
}

.empty-state p {
    color: var(--text-light);
    margin-bottom: 24px;
}

/* Footer */
.footer {
    background: var(--white);
    text-align: center;
    padding: 20px;
    color: var(--text-light);
    margin-top: auto;
}

/* Messages */
.messages {
    max-width: 600px;
    margin: 0 auto 20px;
}

.message {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.message.success {
    background: #d4edda;
    color: #155724;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
}

/* Delete button */
.latte-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.delete-form {
    display: inline;
}

.btn-delete {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    opacity: 0.6;
    transition: all 0.2s;
}

.btn-delete:hover {
    opacity: 1;
    background: #fee;
}

/* Upload options */
.upload-options {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.upload-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
}

.option-icon {
    font-size: 1.3rem;
}

/* Infinite Scroll */
.scroll-sentinel {
    display: flex;
    justify-content: center;
    padding: 40px 20px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--secondary);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.end-of-feed {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 12px;
    }

    .feed-header {
        padding: 16px 0;
    }

    .feed-header h1 {
        font-size: 1.5rem;
    }

    .feed-header p {
        font-size: 0.9rem;
    }

    .latte-feed {
        gap: 16px;
    }

    .latte-card {
        border-radius: 0;
        margin: 0 -12px;
    }

    .latte-header {
        padding: 12px;
    }

    .latte-actions {
        padding: 10px 12px;
    }

    .latte-caption {
        padding: 0 12px 12px;
    }

    .view-comments {
        padding: 0 12px 12px;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
        padding: 20px 0;
    }

    .profile-info h1 {
        font-size: 1.4rem;
    }

    .latte-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
    }

    .latte-grid-item {
        border-radius: 0;
    }

    .nav-container {
        padding: 10px 12px;
    }

    .logo-text {
        display: none;
    }

    .nav-links {
        gap: 8px;
    }

    .nav-link {
        font-size: 0.9rem;
        padding: 6px 8px;
    }

    .btn {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .auth-card {
        padding: 24px;
        margin: 20px;
    }

    .form-container {
        margin: 20px;
        padding: 20px;
    }

    .scroll-sentinel {
        padding: 30px 20px;
    }

    .end-of-feed {
        padding: 30px 20px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .latte-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2px;
    }

    .nav-links .nav-link:not(.btn):not(.notification-bell) {
        display: none;
    }

    .btn-primary {
        padding: 8px 10px;
    }

    .avatar {
        width: 28px;
        height: 28px;
    }

    .username {
        font-size: 0.85rem;
    }

    .upvote-btn, .comment-btn {
        font-size: 0.9rem;
    }
}

/* Touch-friendly buttons */
@media (pointer: coarse) {
    .upvote-btn, .comment-btn {
        min-height: 44px;
        min-width: 44px;
    }

    .nav-link, .btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* Feedback Center */
.feedback-container {
    max-width: 700px;
    margin: 0 auto;
}

.feedback-header {
    text-align: center;
    margin-bottom: 32px;
}

.feedback-header h1 {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.feedback-header p {
    color: var(--text-light);
}

.feedback-form-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 32px;
}

.feedback-form-section h2 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: var(--primary);
}

.feedback-form textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.2s;
}

.feedback-form textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.feedback-form .btn {
    margin-top: 12px;
}

.anonymous-note {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.feedback-list-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.feedback-list-section h2 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: var(--primary);
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.feedback-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.feedback-item {
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary-light);
}

.feedback-item.addressed {
    border-left-color: #27ae60;
    opacity: 0.8;
}

.feedback-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

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

.feedback-date {
    color: var(--text-light);
}

.feedback-status {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.feedback-status.pending {
    background: #fff3cd;
    color: #856404;
}

.feedback-status.addressed {
    background: #d4edda;
    color: #155724;
}

.feedback-content {
    color: var(--text);
    line-height: 1.6;
    white-space: pre-wrap;
}

.feedback-addressed-date {
    margin-top: 8px;
    font-size: 0.8rem;
    color: #27ae60;
    font-style: italic;
}

.no-feedback {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.feedback-btn {
    margin-top: 12px;
}

/* Responsive feedback */
@media (max-width: 768px) {
    .feedback-container {
        padding: 0 12px;
    }

    .feedback-form-section,
    .feedback-list-section {
        padding: 16px;
        border-radius: 0;
        margin-left: -12px;
        margin-right: -12px;
    }

    .feedback-header h1 {
        font-size: 1.5rem;
    }

    .feedback-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* Notification Bell */
.notification-bell {
    position: relative;
    font-size: 1.3rem;
    padding: 8px !important;
}

.bell-icon {
    display: inline-block;
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--accent);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Notifications Page */
.notifications-container {
    max-width: 600px;
    margin: 0 auto;
}

.notifications-header {
    margin-bottom: 24px;
}

.notifications-header h1 {
    font-size: 1.75rem;
    color: var(--primary);
}

.notifications-list {
    display: flex;
    flex-direction: column;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.notification-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid #f0f0f0;
    text-decoration: none;
    color: var(--text);
    transition: background 0.2s;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background: var(--secondary);
}

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

.notification-icon {
    font-size: 1.5rem;
    width: 40px;
    text-align: center;
    flex-shrink: 0;
}

.icon-heart {
    color: var(--accent);
}

.icon-comment {
    color: var(--primary);
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-text {
    font-size: 0.95rem;
    line-height: 1.4;
}

.notification-text strong {
    color: var(--primary);
}

.notification-time {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 4px;
}

.notification-thumbnail {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}

.notification-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-notifications {
    text-align: center;
    padding: 60px 20px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.no-notifications .empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-notifications p {
    color: var(--text);
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.no-notifications .subtext {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Responsive notifications */
@media (max-width: 768px) {
    .notifications-container {
        padding: 0;
    }

    .notifications-header {
        padding: 0 12px;
    }

    .notifications-list {
        border-radius: 0;
    }

    .notification-item {
        padding: 12px;
    }

    .notification-thumbnail {
        width: 40px;
        height: 40px;
    }
}
