/* ============================================
   PUBLICATION MODAL STYLES
   ============================================ */

/* Base Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 10000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.7); /* Black w/ opacity */
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fefefe;
    padding: 0;
    border: 1px solid #888;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: var(--primary-color, #2c3e50);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    background: none;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
}

.publication-modal-content {
    max-width: 600px;
    width: 90%;
}

.project-info {
    background: var(--accent-bg, #f8f9fa);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.project-info h3 {
    margin: 0 0 0.5rem 0;
    color: var(--primary-color, #2c3e50);
    font-size: 1.25rem;
}

/* Status Indicators */
.status-indicator {
    margin-top: 0.5rem;
}

.status-badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.status-published {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-draft {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

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

.status-live {
    color: #28a745;
    font-weight: 600;
}

/* Publication URL Display */
.publication-url {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: white;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.publication-url strong {
    color: var(--text-primary, #333);
    white-space: nowrap;
}

.publication-url a {
    color: var(--primary-color, #007bff);
    text-decoration: none;
    word-break: break-all;
}

.publication-url a:hover {
    text-decoration: underline;
}

.btn-copy {
    background: none;
    border: 1px solid #ddd;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s;
}

.btn-copy:hover {
    background: #f5f5f5;
}

/* Publish Interface */
.publish-interface, .unpublish-interface {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.publish-interface h4, .unpublish-interface h4 {
    margin: 0 0 1rem 0;
    color: var(--primary-color, #2c3e50);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* URL Configuration */
.url-config {
    margin: 1.5rem 0;
}

.url-config label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary, #333);
}

.url-preview {
    display: flex;
    align-items: stretch;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.url-preview:focus-within {
    border-color: var(--primary-color, #007bff);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.url-base {
    background: #f8f9fa;
    padding: 0.75rem 1rem;
    border-right: 1px solid #e0e0e0;
    color: #666;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

#public-slug {
    border: none;
    padding: 0.75rem 1rem;
    flex: 1;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: white;
    outline: none;
    font-size: 0.9rem;
}

/* Validation Messages */
.validation-message {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    min-height: 1.2rem;
}

.validation-success {
    color: #28a745;
}

.validation-error {
    color: #dc3545;
}

.validation-checking {
    color: #6c757d;
}

.url-rules {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 4px solid #17a2b8;
}

.url-rules small {
    color: #6c757d;
    line-height: 1.4;
}

/* Subscription Check */
.subscription-check {
    margin: 1.5rem 0;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.subscription-active {
    color: #28a745;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.subscription-required {
    color: #dc3545;
    text-align: center;
}

.subscription-required .btn {
    margin-top: 0.5rem;
}

.subscription-error {
    color: #856404;
    background: #fff3cd;
    padding: 0.75rem;
    border-radius: 4px;
    text-align: center;
}

/* Publication Details */
.publication-details {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    margin: 1rem 0;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e9ecef;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row strong {
    color: var(--text-primary, #333);
}

/* Action Buttons */
.publish-actions, .unpublish-actions {
    margin-top: 1.5rem;
    text-align: center;
}

.publish-actions .btn, .unpublish-actions .btn {
    min-width: 160px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color, #007bff);
    color: white;
    border: none;
    transition: background 0.2s;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark, #0056b3);
}

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

.btn-warning {
    background: #ffc107;
    color: #212529;
    border: none;
    transition: background 0.2s;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color, #007bff);
    color: var(--primary-color, #007bff);
    transition: all 0.2s;
}

.btn-outline:hover {
    background: var(--primary-color, #007bff);
    color: white;
}

.warning-text {
    margin-top: 0.75rem;
    color: #856404;
    font-size: 0.85rem;
    text-align: center;
}

/* Error Messages */
.error-message {
    text-align: center;
    padding: 2rem;
    color: #dc3545;
}

.error-message .btn {
    margin-top: 1rem;
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: #6c757d;
}

.loading-spinner::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #6c757d;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .publication-modal-content {
        width: 95%;
        margin: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .url-preview {
        flex-direction: column;
    }
    
    .url-base {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .publication-url {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}