/* Homer Patuach - Collections Stylesheet */

/* --- Modal Overlay --- */
#hpc-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

#hpc-modal-overlay.hpc-modal-hidden {
    display: none;
}

/* --- Modal Container --- */
#hpc-modal-container {
    background: white;
    width: 90%;
    max-width: 400px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
}

#hpc-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ebee;
}

#hpc-modal-header h2 {
    margin: 0;
    font-size: 18px;
}

#hpc-close-modal-button {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0 5px;
    color: #888;
}

#hpc-modal-content {
    padding: 20px;
}

/* --- Button --- */
.hpc-button-container {
    padding: 40px 0 20px;
    text-align: center;
    border-top: 1px solid #e9ebee;
    margin-top: 40px;
}

.hpc-button {
    background: linear-gradient(135deg, #FB8255, #FB6965);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.hpc-button:hover {
    transform: translateY(-2px);
}

/* --- Collections List in Modal --- */
.hpc-collections-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #e9ebee;
    border-radius: 4px;
}

.hpc-collections-list li {
    margin: 0;
    padding: 0;
}

.hpc-collections-list li:not(:last-child) {
    border-bottom: 1px solid #e9ebee;
}

.hpc-collection-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 15px;
    background: none;
    border: none;
    text-align: right;
    cursor: pointer;
    font-size: 15px;
    color: #333;
    transition: background-color 0.15s ease;
}

.hpc-collection-toggle:hover {
    background-color: #f9f9f9;
}

.hpc-collection-toggle:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.hpc-toggle-icon {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    font-weight: bold;
    color: #7699f2; /* Blue */
    margin-left: 10px;
    border: 1px solid #e9ebee;
    border-radius: 50%;
    transition: all 0.2s ease;
}

li.hpc-checked .hpc-toggle-icon {
    background-color: #7699f2; /* Blue */
    color: white;
    border-color: #7699f2;
}

.hpc-collection-name {
    flex-grow: 1;
}

.hpc-no-collections-message {
    padding: 15px;
    text-align: center;
    color: #666;
}

/* --- New Collection Form --- */
#hpc-new-collection-form {
    margin-top: 20px;
    display: flex;
}

#hpc-new-collection-name {
    flex-grow: 1;
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 4px 0 0 4px;
    border-right: none;
}

#hpc-new-collection-name:focus {
    outline: none;
    border-color: #7699f2;
}


#hpc-create-collection-button {
    border: 1px solid #7699f2;
    background-color: #7699f2;
    color: white;
    padding: 0 20px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-weight: 500;
}

/* --- Post Collections List (Single Post Page) --- */
.hpc-post-collections-list {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e9ebee;
}

.hpc-post-collections-list h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1em;
    font-weight: 600;
    color: #555;
}

.hpc-post-collections-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hpc-post-collections-list li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.hpc-post-collections-list li a:hover {
    background-color: #e4e6e9;
    color: #000;
}

.hpc-post-collection-count {
    background-color: rgba(0,0,0,0.05);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}

/* Collection Archive Title */
.hpc-archive-main-title {
    display: block;
    margin-bottom: 5px;
}

.hpc-archive-creator {
    display: block;
    font-size: 0.8em;
    font-weight: 400;
    color: #555;
}


/* BuddyPress Collections Tab Content */
.hpc-collections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.hpc-collection-item {
    background: #fff;
    border: 1px solid #e9ebee;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hpc-collection-item:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.12);
}

.hpc-collection-item h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.25em;
    font-weight: 600;
}

.hpc-collection-item-main {
    flex-grow: 1;
}

.hpc-collection-item h3 a {
    color: #333;
    text-decoration: none;
}

.hpc-collection-item h3 a:hover {
    color: #FB8255; /* Use theme color */
}

.hpc-collection-posts-preview {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.hpc-collection-posts-preview a {
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 4px;
    border: 1px solid #eee;
}

.hpc-collection-posts-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease-in-out;
}

.hpc-collection-posts-preview a:hover img {
    transform: scale(1.05);
}

.hpc-empty-collection-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px; /* Ensure it has some height */
    background-color: #f9f9f9;
    border-radius: 4px;
    margin-top: 15px;
}

.hpc-empty-collection-message {
    margin: 0;
    padding: 20px;
    text-align: center;
    color: #777;
    font-size: 14px;
}

.hpc-view-all-link {
    display: block;
    margin-top: 15px;
    font-size: 14px;
    text-decoration: none;
    font-weight: 500;
    color: #7699f2; /* Use theme color */
}
.hpc-view-all-link:hover {
    text-decoration: underline;
}

