/* Locket-Style CSS */
:root {
    --primary-color: #ff6b6b;
    --secondary-color: #5f9ea0;
    --background-color: #fff5f5;
    --text-color: #333;
    --accent-color: #ffd166;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --pink-50: #fdf2f8;
    --pink-100: #fce7f3;
    --pink-200: #fbcfe8;
    --pink-300: #f9a8d4;
    --pink-400: #f472b6;
    --pink-500: #ec4899;
    --pink-600: #db2777;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Locket-style Header */
.locket-header {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid white;
    object-fit: cover;
}

.user-name {
    color: white;
    font-weight: 500;
}

/* Locket-style Grid */
.locket-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    padding: 2rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .locket-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 0.75rem;
        padding: 1rem 0.75rem;
    }
}

@media (max-width: 640px) {
    .locket-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 1rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .locket-grid {
        padding: 0.75rem 0.25rem;
        gap: 0.5rem;
    }
}

/* Locket-style Post Card */
.locket-post {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.locket-post:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.locket-post:active {
    transform: translateY(-2px);
    transition: transform 0.1s ease;
}

@media (max-width: 640px) {
    .locket-post {
        border-radius: 15px;
    }

    .locket-post:hover {
        transform: none;
    }

    .locket-post:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

.locket-post-header {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--gray-100);
}

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

.post-user-info {
    flex: 1;
}

.post-username {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-800);
}

.post-timestamp {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.locket-post-media {
    position: relative;
    aspect-ratio: 4/5;
    overflow: hidden;
}

.locket-post-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.locket-post:hover .locket-post-image {
    transform: scale(1.05);
}

.locket-post-content {
    padding: 1rem;
}

.post-caption {
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
    color: var(--gray-700);
}

.post-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
}

.post-reactions {
    display: flex;
    gap: 0.5rem;
}

.reaction-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    position: relative;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.reaction-btn:hover {
    transform: scale(1.1);
    background: var(--gray-50);
}

.reaction-btn:active {
    transform: scale(0.95);
    background: var(--gray-100);
}

.reaction-btn.active {
    animation: bounce 0.3s ease;
}

@media (max-width: 640px) {
    .reaction-btn {
        font-size: 1.1rem;
        padding: 0.4rem;
        min-width: 40px;
        min-height: 40px;
    }

    .reaction-btn:hover {
        transform: none;
    }
}

.reaction-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary-color);
    color: white;
    font-size: 0.625rem;
    padding: 0.125rem 0.25rem;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

.comments-count {
    font-size: 0.75rem;
    color: var(--gray-500);
    cursor: pointer;
}

.comments-count:hover {
    color: var(--primary-color);
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--pink-500));
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    z-index: 50;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-xl);
}

.fab:active {
    transform: scale(0.95);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 800px;
    max-height: 90vh;
    width: 90vw;
    overflow: hidden;
    transform: scale(0.8);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

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

.modal-header {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gray-50);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-500);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
}

.modal-image-section {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-900);
}

.modal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.modal-sidebar {
    width: 350px;
    background: white;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--gray-200);
}

