/**
 * Travel Plan Frontend CSS
 * 
 * Styling for frontend display of travel plans including
 * user profiles, shared pages, maps, and interactive elements.
 * 
 * @package AutomuseumsCore
 * @since 1.0.0
 */

/* ==========================================================================
   User Travel Plans Layout
   ========================================================================== */

.user-travel-plans {
    margin: 20px 0;
}

.user-travel-plans.layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.user-travel-plans.layout-list .travel-plan-card {
    margin-bottom: 20px;
}

/* ==========================================================================
   Travel Plan Cards
   ========================================================================== */

.travel-plan-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.travel-plan-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: #0073aa;
}

.travel-plan-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 10px;
}

.travel-plan-card h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
    flex: 1;
    padding-right: 10px;
}

.travel-plan-privacy span {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.privacy-public {
    background: #d1edff;
    color: #0073aa;
}

.privacy-unlisted {
    background: #fff3cd;
    color: #856404;
}

.privacy-private {
    background: #f8d7da;
    color: #721c24;
}

.travel-plan-card-content {
    margin-bottom: 15px;
}

.travel-plan-card-content p {
    margin: 0 0 10px 0;
    color: #666;
    line-height: 1.5;
}

.travel-plan-stats {
    display: flex;
    gap: 15px;
    font-size: 14px;
    color: #888;
    margin-top: 10px;
}

.travel-plan-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.travel-plan-stats span:before {
    content: '';
    width: 4px;
    height: 4px;
    background: #0073aa;
    border-radius: 50%;
    display: inline-block;
}

.museum-count:before {
    background: #d63384;
}

.travel-date:before {
    background: #198754;
}

.travel-plan-card-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.travel-plan-card-actions .button-primary,
.travel-plan-card-actions .button-secondary {
    padding: 8px 16px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.button-primary {
    background: #0073aa;
    color: white;
}

.button-primary:hover {
    background: #005177;
    color: white;
}

.button-secondary {
    background: #f7f7f7;
    color: #333;
    border: 1px solid #ddd;
}

.button-secondary:hover {
    background: #e9e9e9;
    color: #333;
}

/* ==========================================================================
   Travel Plan Map
   ========================================================================== */

.travel-plan-map-container {
    margin: 20px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.travel-plan-map {
    width: 100%;
    background: #f9f9f9;
    position: relative;
}

.map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    font-style: italic;
}

/* ==========================================================================
   Museums List
   ========================================================================== */

.travel-plan-museums {
    margin: 20px 0;
}

.museum-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #fafafa;
    transition: all 0.2s ease;
}

.museum-item:hover {
    background: #f0f6fc;
    border-color: #0073aa;
}

.museum-number {
    background: #0073aa;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.museum-info {
    flex: 1;
}

.museum-info h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
}

.museum-info h4 a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
}

.museum-info h4 a:hover {
    color: #0073aa;
}

.museum-address {
    margin: 0 0 8px 0;
    color: #666;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.museum-address:before {
    content: '📍';
    font-size: 12px;
}

.visit-date {
    margin: 0 0 5px 0;
    font-size: 14px;
    color: #444;
}

.visit-notes {
    margin: 0;
    font-size: 14px;
    color: #666;
    font-style: italic;
}

/* ==========================================================================
   Share Components
   ========================================================================== */