.hpc-collection-item-footer {
    border-top: 1px solid #e9ebee;
    margin-top: 20px;
    padding-top: 15px;
}

/* --- Add Post to Collection UI (Profile Page) --- */
.hpc-add-post-to-collection-ui {
    margin-top: 0; /* Reset margin */
    padding-top: 15px;
    border-top: 1px solid #f0f2f5;
}

.hpc-open-search-button {
    background-color: #f0f2f5;
    border: 1px dashed #ccc;
    color: #555;
    padding: 10px;
    width: 100%;
    text-align: center;
    cursor: pointer;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.hpc-open-search-button:hover {
    background-color: #e4e6e9;
}

.hpc-search-area {
    margin-top: 15px;
}

.hpc-post-search-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.hpc-search-results {
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
}

.hpc-search-results ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hpc-search-results li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
}

.hpc-search-results li:not(:last-child) {
    border-bottom: 1px solid #f0f2f5;
}

.hpc-search-result-title {
    color: #333;
    font-size: 14px;
}

.hpc-add-searched-post-button {
    background-color: #7699f2;
    color: white;
    border: none;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
}

.hpc-add-searched-post-button:disabled {
    background-color: #a9a9a9;
    cursor: not-allowed;
}

.hpc-add-searched-post-button.is-added {
    background-color: #4CAF50; /* Green */
} 

.hpc-search-results .result-item.in-collection {
    opacity: 0.6;
    pointer-events: none;
    background-color: #f0f0f0;
}


/*--------------------------------------------------------------
5.0 - Post Collections List (Single Post Page)
--------------------------------------------------------------*/
.hpc-post-collections-list-container {
    border-top: 1px solid #eee;
    padding-top: 20px;
    margin-top: 30px;
}

.hpc-post-collections-list-container h3 {
    font-size: 1.2em;
    margin-bottom: 15px;
}

.hpc-post-collections-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hpc-post-collections-list li a {
    display: block;
    padding: 8px 15px;
    background-color: #f5f5f5;
    border-radius: 20px;
    text-decoration: none;
    color: #333;
    font-size: 0.9em;
    transition: background-color 0.2s;
}

.hpc-post-collections-list li a:hover {
    background-color: #e0e0e0;
}

.hpc-post-collections-list .collection-count {
    color: #777;
    margin-right: 5px;
} 

/*--------------------------------------------------------------
6.0 - Archive Title
--------------------------------------------------------------*/
/* Using highly specific selectors to override theme styles */
body.tax-collection .page-header .page-title {
    display: block !important;
    text-align: center;
    line-height: 1.2;
}

body.tax-collection .page-header .page-title > .hpc-archive-main-title,
body.tax-collection .page-header .page-title > .hpc-archive-creator {
    display: block;
    width: 100%;
}

.hpc-archive-main-title {
    font-size: 2.2rem !important; /* Larger font size */
    font-weight: bold;
}

.hpc-archive-creator {
    font-size: 1.1rem !important; /* Smaller font size */
    font-weight: normal;
    margin-top: 10px;
    color: #666;
}

.hpc-archive-creator a {
    text-decoration: none;
    color: inherit;
}

.hpc-archive-creator a:hover {
    text-decoration: underline;
} 

/* 
  Override theme styles for the collection archive title.
  Using a more specific selector to ensure these rules apply.
*/
body.tax-collection .page-header h1.page-title {
    line-height: 1.3;
}

body.tax-collection .page-header h1.page-title .hpc-archive-title-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hpc-archive-title-wrapper .hpc-archive-main-title {
    margin: 0 0 5px 0 !important; /* Add space below the main title */
    padding: 0;
    font-size: 2rem !important;
}

.hpc-archive-title-wrapper .hpc-archive-creator {
    font-size: 1rem !important;
} 

.hpc-collection-description-editor {
    padding: 15px;
    background-color: #f9f9f9;
    border-top: 1px solid #eee;
}

.hpc-collection-description-input {
    width: 100%;
    min-height: 80px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    display: block;
    resize: vertical;
    box-sizing: border-box; /* Important for padding and border */
}

.hpc-save-description-button {
    background-color: #0073aa;
    color: #fff;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.hpc-save-description-button:hover {
    background-color: #005a87;
}

.hpc-save-success-msg {
    color: #0073aa;
    margin-right: 10px;
    font-weight: bold;
} 