/**
 * Astabaya Share Styles
 * Styling untuk fitur share yang responsif
 * Mendukung laptop, tablet (iPad), dan mobile (HP)
 */

/* ========================================
   SHARE BUTTON STYLES
   ======================================== */

/* Share button container - positioning next to download button */
.chart-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Share button styling */
.btn-share {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.btn-share:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
}

.btn-share:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(102, 126, 234, 0.2);
}

.btn-share i {
    font-size: 16px;
}

/* Small variant for compact spaces */
.btn-share.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-share.btn-sm i {
    font-size: 14px;
}

/* Icon only variant for very small spaces */
.btn-share.icon-only {
    padding: 8px;
    gap: 0;
}

.btn-share.icon-only span {
    display: none;
}

/* ========================================
   SHARE MODAL STYLES
   ======================================== */

.astabaya-share-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.astabaya-share-modal.show {
    opacity: 1;
}

.astabaya-share-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.astabaya-share-modal.show .astabaya-share-content {
    transform: scale(1);
}

.astabaya-share-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.astabaya-share-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
}

.astabaya-share-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.astabaya-share-close:hover {
    background-color: #f3f4f6;
    color: #1f2937;
}

.astabaya-share-body {
    padding: 24px;
}

.astabaya-share-title {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 20px 0;
    font-weight: 500;
}

/* Share platform buttons */
.astabaya-share-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.astabaya-share-platform-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.astabaya-share-platform-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.astabaya-share-platform-btn:active {
    transform: translateY(0);
}

.astabaya-share-platform-btn i {
    font-size: 18px;
}

/* Link sharing section */
.astabaya-share-link {
    display: flex;
    gap: 8px;
    padding: 16px;
    background-color: #f9fafb;
    border-radius: 8px;
}

.astabaya-share-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: #4b5563;
    background-color: white;
}

.astabaya-share-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.astabaya-share-copy-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.astabaya-share-copy-btn:hover {
    background-color: #5568d3;
}

.astabaya-share-copy-btn.success {
    background-color: #10b981;
}

.astabaya-share-copy-btn i {
    font-size: 16px;
}

/* ========================================
   RESPONSIVE STYLES
   ======================================== */

/* Tablet (iPad) - 768px to 1024px */
@media (max-width: 1024px) and (min-width: 768px) {
    .btn-share {
        padding: 5px 10px;
        font-size: 13px;
        gap: 5px;
    }

    .btn-share i {
        font-size: 15px;
    }

    .astabaya-share-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .astabaya-share-content {
        max-width: 480px;
    }
}

/* Mobile (HP) - max 767px */
@media (max-width: 767px) {
    /* Compact share button for mobile */
    .btn-share {
        padding: 6px 10px;
        font-size: 12px;
        gap: 4px;
    }

    .btn-share span {
        display: none; /* Hide text on mobile, show icon only */
    }

    .btn-share i {
        font-size: 16px;
        margin: 0;
    }

    /* Make dropdown button smaller too */
    .dashboard-card .dropdown .btn-sm {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Modal adjustments for mobile */
    .astabaya-share-modal {
        padding: 16px;
        align-items: flex-end; /* Bottom sheet style on mobile */
    }

    .astabaya-share-content {
        border-radius: 16px 16px 0 0;
        max-width: 100%;
        max-height: 85vh;
    }

    .astabaya-share-header {
        padding: 16px 20px;
    }

    .astabaya-share-header h3 {
        font-size: 18px;
    }

    .astabaya-share-body {
        padding: 20px;
    }

    .astabaya-share-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .astabaya-share-platform-btn {
        padding: 10px 12px;
        font-size: 13px;
        gap: 6px;
    }

    .astabaya-share-platform-btn span {
        font-size: 12px;
    }

    .astabaya-share-link {
        flex-direction: column;
        gap: 10px;
    }

    .astabaya-share-copy-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Very small mobile - max 480px */
@media (max-width: 480px) {
    .btn-share {
        padding: 6px 8px;
    }

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

    .astabaya-share-buttons {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .astabaya-share-platform-btn {
        padding: 12px;
        justify-content: flex-start;
    }
}

/* ========================================
   SHARE CHART BUTTON (Blade Component)
   ======================================== */

/* Share chart button - used by Blade component - matched to download button style */
.share-chart-button, .btn-share {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 10px;
    font-size: 14px;
    font-weight: normal;
    color: #007bff;
    background: transparent;
    border: 1px solid #007bff;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.share-chart-button:hover, .btn-share:hover {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
}

.share-chart-button:active, .btn-share:active {
    transform: translateY(0);
}

.share-chart-button i, .btn-share i {
    font-size: 14px;
    margin-right: 0;
}

/* Standardize all chart header buttons */
.dashboard-card .btn-outline-primary {
    padding: 5px 10px !important;
    border-radius: 5px !important;
    font-size: 14px !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.dashboard-card .btn-outline-primary i {
    font-size: 14px;
}

/* ========================================
   INTEGRATION WITH EXISTING CHARTS
   ======================================== */

/* Chart header actions container */
.chart-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Ensure share button works well with download dropdown */
.dashboard-card [style*="display: flex"][style*="justify-content: space-between"] {
    flex-wrap: wrap;
    gap: 8px;
}

.dashboard-card .chart-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Responsive adjustments for share-chart-button and download button */
@media (max-width: 767px) {
    .share-chart-button,
    .dashboard-card .btn-outline-primary {
        padding: 3px 8px !important;
        font-size: 11px !important;
    }

    .share-chart-button i,
    .dashboard-card .btn-outline-primary i {
        font-size: 10px !important;
    }
    
    .share-chart-button span,
    .dashboard-card .btn-outline-primary span {
        display: none !important; /* Hide text on mobile */
    }
    
    .chart-header-actions {
        gap: 6px;
    }
}

@media (max-width: 575px) {
    .share-chart-button,
    .dashboard-card .btn-outline-primary {
        padding: 4px 6px !important;
        font-size: 10px !important;
    }

    .share-chart-button i,
    .dashboard-card .btn-outline-primary i {
        font-size: 12px !important;
        margin: 0 !important;
    }
}

/* Adjust for mobile to prevent overflow */
@media (max-width: 767px) {
    .dashboard-card [style*="display: flex"][style*="justify-content: space-between"] {
        gap: 6px;
    }

    .dashboard-card h5 {
        flex: 1 1 100%;
        margin-bottom: 8px !important;
    }

    .chart-header-actions {
        flex: 1 1 100%;
        justify-content: flex-end;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

.btn-share:focus,
.astabaya-share-close:focus,
.astabaya-share-platform-btn:focus,
.astabaya-share-copy-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .btn-share,
    .astabaya-share-modal,
    .astabaya-share-content,
    .astabaya-share-platform-btn {
        transition: none;
    }
}

