/**
 * Chapter Submission Modal Styles
 */

.hs-chapters-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.hs-chapters-modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.hs-chapters-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.hs-chapters-modal-close:hover {
    color: #333;
}

.hs-chapters-modal-content h2 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
}

.hs-chapters-modal-content p {
    color: #666;
    margin-bottom: 20px;
}

#hs-chapters-list {
    margin-bottom: 20px;
}

.hs-chapter-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: flex-end;
    animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hs-chapter-number-wrapper {
    flex: 0 0 80px;
}

.hs-chapter-title-wrapper {
    flex: 1;
}

.hs-chapter-row label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9em;
    color: #555;
}

.hs-chapter-row input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.hs-chapter-row input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.hs-chapter-row input.hs-error {
    border-color: #dc3545;
}

.hs-remove-chapter {
    background: #dc3545;
    color: #fff;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.hs-remove-chapter:hover {
    background: #c82333;
}

#hs-add-chapter-row {
    width: 100%;
    margin-bottom: 20px;
}

.hs-chapters-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.hs-button-primary,
.hs-button-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.hs-button-primary {
    background: #0073aa;
    color: #fff;
    flex: 1;
}

.hs-button-primary:hover:not(:disabled) {
    background: #005a87;
}

.hs-button-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.hs-button-secondary {
    background: #f1f1f1;
    color: #333;
}

.hs-button-secondary:hover {
    background: #e0e0e0;
}

#hs-chapters-message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 4px;
    display: none;
}

.hs-success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.hs-error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/**
 * Contributions Section
 */
.hs-contributions-section {
    margin-top: 30px;
    padding: 20px;
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
}

.hs-contributions-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.hs-contribution-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.hs-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.hs-submit-btn:hover {
    background: #005a87;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.hs-submit-btn .pts {
    margin-left: 8px;
    background: rgba(255,255,255,0.2);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.85em;
}

.hs-pending-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    padding: 12px;
    border-radius: 4px;
    color: #856404;
    font-weight: 600;
}

/**
 * Collapsible Chapters Display
 */
.hs-book-chapters {
    margin-top: 30px;
    padding: 20px;
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
}

.hs-book-chapters h2 {
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hs-book-chapters h2:hover {
    color: #0073aa;
}

.hs-chapters-toggle {
    font-size: 0.8em;
    color: #666;
    transition: transform 0.3s;
}

.hs-chapters-toggle.collapsed {
    transform: rotate(-90deg);
}

.hs-chapters-content {
    max-height: 500px;
    overflow-y: auto;
    transition: all 0.3s ease-out;
}

.hs-chapters-content.collapsed {
    max-height: 0;
    overflow: hidden;
}

.hs-chapters-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hs-chapter-item {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    gap: 10px;
}

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

.hs-chapter-number {
    font-weight: bold;
    color: #0073aa;
    min-width: 90px;
}

.hs-chapter-title {
    flex: 1;
    color: #333;
}

.hs-chapters-pending-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-left: 4px solid #ffc107;
    padding: 12px 15px;
    margin-top: 10px;
    border-radius: 4px;
    color: #856404;
}

.hs-chapters-empty {
    color: #666;
    font-style: italic;
    padding: 20px 0;
}

/**
 * New Contribution Modals Styles
 */
.hs-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.hs-modal-content.summary-modal {
    max-width: 700px;
}

.char-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.char-row input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.char-row .char-name {
    flex: 2;
}

.add-character-btn {
    width: 100%;
    padding: 10px;
    background: #f0f0f0;
    border: 1px dashed #ccc;
    border-radius: 4px;
    cursor: pointer;
    margin: 10px 0;
}

.add-character-btn:hover {
    background: #e8e8e8;
}

.tags-input-wrapper {
    margin: 15px 0;
}

#tag-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
}

#tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
    min-height: 50px;
}

.tag-pill {
    background: #0073aa;
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tag-pill .remove-tag {
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
}

.tag-pill .remove-tag:hover {
    color: #ffc;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.85em;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-primary,
.btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-primary {
    background: #0073aa;
    color: #fff;
    flex: 1;
}

.btn-primary:hover:not(:disabled) {
    background: #005a87;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background: #f1f1f1;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.modal-message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 4px;
    display: none;
}

.modal-message.success-msg {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.modal-message.error-msg {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.remove-row {
    background: #dc3545;
    color: #fff;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    flex-shrink: 0;
}

.remove-row:hover {
    background: #c82333;
}

/**
 * Book Tags Display
 */
.hs-book-tags-section {
    margin-top: 30px;
    padding: 20px;
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
}

.hs-book-tags-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.hs-book-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.hs-book-tag {
    display: inline-block;
    background: #0073aa;
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.hs-book-tag:hover {
    background: #005a87;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

/* Responsive styles */
@media (max-width: 600px) {
    .hs-chapters-modal-content {
        padding: 20px;
        max-height: 90vh;
    }

    .hs-chapter-row {
        flex-direction: column;
        gap: 5px;
    }

    .hs-chapter-number-wrapper {
        flex: 1;
    }

    .hs-remove-chapter {
        align-self: flex-end;
    }

    .hs-chapters-actions {
        flex-direction: column;
    }

    .hs-chapter-item {
        flex-direction: column;
        gap: 5px;
    }

    .hs-chapter-number {
        min-width: auto;
    }

    .hs-contribution-buttons {
        grid-template-columns: 1fr;
    }

    .char-row {
        flex-direction: column;
    }

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