/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
.header {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 24px;
    font-weight: 700;
    color: #e60023;
    text-decoration: none;
}

.logo i {
    margin-right: 8px;
    font-size: 28px;
}

.search-bar {
    flex: 1;
    max-width: 400px;
    margin: 0 40px;
}

.search-input-container {
    position: relative;
    background: #f0f0f0;
    border-radius: 25px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
}

.search-input-container i {
    color: #666;
    margin-right: 10px;
}

.search-input-container input {
    border: none;
    background: none;
    outline: none;
    flex: 1;
    font-size: 16px;
}

.nav-menu {
    display: flex;
    gap: 20px;
}

.nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #666;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    background: #f0f0f0;
    color: #e60023;
}

.nav-link i {
    font-size: 20px;
    margin-bottom: 4px;
}

.nav-link span {
    font-size: 12px;
    font-weight: 500;
}

.user-menu {
    position: relative;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid #e60023;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 8px 0;
    min-width: 150px;
    display: none;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    transition: background 0.3s ease;
}

.dropdown-item:hover {
    background: #f0f0f0;
}

/* Main Content */
.main-content {
    margin-top: 80px;
    min-height: calc(100vh - 80px);
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    padding: 40px 0 20px;
    text-align: center;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #333;
}

.filter-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-tab {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    background: #fff;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.filter-tab:hover,
.filter-tab.active {
    background: #e60023;
    color: #fff;
    border-color: #e60023;
}

/* Masonry Layout */
.masonry-container {
    column-count: 4;
    column-gap: 20px;
    padding: 20px 0;
}

.masonry-item {
    break-inside: avoid;
    margin-bottom: 20px;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.masonry-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.pin-image {
    width: 100%;
    height: auto;
    display: block;
}

.pin-content {
    padding: 16px;
}

.pin-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    line-height: 1.4;
}

.pin-description {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.4;
}

.pin-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pin-stats {
    display: flex;
    gap: 16px;
}

.pin-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #666;
    font-size: 14px;
}

.pin-stat i {
    font-size: 16px;
}

.pin-actions-buttons {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 20px;
    background: #f0f0f0;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.action-btn:hover {
    background: #e60023;
    color: #fff;
}

.action-btn.liked {
    background: #e60023;
    color: #fff;
}

.action-btn.saved {
    background: #e60023;
    color: #fff;
}

/* Create Pin Form */
.create-pin-form {
    max-width: 600px;
    margin: 40px auto;
    background: #fff;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.create-pin-form h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #e60023;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.image-upload-area {
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.image-upload-area:hover {
    border-color: #e60023;
    background: #fafafa;
}

.image-upload-area i {
    font-size: 48px;
    color: #e0e0e0;
    margin-bottom: 16px;
}

.image-upload-area p {
    color: #666;
    font-size: 16px;
}

.image-upload-area input {
    display: none;
}

.image-preview {
    margin-top: 16px;
    display: none;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
}

.form-actions {
    display: flex;
    gap: 16px;
    justify-content: flex-end;
    margin-top: 32px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #e60023;
    color: #fff;
}

.btn-primary:hover {
    background: #d5001f;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #f0f0f0;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

/* Profile Page */
.profile-header {
    display: flex;
    align-items: center;
    gap: 40px;
    padding: 40px 0;
    background: #fff;
    border-radius: 16px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.profile-avatar {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid #e60023;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.edit-avatar-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e60023;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-info h2 {
    font-size: 32px;
    margin-bottom: 8px;
    color: #333;
}

.profile-info p {
    color: #666;
    margin-bottom: 20px;
    font-size: 16px;
}

.profile-stats {
    display: flex;
    gap: 40px;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #e60023;
}

.stat-label {
    font-size: 14px;
    color: #666;
}

.profile-tabs {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    background: #fff;
    padding: 0 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.profile-tab {
    padding: 16px 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.profile-tab:hover,
.profile-tab.active {
    color: #e60023;
    border-bottom-color: #e60023;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.boards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.board-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.board-card:hover {
    transform: translateY(-4px);
}

.board-cover {
    height: 120px;
    background: linear-gradient(45deg, #e60023, #ff6b6b);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 48px;
}

.board-info {
    padding: 16px;
}

.board-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.board-pin-count {
    color: #666;
    font-size: 14px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 16px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.close-btn:hover {
    background: #f0f0f0;
}

.modal-body {
    padding: 20px;
}

.pin-image-container {
    text-align: center;
    margin-bottom: 20px;
}

.pin-image-container img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
}

.pin-details {
    text-align: center;
}

.pin-details p {
    margin-bottom: 20px;
    color: #666;
    line-height: 1.6;
}

.pin-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
}

/* Loading Spinner */
.loading-spinner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    z-index: 3000;
    align-items: center;
    justify-content: center;
}

.loading-spinner.show {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #e60023;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.load-more-container {
    text-align: center;
    padding: 40px 0;
}

.load-more-btn {
    padding: 12px 32px;
    background: #e60023;
    color: #fff;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.load-more-btn:hover {
    background: #d5001f;
    transform: translateY(-2px);
}

.load-more-btn i {
    margin-right: 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
        gap: 16px;
    }
    
    .search-bar {
        order: 3;
        flex-basis: 100%;
        margin: 0;
    }
    
    .nav-menu {
        gap: 12px;
    }
    
    .nav-link span {
        display: none;
    }
    
    .masonry-container {
        column-count: 2;
        column-gap: 16px;
    }
    
    .profile-header {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .profile-stats {
        justify-content: center;
    }
    
    .boards-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .create-pin-form {
        margin: 20px;
        padding: 20px;
    }
    
    .form-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .masonry-container {
        column-count: 1;
    }
    
    .container {
        padding: 0 16px;
    }
    
    .page-header h1 {
        font-size: 24px;
    }
    
    .filter-tabs {
        gap: 8px;
    }
    
    .filter-tab {
        padding: 6px 12px;
        font-size: 14px;
    }
}
