/* trips/static/trips/sharing.css */

/* ========================================
   TRIP SHARE MODAL BASE STYLES
   ======================================== */

.trip-share-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding: 1rem;
    box-sizing: border-box;
}

.trip-share-modal.active,
.trip-share-modal.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.trip-share-modal-content {
    background-color: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: calc(90vh - 2rem);
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.trip-share-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.trip-share-modal-header h2 {
    margin: 0;
    color: #111827;
    font-size: 1.5rem;
    font-weight: 600;
}

.trip-share-close-modal {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    transition: color 0.2s ease;
}

.trip-share-close-modal:hover {
    color: #111827;
}

.trip-share-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* ========================================
   TRIP SHARING MODAL STYLES
   ======================================== */

.share-modal-content {
    padding: 0;
    max-height: 100%;
    overflow-y: auto;
}

.share-section {
    margin-bottom: 2rem;
}

.share-section h3 {
    color: var(--primary);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    font-weight: 600;
}

/* ========================================
   USER SEARCH STYLES
   ======================================== */

.follower-search {
    margin-bottom: 2rem;
}

.follower-search label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--neutral-dark);
}

.search-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-group input {
    width: 100%;
    padding: 12px 16px;
    padding-right: 40px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.search-input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-input-group i {
    position: absolute;
    right: 12px;
    color: #9ca3af;
    pointer-events: none;
}

.search-results {
    margin-top: 1rem;
}

/* User search results styling */
.search-results .user-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s ease;
    background: white;
}

.search-results .user-result:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.search-results .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-results .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background-color: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-results .avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-results .avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 24px;
}

.search-results .user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.search-results .user-details h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.search-results .user-details p {
    margin: 0;
    font-size: 13px;
    color: #6b7280;
}

.search-results .error-message,
.search-results .no-results {
    padding: 16px;
    text-align: center;
    color: #6b7280;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-top: 8px;
    background: white;
}

.search-results .error-message {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.search-results .error-message i {
    margin-right: 8px;
}

/* ========================================
   PERMISSION SELECTOR STYLES
   ======================================== */

.permission-selector {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-top: 16px;
    animation: slideIn 0.3s ease-out;
}

.permission-header {
    text-align: center;
    margin-bottom: 24px;
}

.permission-header h4 {
    margin: 0 0 8px 0;
    color: var(--primary);
    font-size: 1.2rem;
    font-weight: 600;
}

.permission-header p {
    margin: 0;
    color: #6b7280;
    font-size: 0.95rem;
}

.user-info-summary {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 24px;
    border: 1px solid #e5e7eb;
}

.user-info-summary .user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background-color: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-info-summary .avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info-summary .avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 28px;
}

.user-info-summary .user-details h5 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.user-info-summary .user-details p {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
}

.permission-form {
    margin: 0;
}