.modal-post-header {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-post-content {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.modal-reactions {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.modal-comments {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    max-height: 300px;
}

.comment-item {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-100);
}

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

.comment-author {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-800);
    margin-bottom: 0.25rem;
}

.comment-text {
    font-size: 0.875rem;
    color: var(--gray-700);
    line-height: 1.4;
    margin-bottom: 0.25rem;
}

.comment-time {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.comment-form {
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.comment-input-group {
    display: flex;
    gap: 0.5rem;
}

.comment-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 20px;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s ease;
}

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

.comment-submit {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.comment-submit:hover {
    background: var(--pink-600);
    transform: scale(1.05);
}

.comment-submit:disabled {
    background: var(--gray-400);
    cursor: not-allowed;
    transform: none;
}

@media (max-width: 768px) {
    .modal-content {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-body {
        flex-direction: column;
    }

    .modal-image-section {
        height: 60vh;
    }

    .modal-sidebar {
        width: 100%;
        height: 40vh;
    }

    .modal-comments {
        max-height: 200px;
    }
}

/* Animations */
@keyframes bounce {
    0%, 20%, 60%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    80% {
        transform: translateY(-5px);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
}

/* Loading States */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--gray-200);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

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

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    color: var(--gray-800);
    padding: 1rem 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 1100;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    max-width: 300px;
    border-left: 4px solid var(--primary-color);
}

.toast.show {
    transform: translateX(0);
}

.toast.toast-success {
    border-left-color: #10b981;
}

.toast.toast-error {
    border-left-color: #ef4444;
}

.toast.toast-warning {
    border-left-color: #f59e0b;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.hidden { display: none !important; }
.visible { display: block !important; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }

.rounded { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-full { border-radius: 9999px; }

.shadow { box-shadow: var(--shadow); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

/* Camera Modal Styles */
.camera-modal-content {
    max-width: 800px;
    width: 95vw;
    max-height: 95vh;
}

.camera-modal-body {
    padding: 0;
}

.camera-tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: var(--gray-600);
    transition: all 0.2s ease;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    background: var(--pink-50);
}

.tab-content {
    display: none;
    padding: 1.5rem;
}

.tab-content.active {
    display: block;
}

.camera-container {
    position: relative;
    background: var(--gray-900);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
    aspect-ratio: 16/9;
}

#camera-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    padding: 2rem 1rem 1rem;
}

.camera-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.camera-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid white;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.camera-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.capture-btn {
    width: 80px;
    height: 80px;
    background: var(--primary-color);
    border-color: white;
}

.camera-btn.recording {
    background: #ef4444;
    animation: pulse 1s infinite;
}

.camera-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-primary:hover {
    background: var(--pink-600);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.drop-zone {
    border: 2px dashed var(--gray-300);
    border-radius: 10px;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary-color);
    background: var(--pink-50);
}

.drop-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.upload-preview {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.preview-section {
    border-top: 1px solid var(--gray-200);
    padding: 1.5rem;
}

.preview-media {
    text-align: center;
    margin-bottom: 1rem;
}

.preview-form textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 10px;
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
    margin-bottom: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Responsive Helpers */
@media (max-width: 640px) {
    .toast {
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100%);
    }

    .toast.show {
        transform: translateY(0);
    }

    .camera-modal-content {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }

    .camera-container {
        aspect-ratio: 4/3;
    }

    .camera-controls {
        gap: 0.5rem;
    }

    .camera-btn {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }

    .capture-btn {
        width: 70px;
        height: 70px;
    }
}

/* Time Widget */
.time-widget {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 0.5rem 1rem;
    backdrop-filter: blur(10px);
    margin-left: 1rem;
}

.time-widget-content {
    display: flex;
    gap: 1rem;
}

.city-time {
    text-align: center;
}

.city-info {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.25rem;
}

.city-emoji {
    font-size: 0.875rem;
}

.city-name {
    font-weight: 500;
}

.time-display {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    font-weight: bold;
    color: white;
}

/* Weather Widget */
.weather-widget {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 0.5rem 1rem;
    backdrop-filter: blur(10px);
    margin-left: 0.5rem;
}

.weather-content {
    display: flex;
    gap: 1rem;
}

.weather-city {
    text-align: center;
}

.weather-icon {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.weather-temp {
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
}

.weather-name {
    font-size: 0.625rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Backup Button */
.backup-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.875rem;
    margin: 0 1rem;
    transition: all 0.2s ease;
}

.backup-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Password Protection */
.password-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(10px);
}

.password-modal {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.password-header h2 {
    margin-bottom: 0.5rem;
    color: var(--gray-800);
}

.password-header p {
    color: var(--gray-600);
    margin-bottom: 2rem;
}

.password-form input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--gray-300);
    border-radius: 10px;
    font-size: 1rem;
    margin-bottom: 1rem;
    text-align: center;
}

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

.password-form button {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.password-form button:hover {
    background: var(--pink-600);
}

/* Mobile Responsive for Widgets */
@media (max-width: 768px) {
    .time-widget-content {
        gap: 0.5rem;
    }
    
    .city-info {
        font-size: 0.625rem;
    }
    
    .city-name {
        display: none; /* Chỉ hiển thị cờ trên mobile */
    }
    
    .time-display {
        font-size: 0.75rem;
    }
    
    .weather-widget {
        display: none;
    }

    .header-content {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
    }
}

@media (max-width: 640px) {
    .time-widget {
        margin-left: 0;
        margin-top: 0.5rem;
        order: 2;
        width: 100%;
        justify-content: center;
    }
    
    .time-widget-content {
        gap: 0.75rem;
    }
}

@media (max-width: 640px) {
    .password-modal {
        margin: 1rem;
        padding: 1.5rem;
    }

    .backup-btn {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
        margin: 0 0.5rem;
    }
}
