/* ============================================================================
   SHARE MODAL STYLES
   ============================================================================ */

/* Header Icon Button (Create Share) */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.icon-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.375rem;
    background: #2d1587;
    border: 1px solid #fed8f3;
    color: #888ee6;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: #f0f2f5;
    border-color: #4e31ba;
}

.icon-btn:active {
    transform: scale(0.95);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex;
}

/* Modal Container */
.modal-container {
    background: white;
    border-radius: 0.5rem;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-2rem);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal Header */
.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e4e6eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: #050505;
}

.modal-close {
    width: 2rem;
    height: 2rem;
    border: none;
    background: none;
    font-size: 1.5rem;
    color: #65676b;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.modal-close:hover {
    background: #f0f2f5;
}

/* Modal Body */
.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* Form Groups */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #050505;
    margin-bottom: 0.5rem;
}

.required {
    color: #e41e3f;
}

.pulse-cost {
    color: #4e31ba;
    font-size: 0.75rem;
    font-weight: normal;
    margin-left: 0.5rem;
}

/* Form Inputs */
#shareForm .form-input,
#shareForm .form-select,
#shareForm .form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccd0d5;
    border-radius: 0.375rem;
    font-size: 0.9375rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
    background-color: #ffffff;
    color: #050505;
}

#shareForm .form-input:focus,
#shareForm .form-select:focus,
#shareForm .form-textarea:focus {
    outline: none;
    border-color: #4e31ba;
    box-shadow: 0 0 0 3px rgba(78, 49, 186, 0.1);
}

#shareForm .form-textarea {
    resize: vertical;
    min-height: 4rem;
}

/* Contenteditable styling */
#shareText[contenteditable="true"] {
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #1c1e21;
}

#shareText[contenteditable="true"]:empty:before {
    content: attr(data-placeholder);
    color: #65676b;
    pointer-events: none;
}

#shareText[contenteditable="true"]:focus:before {
    content: '';
}

/* Style pasted content */
#shareText p {
    margin: 0 0 0.75rem 0;
}

#shareText p:last-child {
    margin-bottom: 0;
}

#shareText h1,
#shareText h2,
#shareText h3,
#shareText h4,
#shareText h5,
#shareText h6 {
    margin: 1rem 0 0.5rem 0;
    font-weight: 600;
}

#shareText ul,
#shareText ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

#shareText li {
    margin: 0.25rem 0;
}

#shareText a {
    color: #4e31ba;
    text-decoration: underline;
}

#shareText strong,
#shareText b {
    font-weight: 600;
}

#shareText em,
#shareText i {
    font-style: italic;
}

#shareText code {
    background: #f0f2f5;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 0.875em;
}

#shareText pre {
    background: #f0f2f5;
    padding: 0.75rem;
    border-radius: 0.375rem;
    overflow-x: auto;
}

#shareText blockquote {
    border-left: 3px solid #ccd0d5;
    padding-left: 1rem;
    margin: 0.75rem 0;
    color: #65676b;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* Character Count */
.char-count {
    display: block;
    font-size: 0.75rem;
    color: #65676b;
    margin-top: 0.25rem;
    text-align: right;
}

/* Form Hint */
.form-hint {
    display: block;
    font-size: 0.75rem;
    color: #65676b;
    margin-top: 0.25rem;
}

/* Conditional Fields */
.conditional-fields {
    padding-top: 0.5rem;
}

/* Optional Fields Divider */
.optional-fields-divider {
    margin: 1.5rem 0 1rem 0;
    padding: 0.5rem 0;
    border-top: 1px solid #e4e6eb;
    border-bottom: 1px solid #e4e6eb;
    text-align: center;
}

.optional-fields-divider span {
    font-size: 0.875rem;
    font-weight: 600;
    color: #65676b;
    background: #f7f8fa;
    padding: 0 0.75rem;
}

/* Optional Collapsible Sections */
.optional-section {
    margin-bottom: 0.75rem;
    border: 1px solid #e4e6eb;
    border-radius: 0.375rem;
    overflow: hidden;
}

.optional-section-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border: none;
    cursor: pointer;
    font-size: 0.9375rem;
    transition: background 0.2s ease;
}

.optional-section-toggle:hover {
    background: #f7f8fa;
}

.optional-section-toggle.active {
    background: #f0f2f5;
    border-bottom: 1px solid #e4e6eb;
}

.optional-section-content {
    padding: 1rem;
    background: #fafbfc;
}

.optional-section-content .form-group:last-child {
    margin-bottom: 0;
}

/* Small Button */
.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

/* Pulse Summary */
.pulse-summary {
    background: #f0f2f5;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-top: 1.5rem;
}

.pulse-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.pulse-balance {
    color: #4e31ba;
}

.pulse-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pulse-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #65676b;
}

.pulse-item.total {
    padding-top: 0.5rem;
    border-top: 1px solid #ccd0d5;
    margin-top: 0.25rem;
    color: #050505;
}

/* Form Error */
.form-error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c00;
    padding: 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    margin-top: 1rem;
}

/* Modal Footer */
.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e4e6eb;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 0.375rem;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #4e31ba;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #3d2694;
}

.btn-primary:disabled {
    background: #ccd0d5;
    cursor: not-allowed;
}

.btn-secondary {
    background: #e4e6eb;
    color: #050505;
}

.btn-secondary:hover {
    background: #d8dadf;
}

.btn-loader {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 640px) {
    .modal-container {
        max-height: 100vh;
        border-radius: 0;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}