.permission-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.permission-option {
    display: flex;
    align-items: center;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.permission-option:hover {
    border-color: #d1d5db;
    background: #f9fafb;
}

.permission-option input[type="radio"] {
    margin: 0 16px 0 0;
    transform: scale(1.2);
    accent-color: var(--primary);
}

.permission-option input[type="radio"]:checked + .option-content {
    color: var(--primary);
}

.permission-option:has(input[type="radio"]:checked) {
    border-color: var(--primary);
    background: #eff6ff;
}

.option-content {
    flex: 1;
}

.option-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.option-header i {
    font-size: 16px;
}

.option-title {
    font-weight: 600;
    font-size: 15px;
}

.option-description {
    margin: 0;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.4;
}

.permission-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.permission-actions .btn {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
}

.permission-actions .btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.permission-actions .btn-secondary:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

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

.permission-actions .btn-primary:hover {
    background: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.permission-actions .btn:active {
    transform: translateY(0);
}

/* ========================================
   EMAIL INVITE STYLES
   ======================================== */

.email-invite {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

.email-invite label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--neutral-dark);
}

.email-input-group {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.email-input-group input {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.email-input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.email-input-group select {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    transition: all 0.2s ease;
}

.email-input-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.email-input-group button {
    padding: 12px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.email-input-group button:hover {
    background: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.email-input-group button:active {
    transform: translateY(0);
}

/* ========================================
   COLLABORATORS LIST STYLES
   ======================================== */

.collaborators-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

.collaborators-section h3 {
    color: var(--primary);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    font-weight: 600;
}

.collaborators-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.collaborator-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.collaborator-item:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.collaborator-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s ease;
}

.collaborator-info:hover {
    opacity: 0.8;
}

.collaborator-info:hover .collaborator-name {
    color: var(--primary-color, #14B8A6);
    text-decoration: underline;
}

.collaborator-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background-color: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

.collaborator-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.collaborator-avatar i {
    color: #9ca3af;
    font-size: 20px;
}

.collaborator-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.collaborator-name {
    font-weight: 600;
    color: #111827;
    font-size: 14px;
}

.collaborator-email {
    color: #6b7280;
    font-size: 13px;
}

.collaborator-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.permission-select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    transition: all 0.2s ease;
}

.permission-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.no-collaborators {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    padding: 2rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px dashed #d1d5db;
}

/* ========================================
   INVITE SUCCESS STYLES
   ======================================== */

.invite-success {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.success-icon {
    flex-shrink: 0;
}

.success-icon i {
    color: #10b981;
    font-size: 24px;
}

.success-message h4 {
    margin: 0 0 8px 0;
    color: #065f46;
    font-size: 1.1rem;
    font-weight: 600;
}

.success-message p {
    margin: 0;
    color: #047857;
    font-size: 0.95rem;
    line-height: 1.4;
}

/* ========================================
   NOTIFICATION TOAST STYLES
   ======================================== */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 10000;
    animation: slideIn 0.3s ease-out;
    max-width: 400px;
    word-wrap: break-word;
}

.notification-success {
    background-color: #10b981;
}

.notification-error {
    background-color: #ef4444;
}

.notification-info {
    background-color: #3b82f6;
}

.notification-warning {
    background-color: #f59e0b;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.notification.slide-out {
    animation: slideOut 0.3s ease-out;
}

/* ========================================
   LOADING STATES
   ======================================== */

.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .trip-share-modal {
        padding: 0.5rem;
    }

    .trip-share-modal-content {
        width: 95%;
        max-height: calc(100vh - 1rem);
    }

    .trip-share-modal-header {
        padding: 1rem;
    }

    .trip-share-modal-header h2 {
        font-size: 1.25rem;
    }

    .trip-share-modal-body {
        padding: 1rem;
    }

    .email-input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .email-input-group input,
    .email-input-group select {
        min-width: auto;
    }

    .collaborator-item {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .collaborator-actions {
        justify-content: space-between;
    }

    .permission-selector {
        padding: 16px;
        margin-top: 12px;
    }

    .permission-actions {
        flex-direction: column;
        gap: 8px;
    }

    .permission-actions .btn {
        justify-content: center;
    }

    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .trip-share-modal {
        padding: 0.25rem;
    }

    .trip-share-modal-content {
        width: 98%;
        max-height: calc(100vh - 0.5rem);
        border-radius: 12px;
    }

    .trip-share-modal-header {
        padding: 0.75rem;
    }

    .trip-share-modal-header h2 {
        font-size: 1.1rem;
    }

    .trip-share-modal-body {
        padding: 0.75rem;
    }

    .trip-share-close-modal {
        font-size: 1.5rem;
        padding: 0.25rem;
    }

    .share-section {
        margin-bottom: 1.5rem;
    }

    .search-results .user-result {
        padding: 10px;
    }

    .collaborator-item {
        padding: 12px;
    }

    .permission-selector {
        padding: 12px;
    }

    .user-info-summary {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    .invite-success {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
}

/* ========================================
   SHARE STATS STYLES
   ======================================== */

.share-stats {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    position: relative;
}

.share-count-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: center;
}

.share-count-button:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
}

.share-count-button i {
    color: var(--primary);
    font-size: 16px;
}

.share-count-button #share-count {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}

.sharers-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 8px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
}

.sharers-dropdown.hidden {
    display: none;
}

/* Share explore button group - inline layout */
.share-explore-group {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

/* Share count badge - compact inline version */
.share-count-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: white;
    border: 2px solid var(--primary);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.share-count-badge:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
}

.share-count-badge i {
    font-size: 14px;
}

.share-count-badge span {
    min-width: 20px;
    text-align: center;
}

/* Update dropdown positioning for inline context */
#sharers-dropdown-detail {
    position: fixed;
    width: 300px;
    min-height: 100px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    color: #111827;
    box-sizing: border-box;
    display: block;
}

#sharers-dropdown-detail.hidden {
    display: none;
}

#sharers-dropdown-detail:not(.hidden) {
    display: block;
}

/* ========================================
   LOADING INDICATOR STYLES
   ======================================== */

.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.loading-indicator.hidden {
    display: none;
}

/* ========================================
   SHARERS LIST STYLES
   ======================================== */

.sharers-list {
    padding: 16px;
    background-color: #ffffff;
    color: #111827;
    border: 1px solid #e5e7eb;
    box-sizing: border-box;
}

.sharer-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sharer-item {
    margin-bottom: 8px;
}

.sharer-item:last-child {
    margin-bottom: 0;
}

.sharer-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    color: #111827;
    transition: all 0.2s ease;
}

.sharer-link:hover {
    background: #f9fafb;
}

.sharer-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.sharer-avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    flex-shrink: 0;
}

.sharer-name {
    font-weight: 600;
    font-size: 14px;
    color: #111827;
}

.sharers-more {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.sharers-more-text {
    color: #6b7280;
    font-size: 13px;
}

.sharers-empty {
    padding: 24px;
    text-align: center;
}

.sharers-empty p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

/* ========================================
   TRIP CARD SHARER ATTRIBUTION
   ======================================== */

.trip-sharers {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 13px;
    color: #6b7280;
}

.trip-sharers i {
    color: var(--primary);
    font-size: 12px;
}

.trip-sharers span {
    line-height: 1.4;
}

/* Responsive adjustments for share stats */
@media (max-width: 768px) {
    .share-count-button {
        padding: 10px 14px;
        font-size: 13px;
    }

    .share-count-button #share-count {
        padding: 2px 6px;
        font-size: 11px;
    }
}