.travel-plan-share-btn,
.copy-share-btn {
    background: #0073aa;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.travel-plan-share-btn:hover,
.copy-share-btn:hover {
    background: #005177;
}

.travel-plan-share-btn.copied,
.copy-share-btn.copied {
    background: #46b450;
    animation: successPulse 0.3s ease;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.travel-plan-share-link {
    color: #0073aa;
    text-decoration: none;
    padding: 8px 12px;
    border: 1px solid #0073aa;
    border-radius: 4px;
    display: inline-block;
    transition: all 0.2s ease;
}

.travel-plan-share-link:hover {
    background: #0073aa;
    color: white;
}

.travel-plan-share-full {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.share-url-container {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.share-url-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
    background: #fff;
}

/* ==========================================================================
   Shared Travel Plan Page
   ========================================================================== */

.travel-plan-shared-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.travel-plan-header h1 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 28px;
}

.travel-plan-meta {
    font-size: 14px;
}

.travel-plan-meta .author {
    color: #666;
    margin: 0;
}

.travel-plan-meta .travel-dates {
    color: #0073aa;
    margin: 5px 0 0 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.travel-plan-description,
.travel-plan-notes {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #0073aa;
}

.travel-plan-description h3,
.travel-plan-notes h3 {
    margin: 0 0 15px 0;
    color: #333;
}

.travel-plan-map-section h3,
.travel-plan-museums-list h3 {
    color: #333;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 8px;
    margin-bottom: 20px;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .user-travel-plans.layout-grid {
        grid-template-columns: 1fr;
    }
    
    .travel-plan-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .travel-plan-card h3 {
        padding-right: 0;
    }
    
    .travel-plan-stats {
        flex-direction: column;
        gap: 8px;
    }
    
    .travel-plan-card-actions {
        justify-content: stretch;
    }
    
    .travel-plan-card-actions .button-primary,
    .travel-plan-card-actions .button-secondary {
        flex: 1;
        text-align: center;
    }
    
    .museum-item {
        flex-direction: column;
        text-align: center;
    }
    
    .museum-number {
        align-self: center;
    }
    
    .share-url-container {
        flex-direction: column;
    }
    
    .travel-plan-shared-container {
        padding: 15px;
    }
    
    .travel-plan-header h1 {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .travel-plan-card {
        padding: 15px;
    }
    
    .travel-plan-card h3 {
        font-size: 16px;
    }
    
    .museum-item {
        padding: 12px;
    }
    
    .travel-plan-shared-container {
        padding: 10px;
    }
}

/* ==========================================================================
   Ultimate Member Integration
   ========================================================================== */

.um-profile-body .travel-plan-card {
    box-shadow: none;
    border: 1px solid #e4e4e4;
}

.um-profile-body .user-travel-plans.layout-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.travel-plan-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #666;
}

.travel-plan-loading:before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

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

/* ==========================================================================
   Error States
   ========================================================================== */

.travel-plan-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
    text-align: center;
}

.travel-plan-empty {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

/* ==========================================================================
   Interactive Elements
   ========================================================================== */

.travel-plan-card,
.museum-item,
.travel-plan-share-btn,
.copy-share-btn,
.travel-plan-share-link {
    position: relative;
    overflow: hidden;
}

.travel-plan-card:before,
.museum-item:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
}

.travel-plan-card:hover:before,
.museum-item:hover:before {
    left: 100%;
}

/* ==========================================================================
   Save Plan Button & CTA (P1-7)
   ========================================================================== */

/* Save CTA Section - Gradient Background */
.travel-plan-cta--save {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

.travel-plan-cta--save h3 {
    color: #fff;
}

.travel-plan-cta--save p {
    color: rgba(255, 255, 255, 0.9);
}

/* Save Button Styles */
.btn-save-plan,
.btn-login-to-save {
    display: inline-block;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    background: #fff;
    color: #667eea;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    min-height: 44px; /* Touch-friendly */
}

.btn-save-plan:hover:not(:disabled),
.btn-login-to-save:hover:not(:disabled) {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.btn-save-plan:disabled,
.btn-login-to-save:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Loading State with Spinner */
.btn-save-plan.is-loading,
.btn-login-to-save.is-loading {
    position: relative;
    pointer-events: none;
}

.btn-save-plan .spinner,
.btn-login-to-save .spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

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

/* Text Muted for Sign In Link */
.text-muted {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    margin-top: 12px;
}

.text-muted a {
    color: #3b82f6;
    text-decoration: underline;
    font-weight: 700;
}

.text-muted a:hover {
    color: #2563eb;
}

/* Share & Export Action Buttons */
.travel-plan-action-buttons {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.travel-plan-action-buttons h4 {
    color: #fff;
    font-size: 18px;
    margin: 0 0 16px 0;
    font-weight: 600;
}

.share-buttons-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 6px;
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
}

.share-btn:hover:not(:disabled):not(.btn-disabled) {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.share-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Social Platform Colors */
.share-facebook {
    background: #1877f2;
    border-color: #1877f2;
}

.share-facebook:hover {
    background: #166fe5;
    border-color: #166fe5;
}

.share-twitter {
    background: #1da1f2;
    border-color: #1da1f2;
}

.share-twitter:hover {
    background: #1a94da;
    border-color: #1a94da;
}

.share-whatsapp {
    background: #25d366;
    border-color: #25d366;
}

.share-whatsapp:hover {
    background: #22c55e;
    border-color: #22c55e;
}

.share-copy {
    background: #6c757d;
    border-color: #6c757d;
}

.share-copy:hover {
    background: #5a6268;
    border-color: #5a6268;
}

/* Map & GPX Buttons */
.share-map,
.share-gpx {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.share-map:hover,
.share-gpx:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
}

/* ==========================================================================
   Toast Notifications (P1-7)
   ========================================================================== */

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 280px;
    max-width: 400px;
    padding: 16px 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.toast--visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Toast Types */
.toast--success {
    background: #d4edda;
    border-left: 4px solid #28a745;
    color: #155724;
}

.toast--error {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
    color: #721c24;
}

.toast--info {
    background: #d1ecf1;
    border-left: 4px solid #17a2b8;
    color: #0c5460;
}

/* Toast Icon */
.toast__icon {
    font-size: 24px;
    font-weight: bold;
    flex-shrink: 0;
}

.toast--success .toast__icon {
    color: #28a745;
}

.toast--error .toast__icon {
    color: #dc3545;
}

.toast--info .toast__icon {
    color: #17a2b8;
}

/* Toast Message */
.toast__message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

/* ==========================================================================
   Mobile Responsive - Save Button & Toast
   ========================================================================== */

@media (max-width: 768px) {
    /* Full-width buttons on mobile */
    .btn-save-plan,
    .btn-login-to-save {
        width: 100%;
        padding: 12px 24px;
        font-size: 15px;
    }

    /* Smaller save CTA padding */
    .travel-plan-cta--save {
        padding: 30px 20px;
    }

    .travel-plan-cta--save h3 {
        font-size: 20px;
    }

    .travel-plan-cta--save p {
        font-size: 14px;
    }

    /* Share buttons responsive */
    .travel-plan-action-buttons {
        margin-top: 25px;
        padding-top: 25px;
    }

    .travel-plan-action-buttons h4 {
        font-size: 16px;
    }

    .share-buttons-wrapper {
        gap: 8px;
    }

    .share-btn {
        font-size: 13px;
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    /* Toast full-width on small screens */
    .toast {
        left: 10px;
        right: 10px;
        top: 10px;
        min-width: auto;
        max-width: none;
    }

    /* Smaller buttons */
    .btn-save-plan,
    .btn-login-to-save {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* ==========================================================================
   Login Modal (P1-7)
   ========================================================================== */

.travel-plan-login-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.travel-plan-login-modal.is-visible {
    opacity: 1;
    visibility: visible;
}

.login-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    cursor: pointer;
}

.login-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.travel-plan-login-modal.is-visible .login-modal-content {
    transform: scale(1);
}

.login-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    font-size: 32px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    z-index: 10;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.login-modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

.login-modal-header {
    padding: 30px 30px 20px;
    border-bottom: 1px solid #eee;
    text-align: center;
}

.login-modal-header h3 {
    margin: 0 0 10px 0;
    font-size: 24px;
    color: #333;
}

.login-modal-header p {
    margin: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

.login-modal-body {
    padding: 0;
    min-height: 400px;
}

.login-modal-body iframe {
    width: 100%;
    min-height: 500px;
    border: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .login-modal-content {
        max-width: 100%;
        width: 95%;
        border-radius: 8px;
    }

    .login-modal-header {
        padding: 20px 20px 15px;
    }

    .login-modal-header h3 {
        font-size: 20px;
    }

    .login-modal-body iframe {
        min-height: 450px;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .travel-plan-card-actions,
    .travel-plan-share-btn,
    .copy-share-btn,
    .travel-plan-share-link,
    .btn-save-plan,
    .btn-login-to-save,
    .toast {
        display: none;
    }

    .travel-plan-card {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }

    .travel-plan-map {
        background: #f0f0f0;
        color: #333;
        text-align: center;
        padding: 20px;
    }

    .travel-plan-map:after {
        content: 'Interactive map - view online to see full map';
        display: block;
    }
}